On 10/05/2016 10:47 AM, Jim Meyering wrote:
we can do the #pragma push/disable-warning/pop dance around that code, but that seems like overkill.
Agreed, it's overkill. Also, I was tempted to suggest -1-x instead of ~(x?1:0) but that assumes two's complement. So let's just leave it alone. At least GCC is smart enough to optimize it as if it were ~x.
I filed a GCC bug report here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77876 I hope they fix it one way or another.