Tautological comparison in gcc 6.1.1
Jeremy Allison
jra at samba.org
Wed Jul 13 21:59:52 UTC 2016
On Wed, Jul 13, 2016 at 02:08:18PM +0200, Michael Adam wrote:
> updated patch using _Pragma in the macro, not #pragma around.
> Again thaks to Ira for the hint!!
God that's horrible :-). Can't see any other solution, so
pushed !
> On 2016-07-13 at 13:38 +0200, Michael Adam wrote:
> > On 2016-07-13 at 13:21 +0200, Michael Adam wrote:
> > > update: fixed copy/past errors (push instead of pop at the bottom)
> >
> > Forget that!
> >
> > my patches were only working due to the accidential
> > push instead of pop -- after all the thing is in _macros_ ...
> >
> > Better patches to follow.
> >
> > Michael
> >
> From 65089184b9be88eda6a75b47f0800e72b6086ff8 Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Wed, 13 Jul 2016 12:35:13 +0200
> Subject: [PATCH 1/3] lib:dlinklist: avoid -Wtautological-compare errors with
> gcc6
>
> Thanks to Ira Cooper <ira at wakeful.net> for the hint with _Pragma.
>
> Signed-off-by: Michael Adam <obnox at samba.org>
> ---
> lib/util/dlinklist.h | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/lib/util/dlinklist.h b/lib/util/dlinklist.h
> index 8a1b84d..bdd4f9c 100644
> --- a/lib/util/dlinklist.h
> +++ b/lib/util/dlinklist.h
> @@ -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)
>
> --
> 2.5.5
>
>
> From 8a4f392e797ea1040b9fadedb8799ace442da579 Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Wed, 13 Jul 2016 12:36:21 +0200
> Subject: [PATCH 2/3] tevent: avoid -Wtautological-compare errors with gcc6
>
> Thanks to Ira Cooper <ira at wakeful.net> for the hint with _Pragma.
>
> Signed-off-by: Michael Adam <obnox at samba.org>
> ---
> lib/tevent/tevent_util.h | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/lib/tevent/tevent_util.h b/lib/tevent/tevent_util.h
> index e2cdbb8..eb7586f 100644
> --- a/lib/tevent/tevent_util.h
> +++ b/lib/tevent/tevent_util.h
> @@ -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)
>
> --
> 2.5.5
>
>
> From 8a8f560cd899bb7d7cdd6ff626cc552c90a0de9c Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Wed, 13 Jul 2016 12:37:19 +0200
> Subject: [PATCH 3/3] ldb:dlinklist: avoid -Wtautological-compare errors with
> gcc6
>
> Thanks to Ira Cooper <ira at wakeful.net> for the hint with _Pragma
>
> Signed-off-by: Michael Adam <obnox at samba.org>
> ---
> lib/ldb/include/dlinklist.h | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/lib/ldb/include/dlinklist.h b/lib/ldb/include/dlinklist.h
> index ef01aec..ca76794 100644
> --- a/lib/ldb/include/dlinklist.h
> +++ b/lib/ldb/include/dlinklist.h
> @@ -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)
>
> --
> 2.5.5
>
More information about the samba-technical
mailing list