add parens when bit and arith ops are mixed in macros in public headers
authorSzabolcs Nagy <nsz@port70.net>
Tue, 11 Feb 2014 17:02:06 +0000 (18:02 +0100)
committerSzabolcs Nagy <nsz@port70.net>
Tue, 11 Feb 2014 17:02:06 +0000 (18:02 +0100)
another commit to silence gcc warnings (-Wparentheses) for standard headers.
changed macros: LOG_UPTO, IN6_ARE_ADDR_EQUAL

include/netinet/in.h
include/syslog.h

index 587ef358b064ffccf6366ade9e71806037fabc12..2e25afebb85b3806209e372d9a96140a69d1407e 100644 (file)
@@ -149,7 +149,7 @@ uint16_t ntohs(uint16_t);
         (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0xe))
 
 #define __ARE_4_EQUAL(a,b) \
-       (!( 0[a]-0[b] | 1[a]-1[b] | 2[a]-2[b] | 3[a]-3[b] ))
+       (!( (0[a]-0[b]) | (1[a]-1[b]) | (2[a]-2[b]) | (3[a]-3[b]) ))
 #define IN6_ARE_ADDR_EQUAL(a,b) \
        __ARE_4_EQUAL((const uint32_t *)(a), (const uint32_t *)(b))
 
index f7f545f7fb2141d17e12fbc26e544e3088251324..71dbd99b30596414c6d65c3f6ce44bf74aa0c218 100644 (file)
@@ -21,7 +21,7 @@ extern "C" {
 #define        LOG_MAKEPRI(f, p) (((f)<<3)|(p))
 
 #define LOG_MASK(p) (1<<(p))
-#define LOG_UPTO(p) ((1<<(p)+1)-1)
+#define LOG_UPTO(p) ((1<<((p)+1))-1)
 
 #define LOG_KERN     (0<<3)
 #define LOG_USER     (1<<3)