On Wed, Oct 5, 2016 at 9:51 AM, Paul Eggert <egg...@cs.ucla.edu> 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.