Tautological comparison in gcc 6.1.1

Amitay Isaacs amitay at gmail.com
Thu Jul 14 08:45:47 UTC 2016


On Thu, Jul 14, 2016 at 6:25 PM, Michael Adam <obnox at samba.org> wrote:

> On 2016-07-14 at 09:52 +0200, Michael Adam wrote:
> > On 2016-07-14 at 15:21 +1000, Martin Schwenke wrote:
> > > On Thu, 14 Jul 2016 06:23:57 +0200, Stefan Metzmacher <metze at samba.org
> >
> > > wrote:
> > >
> > > > Am 14.07.2016 um 04:58 schrieb Ira Cooper:
> > > > > On Wed, Jul 13, 2016 at 6:29 PM, Michael Adam <obnox at samba.org>
> wrote:
> > > > >
> > > > >> On 2016-07-13 at 15:23 -0700, Jeremy Allison wrote:
> > > >  [...]
> > > >  [...]
> > > >  [...]
> > > >  [...]
> > > >  [...]
> > > >  [...]
> > > >  [...]
> > > >  [...]
> > > >  [...]
> > > > >>
> > > > >> here it is
> > > > >>
> > > > >> Thanks - Michael
> > > > >>
> > > > >
> > > > > I agree with Jeremy, this is u-g-l-y.  But there is no cleaner
> solution.
> > > >
> > > > We currently using:
> > > > conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Werror
> > > > -Wno-error=deprecated-declarations', testflags=True)
> > > > can't we just add
> > > > conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS',
> '-Wno-error=tautological-compare',
> > > > testflags=True)
> > > > ?
> > > >
> > > > That would fix it for all cases not just the macros.
> > >
> > > Samba/CTDB no longer builds on (unpatched) RHEL 6.6 with GCC 4.4.7.
> > >
> > > [ 46/248] Compiling lib/tdb_wrap/tdb_wrap.c
> > > ../lib/tdb_wrap/tdb_wrap.c: In function 'tdb_wrap_private_destructor':
> > > ../lib/tdb_wrap/tdb_wrap.c:81: error: #pragma GCC diagnostic not
> allowed inside functions
> > > ../lib/tdb_wrap/tdb_wrap.c:81: error: #pragma GCC diagnostic not
> allowed inside functions
> > > ../lib/tdb_wrap/tdb_wrap.c:81: error: #pragma GCC diagnostic not
> allowed inside functions
> > > ../lib/tdb_wrap/tdb_wrap.c:81: error: #pragma GCC diagnostic not
> allowed inside functions
> > >
> > > GCC version is:
> > >
> > >   gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11)
> > >
> > > RHEL 6.8 has a later build but the changelog doesn't mention any
> > > changes to pragma magic.
> > >
> > > It will have to be either
> > >
> > > "#ifdef gcc >= 6" around the _Pragma hunks.
> >
> > Guess that does not work, because it is inside
> > a macro: This is why we used _Pragma instead
> > of #pragma. And the ignore -Wpramgas was intended
> > to fix older gccs, but apparently I did not test
> > with old enough gcc. :-/
> >
> > Apologies for the inconvenience..
> >
> > > global "-Wno-error=tautological-compare" or
> >
> > Right, what our patch was trying to avoid was getting
> > rid of the other possibly useful cases of -Wtautological-compare
> > but if everyone agrees, then we can just silence
> > them altogether with a global setting...
> >
> > Will propose another patch...
>
> Attached.
> It reverts the previous 3 patches and
> establishes the global no-error for taut.-comp.
>
> Tested with gcc 6 and gcc 4.8 this time.
>
> Cheers - Michael
>

Reviewed-by: Amitay Isaacs <amitay at gmail.com>

This is definitely a better option.  You get the warnings, but does not
stop you from using --picky-developer.

Amitay.


More information about the samba-technical mailing list