tevent: avoid -Wtautological-compare errors with gcc6
authorMichael Adam <obnox@samba.org>
Wed, 13 Jul 2016 10:36:21 +0000 (12:36 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 14 Jul 2016 00:06:10 +0000 (02:06 +0200)
We expect these macros to generate tautological compares
intentionally, so disabling the warning is just fine.

This lets --picky-developer work with gcc6 and newer.

Pair-Programmed-With: Ira Cooper <ira@samba.org>

Signed-off-by: Ira Cooper <ira@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/tevent/tevent_util.h

index e2cdbb8d38533fb5b172e3b880b1639a475cadf8..eb7586fd356bde55d03308fb7d921273eb6ebde8 100644 (file)
@@ -79,6 +79,9 @@ do { \
 */
 #define DLIST_REMOVE(list, p) \
 do { \
+       _Pragma ("GCC diagnostic push") \
+       _Pragma ("GCC diagnostic ignored \"-Wpragmas\"") \
+       _Pragma ("GCC diagnostic ignored \"-Wtautological-compare\"") \
        if ((p) == (list)) { \
                if ((p)->next) (p)->next->prev = (p)->prev; \
                (list) = (p)->next; \
@@ -90,6 +93,7 @@ do { \
                if ((p)->next) (p)->next->prev = (p)->prev; \
        } \
        if ((p) != (list)) (p)->next = (p)->prev = NULL;        \
+       _Pragma ("GCC diagnostic pop") \
 } while (0)
 
 /*
@@ -120,7 +124,11 @@ do { \
                (p)->next = (el)->next;         \
                (el)->next = (p);               \
                if ((p)->next) (p)->next->prev = (p);   \
+               _Pragma ("GCC diagnostic push") \
+               _Pragma ("GCC diagnostic ignored \"-Wpragmas\"") \
+               _Pragma ("GCC diagnostic ignored \"-Wtautological-compare\"") \
                if ((list)->prev == (el)) (list)->prev = (p); \
+               _Pragma ("GCC diagnostic pop") \
        }\
 } while (0)