Re: [C/C++ PATCH] -Wlogical-not-parentheses tweaks (PR c/65120)

2015-03-09 Thread Jason Merrill
On 03/09/2015 10:34 AM, Jakub Jelinek wrote: On Fri, Feb 27, 2015 at 05:29:47PM -0500, Jason Merrill wrote: On 02/19/2015 07:03 PM, Jakub Jelinek wrote: + /* Avoid warning for !!b == y where b is boolean. */ + && (!DECL_P (current.lhs) + || TREE_TYPE (current.lhs) =

Re: [C/C++ PATCH] -Wlogical-not-parentheses tweaks (PR c/65120)

2015-03-09 Thread Jakub Jelinek
On Fri, Feb 27, 2015 at 05:29:47PM -0500, Jason Merrill wrote: > On 02/19/2015 07:03 PM, Jakub Jelinek wrote: > >+ /* Avoid warning for !!b == y where b is boolean. */ > >+ && (!DECL_P (current.lhs) > >+ || TREE_TYPE (current.lhs) == NULL_TREE > >+ || TREE_CODE (TREE_TY

Re: [C/C++ PATCH] -Wlogical-not-parentheses tweaks (PR c/65120)

2015-02-27 Thread Jason Merrill
On 02/19/2015 07:03 PM, Jakub Jelinek wrote: + /* Avoid warning for !!b == y where b is boolean. */ + && (!DECL_P (current.lhs) + || TREE_TYPE (current.lhs) == NULL_TREE + || TREE_CODE (TREE_TYPE (current.lhs)) != BOOLEAN_TYPE)) There's something wrong h

Re: [C/C++ PATCH] -Wlogical-not-parentheses tweaks (PR c/65120)

2015-02-20 Thread Jakub Jelinek
On Fri, Feb 20, 2015 at 04:35:05PM +0100, Marek Polacek wrote: > Note that first version of -Wlogical-not-parentheses didn't warn > when LHS had a boolean type, this has been changed later on. I have > no strong preference either way. > > > As the argument is already folded, it isn't easy to dete

Re: [C/C++ PATCH] -Wlogical-not-parentheses tweaks (PR c/65120)

2015-02-20 Thread Marek Polacek
On Fri, Feb 20, 2015 at 01:03:26AM +0100, Jakub Jelinek wrote: > Hi! > > As reported, !!x == y is quite common in the Linux kernel > and unlike the !x == y case it usually doesn't mean mistyped > !(x == y) or x != y. clang++ apparently doesn't warn about that > either, and it doesn't warn even ab

[C/C++ PATCH] -Wlogical-not-parentheses tweaks (PR c/65120)

2015-02-19 Thread Jakub Jelinek
Hi! As reported, !!x == y is quite common in the Linux kernel and unlike the !x == y case it usually doesn't mean mistyped !(x == y) or x != y. clang++ apparently doesn't warn about that either, and it doesn't warn even about the case where ! is applied to a bool. As the argument is already fold