Re: Add fixit hint for -Wlogical-not-parentheses

2016-08-29 Thread David Malcolm
On Mon, 2016-08-29 at 13:44 +0200, Marek Polacek wrote: > On Mon, Aug 29, 2016 at 12:35:38PM +0200, Marek Polacek wrote: > > On Mon, Aug 29, 2016 at 11:16:25AM +0200, Andreas Schwab wrote: > > > On Aug 25 2016, Marek Polacek wrote: > > > > > > > *

Re: Add fixit hint for -Wlogical-not-parentheses

2016-08-29 Thread Marek Polacek
On Mon, Aug 29, 2016 at 12:35:38PM +0200, Marek Polacek wrote: > On Mon, Aug 29, 2016 at 11:16:25AM +0200, Andreas Schwab wrote: > > On Aug 25 2016, Marek Polacek wrote: > > > > > * c-c++-common/Wlogical-not-parentheses-2.c: New test. > > > > FAIL:

Re: Add fixit hint for -Wlogical-not-parentheses

2016-08-29 Thread Marek Polacek
On Mon, Aug 29, 2016 at 11:16:25AM +0200, Andreas Schwab wrote: > On Aug 25 2016, Marek Polacek wrote: > > > * c-c++-common/Wlogical-not-parentheses-2.c: New test. > > FAIL: c-c++-common/Wlogical-not-parentheses-2.c -std=gnu++11 expected > multiline pattern lines

Re: Add fixit hint for -Wlogical-not-parentheses

2016-08-29 Thread Andreas Schwab
On Aug 25 2016, Marek Polacek wrote: > * c-c++-common/Wlogical-not-parentheses-2.c: New test. FAIL: c-c++-common/Wlogical-not-parentheses-2.c -std=gnu++11 expected multiline pattern lines 13-17 not found: "\s*r \+= !aaa == bbb;.*\n \^~\n r \+= !aaa ==

Re: Add fixit hint for -Wlogical-not-parentheses

2016-08-25 Thread Marek Polacek
On Thu, Aug 25, 2016 at 08:40:20AM -0400, David Malcolm wrote: > Looks good to me, based on the above discussion. I'll try to add the > shared fixit validation code today. Thanks. Let me know if I can be of any help with that. Marek

Re: Add fixit hint for -Wlogical-not-parentheses

2016-08-25 Thread David Malcolm
On Thu, 2016-08-25 at 10:16 +0200, Marek Polacek wrote: > On Wed, Aug 24, 2016 at 04:03:10PM -0400, David Malcolm wrote: > > I was thinking about maybe: > > rich_location::add_fixit_insert_after_caret (source_location loc) > > which would add it immediately after the *caret* location of loc - >

Re: Add fixit hint for -Wlogical-not-parentheses

2016-08-25 Thread Marek Polacek
On Wed, Aug 24, 2016 at 04:03:10PM -0400, David Malcolm wrote: > I was thinking about maybe: > rich_location::add_fixit_insert_after_caret (source_location loc) > which would add it immediately after the *caret* location of loc - as > opposed to after the *finish* location of loc, or maybe just:

Re: Add fixit hint for -Wlogical-not-parentheses

2016-08-24 Thread David Malcolm
On Wed, 2016-08-24 at 21:50 +0200, Marek Polacek wrote: > On Wed, Aug 24, 2016 at 02:59:43PM -0400, David Malcolm wrote: > > On Wed, 2016-08-24 at 20:15 +0200, Marek Polacek wrote: > > > On Wed, Aug 24, 2016 at 01:57:15PM -0400, David Malcolm wrote: > > > > On Wed, 2016-08-24 at 19:43 +0200, Marek

Re: Add fixit hint for -Wlogical-not-parentheses

2016-08-24 Thread Marek Polacek
On Wed, Aug 24, 2016 at 02:59:43PM -0400, David Malcolm wrote: > On Wed, 2016-08-24 at 20:15 +0200, Marek Polacek wrote: > > On Wed, Aug 24, 2016 at 01:57:15PM -0400, David Malcolm wrote: > > > On Wed, 2016-08-24 at 19:43 +0200, Marek Polacek wrote: > > > > This patch adds a fixit hint to

Re: Add fixit hint for -Wlogical-not-parentheses

2016-08-24 Thread David Malcolm
On Wed, 2016-08-24 at 20:15 +0200, Marek Polacek wrote: > On Wed, Aug 24, 2016 at 01:57:15PM -0400, David Malcolm wrote: > > On Wed, 2016-08-24 at 19:43 +0200, Marek Polacek wrote: > > > This patch adds a fixit hint to -Wlogical-not-parentheses. When > > > the > > > LHS > > > has a location, it

Re: Add fixit hint for -Wlogical-not-parentheses

2016-08-24 Thread Marek Polacek
On Wed, Aug 24, 2016 at 01:57:15PM -0400, David Malcolm wrote: > On Wed, 2016-08-24 at 19:43 +0200, Marek Polacek wrote: > > This patch adds a fixit hint to -Wlogical-not-parentheses. When the > > LHS > > has a location, it prints: > > > > z.c: In function ‘int foo(int, int)’: > > z.c:12:11:

Re: Add fixit hint for -Wlogical-not-parentheses

2016-08-24 Thread David Malcolm
On Wed, 2016-08-24 at 19:43 +0200, Marek Polacek wrote: > This patch adds a fixit hint to -Wlogical-not-parentheses. When the > LHS > has a location, it prints: > > z.c: In function ‘int foo(int, int)’: > z.c:12:11: warning: logical not is only applied to the left hand side > of comparison

Add fixit hint for -Wlogical-not-parentheses

2016-08-24 Thread Marek Polacek
This patch adds a fixit hint to -Wlogical-not-parentheses. When the LHS has a location, it prints: z.c: In function ‘int foo(int, int)’: z.c:12:11: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses] r += !a == b; ^~ z.c:12:8: note: