This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Disabling warning: suggest parentheses around && within ||
Andre Majorel <aym-ccg@teaser.fr> writes:
> On 2009-05-13 04:40 -0700, John (Eljay) Love-Jensen wrote:
>
>> > Meaning that it does. Some of those warnings are actually useful.
>>
>> If you want to remove "warning: suggest parentheses around &&
>> within ||" and keep any other "warning: suggest parentheses
>> around FOO within BAR" warnings, you can use grep -v -e to post
>> process the output.
>
> Which will only work in one locale. If GCC messages ever
> acquire unique identifiers, it will be a welcome evolution.
You can use -fdiagnostics-show-option to see which command line option
controls a particular warning. You can use that as a locale-independent
identifier for this purpose.
> Until then, the warnings are annoying but probably not annoying
> enough for me to go to the trouble of making my makefiles so
> GCC-specific.
I've seen this specific warning, about the precedence of && and ||,
catch a surprising number of real errors in real code. However, since
some people know the precedence of && and || just as well as they know
the precedence of + and *, I would be sympathetic to breaking them out
into a separate -Wparentheses-and-or warning. Please feel free to file
that as an enhancement request at http://gcc.gnu.org/bugzilla .
Ian