public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Enable -Wlogical-not-parentheses by -Wall
@ 2014-09-02 15:53 Marek Polacek
  2014-09-03 18:53 ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Polacek @ 2014-09-02 15:53 UTC (permalink / raw)
  To: GCC Patches

Now that PR61271 and PR62270 have been fixed, we can enable
-Wlogical-not-parentheses by -Wall.  I think this warning proved
useful.

Bootstrapped/regtested on x86_64-linux and ppc64-linux, ok for trunk?

2014-08-26  Marek Polacek  <polacek@redhat.com>

	* doc/invoke.texi: Document that -Wlogical-not-parentheses is enabled
	by -Wall.
c-family/
	* c.opt (Wlogical-not-parentheses): Enable by -Wall.

diff --git gcc/c-family/c.opt gcc/c-family/c.opt
index 210a099..643f256 100644
--- gcc/c-family/c.opt
+++ gcc/c-family/c.opt
@@ -519,7 +519,7 @@ C ObjC C++ ObjC++ Var(warn_logical_op) Init(0) Warning
 Warn when a logical operator is suspiciously always evaluating to true or false
 
 Wlogical-not-parentheses
-C ObjC C++ ObjC++ Var(warn_logical_not_paren) Warning
+C ObjC C++ ObjC++ Var(warn_logical_not_paren) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
 Warn when logical not is used on the left hand side operand of a comparison
 
 Wlong-long
diff --git gcc/doc/invoke.texi gcc/doc/invoke.texi
index d15d4a9..9864708 100644
--- gcc/doc/invoke.texi
+++ gcc/doc/invoke.texi
@@ -4800,6 +4800,8 @@ parentheses:
 if ((!a) > 1) @{ @dots{} @}
 @end smallexample
 
+This warning is enabled by @option{-Wall}.
+
 @item -Waggregate-return
 @opindex Waggregate-return
 @opindex Wno-aggregate-return

	Marek

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Enable -Wlogical-not-parentheses by -Wall
  2014-09-02 15:53 [PATCH] Enable -Wlogical-not-parentheses by -Wall Marek Polacek
@ 2014-09-03 18:53 ` Jeff Law
  2014-09-03 19:40   ` Marek Polacek
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2014-09-03 18:53 UTC (permalink / raw)
  To: Marek Polacek, GCC Patches

On 09/02/14 09:53, Marek Polacek wrote:
> Now that PR61271 and PR62270 have been fixed, we can enable
> -Wlogical-not-parentheses by -Wall.  I think this warning proved
> useful.
>
> Bootstrapped/regtested on x86_64-linux and ppc64-linux, ok for trunk?
>
> 2014-08-26  Marek Polacek  <polacek@redhat.com>
>
> 	* doc/invoke.texi: Document that -Wlogical-not-parentheses is enabled
> 	by -Wall.
> c-family/
> 	* c.opt (Wlogical-not-parentheses): Enable by -Wall.
OK.  I'm sure this is going to trip in someone's code and they'll 
complain.  But I've always stated that warnings, particularly from 
-Wall, are not consistent from release to release.  Thus someone using 
-Wall has to be prepared to fix their code at each release because we 
can and will add things to -Wall over time.

jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Enable -Wlogical-not-parentheses by -Wall
  2014-09-03 18:53 ` Jeff Law
@ 2014-09-03 19:40   ` Marek Polacek
  0 siblings, 0 replies; 3+ messages in thread
From: Marek Polacek @ 2014-09-03 19:40 UTC (permalink / raw)
  To: Jeff Law; +Cc: GCC Patches

On Wed, Sep 03, 2014 at 12:53:21PM -0600, Jeff Law wrote:
> On 09/02/14 09:53, Marek Polacek wrote:
> >Now that PR61271 and PR62270 have been fixed, we can enable
> >-Wlogical-not-parentheses by -Wall.  I think this warning proved
> >useful.
> >
> >Bootstrapped/regtested on x86_64-linux and ppc64-linux, ok for trunk?
> >
> >2014-08-26  Marek Polacek  <polacek@redhat.com>
> >
> >	* doc/invoke.texi: Document that -Wlogical-not-parentheses is enabled
> >	by -Wall.
> >c-family/
> >	* c.opt (Wlogical-not-parentheses): Enable by -Wall.
> OK.  I'm sure this is going to trip in someone's code and they'll complain.
> But I've always stated that warnings, particularly from -Wall, are not
> consistent from release to release.  Thus someone using -Wall has to be
> prepared to fix their code at each release because we can and will add
> things to -Wall over time.

Yeah.  Fortunately the warning shouldn't have (m)any false positives.

	Marek

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-03 19:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-02 15:53 [PATCH] Enable -Wlogical-not-parentheses by -Wall Marek Polacek
2014-09-03 18:53 ` Jeff Law
2014-09-03 19:40   ` Marek Polacek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).