ldb:dlinklist: avoid -Wtautological-compare errors with gcc6
authorIra Cooper <ira@samba.org>
Wed, 13 Jul 2016 10:37:19 +0000 (12:37 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 14 Jul 2016 03:44:20 +0000 (05:44 +0200)
We expect these macros to generate tautological compares
intentionally, so disabling the warning is just fine.

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

Pair-Programmed-With: Michael Adam <obnox@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Ira Cooper <ira@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jul 14 05:44:21 CEST 2016 on sn-devel-144

lib/ldb/include/dlinklist.h

index ef01aec9f1c5591a32deda00a6142dcb8f441709..ca76794d6d2d57738df2a2a3aaaf8c38bb0e8adb 100644 (file)
@@ -83,6 +83,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; \
@@ -94,6 +97,7 @@ do { \
                if ((p)->next) (p)->next->prev = (p)->prev; \
        } \
        if ((p) != (list)) (p)->next = (p)->prev = NULL;        \
+       _Pragma ("GCC diagnostic pop") \
 } while (0)
 
 /*
@@ -124,7 +128,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)