This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/70065] Split -Wparentheses warnings about operators priority into a separate warning flag, -Wprecedence
- From: "egallager at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 28 Sep 2017 15:30:15 +0000
- Subject: [Bug c++/70065] Split -Wparentheses warnings about operators priority into a separate warning flag, -Wprecedence
- Auto-submitted: auto-generated
- References: <bug-70065-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70065
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-09-28
CC| |egallager at gcc dot gnu.org
Summary|Add a new option to |Split -Wparentheses
|suppress a warnings about |warnings about operators
|operators priority |priority into a separate
| |warning flag, -Wprecedence
Ever confirmed|0 |1
--- Comment #9 from Eric Gallager <egallager at gcc dot gnu.org> ---
My old version of clang puts this under -Wlogical-op-parentheses:
$ cat 70065.cc
bool a, b, c;
// Something...
int main()
{
if (a && b || c)
{
// Do something...
}
}
$ /usr/local/bin/g++ -c -Wall -Wextra -pedantic 70065.cc
70065.cc: In function ‘int main()’:
70065.cc:6:8: warning: suggest parentheses around ‘&&’ within ‘||’
[-Wparentheses]
if (a && b || c)
~~^~~~
$ /sw/opt/llvm-3.1/bin/clang -c -Wall -Wextra -pedantic 70065.cc
70065.cc:6:8: warning: '&&' within '||' [-Wlogical-op-parentheses]
if (a && b || c)
~~^~~~ ~~
70065.cc:6:8: note: place parentheses around the '&&' expression to silence
this warning
if (a && b || c)
^
( )
1 warning generated.
$
So confirming that another compiler has another name for it, regardless of
bikeshedding about the specific name to give it.