bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FYI: [PATCH] utimecmp: avoid new GCC 7 warning from -Wbool-operation


From: Jim Meyering
Subject: Re: FYI: [PATCH] utimecmp: avoid new GCC 7 warning from -Wbool-operation
Date: Wed, 5 Oct 2016 10:47:19 -0700

On Wed, Oct 5, 2016 at 9:51 AM, Paul Eggert <address@hidden> wrote:
> On 10/05/2016 09:17 AM, Jim Meyering wrote:
>>
>> * lib/utimecmp.c (utimecmp): Do not apply "~" to a boolean.
>
> Hah! And just Monday I was telling students how C operations like binary +,
> unary and binary -, and ~ can produce non-boolean outputs when given boolean
> inputs. That's a feature, not a bug.
>
> While I'm ranting, another thing that bothers me is that gcc -Wall doesn't
> know that == is both commutative and associative on booleans: it complains
> about "a==b==c" even when all arguments are boolean so that inserting
> parentheses cannot reduce ambiguity. It's times like this that I think GCC's
> '-Wall' option should really be called '-Wnanny'.

I agree. I did not like to dirty utimecmp.c with that patch, but it seemed
better than disabling the warning altogether. If you'd prefer, we an do
the #pragma push/disable-warning/pop dance around that code, but
that seems like overkill.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]