lwip-devel
[Top][All Lists]
Advanced

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

Re: [lwip-devel] [PATCH] ip_addr.h: Add cast in IP_SET_TYPE() macro in o


From: Jacob Kroon
Subject: Re: [lwip-devel] [PATCH] ip_addr.h: Add cast in IP_SET_TYPE() macro in order to fix compiler warnings/errors
Date: Tue, 1 Jan 2019 20:21:15 +0100

On Tue, Jan 1, 2019 at 7:42 PM address@hidden <address@hidden> wrote:
>
> Am 01.01.2019 um 19:38 schrieb Jacob Kroon:
> > Fix building unit tests (contrib/ports/unix/check) on Debian 9, gcc 6.3.0.
> >
> > Fixes:
> > <snip>/ip_addr.h:105:58: error: the comparison will always evaluate as 
> > ‘true’ for the address of ‘ip1’ will never be NULL [-Werror=address]
> >   #define IP_SET_TYPE(ipaddr, iptype)     do { if((ipaddr) != NULL) { 
> > IP_SET_TYPE_VAL(*(ipaddr),iptype); }}while(0)
> >
> > Signed-off-by: Jacob Kroon <address@hidden>
>
> In contrast to other open source projects, we don't use this mailing
> list to send raw patches. We use the bugtracker at savannah instead.
>

Oh ok I see, I've retried with submitting a new patch at savannah.org.

> > ---
> >   src/include/lwip/ip_addr.h | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/src/include/lwip/ip_addr.h b/src/include/lwip/ip_addr.h
> > index ee7a0c9d..aed7fbcf 100644
> > --- a/src/include/lwip/ip_addr.h
> > +++ b/src/include/lwip/ip_addr.h
> > @@ -102,7 +102,7 @@ extern const ip_addr_t ip_addr_any_type;
> >   #define IP_IS_V6(ipaddr)              (((ipaddr) != NULL) && 
> > IP_IS_V6_VAL(*(ipaddr)))
> >
> >   #define IP_SET_TYPE_VAL(ipaddr, iptype) do { (ipaddr).type = (iptype); 
> > }while(0)
> > -#define IP_SET_TYPE(ipaddr, iptype)     do { if((ipaddr) != NULL) { 
> > IP_SET_TYPE_VAL(*(ipaddr), iptype); }}while(0)
> > +#define IP_SET_TYPE(ipaddr, iptype)     do { if((void*)(ipaddr) != NULL) { 
> > IP_SET_TYPE_VAL(*(ipaddr), iptype); }}while(0)
>
> This change silences all those warnings. Instead, we want to use
> IP_SET_TYPE_VAL() for the callers where this warning appears.
>

I changed the patch I submitted to savannah.org to use
ip_addr_set_any_val() where appropriate.
Thanks for the feedback,
/Jacob

> Regards,
> Simon
>
> >   #define IP_GET_TYPE(ipaddr)           ((ipaddr)->type)
> >
> >   #define IP_ADDR_RAW_SIZE(ipaddr)      (IP_GET_TYPE(&ipaddr) == 
> > IPADDR_TYPE_V4 ? sizeof(ip4_addr_t) : sizeof(ip6_addr_t))
> >
>
>
> _______________________________________________
> lwip-devel mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/lwip-devel



reply via email to

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