lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Fix GCC warnings regarding two macros?


From: Nathan Hartman
Subject: [lwip-users] Fix GCC warnings regarding two macros?
Date: Fri, 8 Sep 2017 15:14:32 -0400

When building lwIP-1.4.1 on Linaro GCC v4.9.3 with -Wall, GCC issues warnings in two places where the macro ip_addr_isany(addr1) is used, saying the comparison against NULL will always evaluate to false. This warning is correct in both cases because the macro is given the address of a local stack variable, which can never be NULL.

It is clear that the macro must test for NULL. We need to build with zero compiler warnings. I examined the lwIP-2.0.2 code, since the changelog mentioned fixes to a number of compiler warnings, but I didn't see a change in this macro.

I am tempted to use a trick like the one mentioned here:

https://stackoverflow.com/questions/27048171/disable-warning-the-address-of-x-will-always-evaluate-as-true

Namely to modify the macro, casting to (void *) to trick the compiler into not issuing the warning. However I wonder if there is a "better" fix. Has anyone encountered these warnings before?


reply via email to

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