lwip-devel
[Top][All Lists]
Advanced

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

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


From: Jacob Kroon
Subject: [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 19:38:31 +0100

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>
---
 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)
 #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))
-- 
2.11.0




reply via email to

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