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/nuttx.git

commit 5580de06851b99b80f43e44d9793bbbb2476aa49
Author: chao an <anc...@xiaomi.com>
AuthorDate: Wed Feb 8 16:29:48 2023 +0800

    net/netfilter: fix visual studio Compiler Error C2229
    
    D:\archer\code\nuttx\include\nuttx/net/netfilter/x_tables.h(71,7):
      error C2229: type 'struct xt_standard_target' has an illegal zero-sized 
array
    
    Compiler error C2229:
    A member of a structure or bit field contains a zero-sized array that is 
not the last member.
    
    Reference:
    
https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2229?view=msvc-170
    
    Signed-off-by: chao an <anc...@xiaomi.com>
---
 include/nuttx/net/netfilter/ip_tables.h | 2 +-
 include/nuttx/net/netfilter/x_tables.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/nuttx/net/netfilter/ip_tables.h 
b/include/nuttx/net/netfilter/ip_tables.h
index 0ac092fce0..0828e36e68 100644
--- a/include/nuttx/net/netfilter/ip_tables.h
+++ b/include/nuttx/net/netfilter/ip_tables.h
@@ -117,7 +117,7 @@ struct ipt_entry
 
   struct xt_counters counters; /* Packet and byte counters. */
 
-  unsigned char elems[0];      /* The matches (if any), then the target. */
+  unsigned char elems[1];      /* The matches (if any), then the target. */
 };
 
 /* Note 1: How entries are organized in following interface arguments.
diff --git a/include/nuttx/net/netfilter/x_tables.h 
b/include/nuttx/net/netfilter/x_tables.h
index 721dcaa24a..d180c18ea8 100644
--- a/include/nuttx/net/netfilter/x_tables.h
+++ b/include/nuttx/net/netfilter/x_tables.h
@@ -62,7 +62,7 @@ struct xt_entry_target
       uint16_t target_size; /* Total length */
     } u;
 
-  unsigned char data[0];
+  unsigned char data[1];
 };
 
 struct xt_standard_target

Reply via email to