You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/08/17 13:38:42 UTC

[incubator-nuttx] branch master updated: netdev: fix visual studio Compiler Error C2016

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 14fb56c799 netdev: fix visual studio Compiler Error C2016
14fb56c799 is described below

commit 14fb56c799cb2595d0fbc5a2da80287178be5ee9
Author: chao.an <an...@xiaomi.com>
AuthorDate: Wed Aug 17 18:19:39 2022 +0800

    netdev: fix visual studio Compiler Error C2016
    
    D:\code\incubator-nuttx\include\nuttx/net/netdev.h(275,3):
      error C2016: C requires that a struct or union has at least one member
      [D:\code\incubator-nuttx\vs20222\boards\board.vcxproj]
    
    Compiler error C2016: C requires that a struct or union has at least one member
    
    Reference:
    https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-errors-c2001-through-c2099?view=msvc-170
    
    Signed-off-by: xiangdong6 <xi...@xiaomi.com>
    Signed-off-by: chao.an <an...@xiaomi.com>
---
 include/nuttx/net/netdev.h | 12 ++++++++----
 include/nuttx/spinlock.h   |  4 +---
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/include/nuttx/net/netdev.h b/include/nuttx/net/netdev.h
index 2affc202eb..98b57edf97 100644
--- a/include/nuttx/net/netdev.h
+++ b/include/nuttx/net/netdev.h
@@ -258,21 +258,25 @@ struct net_driver_s
 
   /* Link layer address */
 
+#if defined(CONFIG_NET_ETHERNET) || defined(CONFIG_NET_6LOWPAN) || \
+    defined(CONFIG_NET_BLUETOOTH) || defined(CONFIG_NET_IEEE802154) || \
+    defined(CONFIG_NET_TUN)
   union
   {
-#ifdef CONFIG_NET_ETHERNET
+# if defined(CONFIG_NET_ETHERNET) || defined(CONFIG_NET_TUN)
     /* Ethernet device identity */
 
     struct ether_addr ether;    /* Device Ethernet MAC address */
-#endif
+# endif
 
-#if defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_BLUETOOTH) || \
+# if defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_BLUETOOTH) || \
     defined(CONFIG_NET_IEEE802154)
   /* The address assigned to an IEEE 802.15.4 or generic packet radio. */
 
     struct netdev_varaddr_s radio;
-#endif
+# endif
   } d_mac;
+#endif
 
   /* Network identity */
 
diff --git a/include/nuttx/spinlock.h b/include/nuttx/spinlock.h
index af074e0728..544352ef53 100644
--- a/include/nuttx/spinlock.h
+++ b/include/nuttx/spinlock.h
@@ -33,9 +33,7 @@
 #include <nuttx/irq.h>
 
 #ifndef CONFIG_SPINLOCK
-typedef struct
-{
-} spinlock_t;
+typedef uint8_t spinlock_t;
 #else
 
 /* The architecture specific spinlock.h header file must also provide the