Re: [PATCH] Add a warning for suspicious use of conditional expressions in boolean context

2016-09-12 Thread Bernd Edlinger
On 09/12/16 22:08, Jeff Law wrote: > On 09/12/2016 02:00 PM, Bernd Edlinger wrote: > >> Yes, I will update the patch accordingly. >> >> I agree, a statement like "if (x ? 0 : 2)" can be called suspicious as >> well, even if the result of x is not ignored as in "if (x ? 1 : 2)". >> >> After I posted

Re: [PATCH] Add a warning for suspicious use of conditional expressions in boolean context

2016-09-12 Thread Jeff Law
On 09/12/2016 02:00 PM, Bernd Edlinger wrote: Yes, I will update the patch accordingly. I agree, a statement like "if (x ? 0 : 2)" can be called suspicious as well, even if the result of x is not ignored as in "if (x ? 1 : 2)". After I posted this patch, I extended the patch to cover also susp

Re: [PATCH] Add a warning for suspicious use of conditional expressions in boolean context

2016-09-12 Thread Bernd Edlinger
On 09/12/16 21:30, Jeff Law wrote: > On 09/02/2016 12:53 PM, Bernd Edlinger wrote: >> Hi! >> >> As reported in PR77434 and PR77421 there should be a warning for >> suspicious uses of conditional expressions with non-boolean arguments. >> >> This warning triggers on conditional expressions in boolea

Re: [PATCH] Add a warning for suspicious use of conditional expressions in boolean context

2016-09-12 Thread Jeff Law
On 09/02/2016 12:53 PM, Bernd Edlinger wrote: Hi! As reported in PR77434 and PR77421 there should be a warning for suspicious uses of conditional expressions with non-boolean arguments. This warning triggers on conditional expressions in boolean context, when both possible results are non-zero

[PATCH] Add a warning for suspicious use of conditional expressions in boolean context

2016-09-02 Thread Bernd Edlinger
Hi! As reported in PR77434 and PR77421 there should be a warning for suspicious uses of conditional expressions with non-boolean arguments. This warning triggers on conditional expressions in boolean context, when both possible results are non-zero integer constants, so that the resulting truth v