[Bug c++/70065] Add a new option to suppress a warnings about operators priority

manu at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Mar 4 19:39:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70065

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #8 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Marc Glisse from comment #7)
> part of the code (it might be a small optimization in this case, but
> redundancy tends to cause trouble eventually).

Also, it is just visual clutter. I don't think the performance implications are
even measurable in this case. (If one is worried about performance, there are
bigger fishes to catch).

Even if they were, one would simply add at the top of the function:

if (!warn_parentheses || !warn_precedence)
    return;


> By the way, it would also be good to survey what other compilers (clang,
> maybe Intel) do here. If some already split -Wparentheses into several -W
> flags, picking consistent names would be helpful.

And it would be an argument in favour of splitting it. Too many flags is not
ideal either.

> Oh, and of course you need to add a test or two in
> gcc/testsuite/c-c++-common.

Probably just update the flag used in existing tests for -Wparentheses (finding
which ones could be done by running the testsuite with a version of the patch
that does not enable the new -Wprecedence with -Wparentheses).

The patch also changes whitespace (tabs?). Please verify that the diff only
shows the relevant lines. See also:
https://gcc.gnu.org/wiki/GettingStarted#Basics:_Contributing_to_GCC_in_10_easy_steps


More information about the Gcc-bugs mailing list