lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-devel] API change: restructuring ipv4/ipv6 integration (task #


From: Sylvain Rochet
Subject: Re: [lwip-devel] API change: restructuring ipv4/ipv6 integration (task #12722)
Date: Fri, 10 Apr 2015 19:04:32 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Hello Simon,


On Fri, Apr 10, 2015 at 07:29:11AM +0200, Simon Goldschmidt wrote:
> Sylvain Rochet wrote:
> > Unfortunately, we are now hitting GCC bug #53119 [1][2][3].
> >
> > lwip/src/core/ipv4/ip4_addr.c:53:3: warning: missing braces around 
> > initializer [-Wmissing-braces]
> > }, IPADDR_TYPE_V4
> > ^
> > lwip/src/core/ipv4/ip4_addr.c:53:3: warning: (near initialization for 
> > ‘ip_addr_any.addr.ip4’) [-Wmissing-braces]
> > [..]
> > Adding an extra brace level shut up the compiler warning, does it still
> > work for all compilers ?
> 
> I think it should. Seems like I just got the initializer wrong and 
> MSVC doesn't care :-( Anyway, that GCC bug seems to be a bit different 
> in that the generic short-zero initializer '{0}' doesn't work. But 
> except for 'ip_addr_any', we initialize to non-zero, so that's 
> something different.
> 
> Reading about this makes me think the order of ip4/ip6 in the 
> ip_addr_t union needs to be changed to allow constant initialization 
> of the larger ip6 part...

I guess you are right, I am bit confused about what is correct here and 
what should be done for the GCC bug if we are hitting it.


Anyway, we are now hitting the bug if I understand correctly for 
IPADDR_ANY(=0) :

lwip/src/core/ipv4/ip4_addr.c:47:1: warning: missing braces around initializer 
[-Wmissing-braces]
 const ip_addr_t ip_addr_any = IPADDR4_INIT(IPADDR_ANY);
 ^
lwip/src/core/ipv4/ip4_addr.c:47:1: warning: (near initialization for 
‘ip_addr_any.addr.ip6.addr’) [-Wmissing-braces]
lwip/src/core/ipv4/ip4_addr.c:48:1: warning: missing braces around initializer 
[-Wmissing-braces]
 const ip_addr_t ip_addr_broadcast = IPADDR4_INIT(IPADDR_BROADCAST);
 ^
lwip/src/core/ipv6/ip6_addr.c:51:1: warning: missing braces around initializer 
[-Wmissing-braces]
 const ip_addr_t ip6_addr_any = IPADDR6_INIT(0xaul, 0xbul, 0xcul, 0xdul);
 ^

Adding an extra brace level shut up the compiler warning:

diff --git a/src/include/lwip/ip_addr.h b/src/include/lwip/ip_addr.h
index c884eaa..e5cfdb8 100644
--- a/src/include/lwip/ip_addr.h
+++ b/src/include/lwip/ip_addr.h
@@ -58,8 +58,8 @@ typedef struct _ip_addr {
 #define IPADDR_TYPE_V4                0U
 #define IPADDR_TYPE_V6                6U
 
-#define IPADDR4_INIT(u32val)          { { { u32val, 0ul, 0ul, 0ul } }, 
IPADDR_TYPE_V4 }
-#define IPADDR6_INIT(a, b, c, d)      { { { a, b, c, d } }, IPADDR_TYPE_V6 }
+#define IPADDR4_INIT(u32val)          { { { { u32val, 0ul, 0ul, 0ul } } }, 
IPADDR_TYPE_V4 }
+#define IPADDR6_INIT(a, b, c, d)      { { { { a, b, c, d } } }, IPADDR_TYPE_V6 
}
 
 #define IP_IS_V6_L(ipaddr)            ((ipaddr)->type == IPADDR_TYPE_V6)
 #define IP_IS_V6(ipaddr)              (((ipaddr) != NULL) && 
IP_IS_V6_L(ipaddr))


Sylvain

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]