On Mon, Jun 02, 2014 at 06:00:04PM -0400, Jason Merrill wrote:
On 05/24/2014 04:00 AM, Marek Polacek wrote:
+ /* Warn if the condition has boolean value. */
+ tree e = cond;
+ while (TREE_CODE (e) == COMPOUND_EXPR)
+e = TREE_OPERAND (e, 1);
+
+ if (TREE_CODE
On 06/03/2014 10:57 AM, Marek Polacek wrote:
+ if (TREE_CODE (orig_type) == BOOLEAN_TYPE
+ || (truth_value_p (TREE_CODE (cond))
+ TREE_CODE (orig_type) != INTEGER_TYPE))
I don't think you need the truth_value_p check, either, just the
BOOLEAN_TYPE check.
On Tue, Jun 03, 2014 at 11:46:35AM -0400, Jason Merrill wrote:
On 06/03/2014 10:57 AM, Marek Polacek wrote:
+ if (TREE_CODE (orig_type) == BOOLEAN_TYPE
+ || (truth_value_p (TREE_CODE (cond))
+ TREE_CODE (orig_type) != INTEGER_TYPE))
I don't think you need the
OK.
Jason
On 05/24/2014 04:00 AM, Marek Polacek wrote:
+ /* Warn if the condition has boolean value. */
+ tree e = cond;
+ while (TREE_CODE (e) == COMPOUND_EXPR)
+ e = TREE_OPERAND (e, 1);
+
+ if (TREE_CODE (orig_type) == BOOLEAN_TYPE
+ ||
On Thu, May 01, 2014 at 11:09:04PM -0600, Jeff Law wrote:
Looks reasonable, though I do wonder if we should be warning for this in the
C++ front-end as well?
Yep, I think so. Luckily the code for the C++ FE is pretty much the
same and, in fact, simpler.
Two issues came up:
1) I think there
On 04/18/14 05:50, Marek Polacek wrote:
On Fri, Apr 18, 2014 at 01:20:59PM +0200, Steven Bosscher wrote:
On Fri, Apr 18, 2014 at 7:30 AM, Marek Polacek wrote:
+ if (TREE_CODE (type) == BOOLEAN_TYPE
+ || exp_code == TRUTH_ANDIF_EXPR
+ || exp_code ==
On Fri, Apr 18, 2014 at 07:49:22AM +0200, Marc Glisse wrote:
On Fri, 18 Apr 2014, Marek Polacek wrote:
This patch implements a new warning that warns when controlling
expression of a switch has boolean value. (Intentionally I don't
warn if the controlling expression is (un)signed:1
On Fri, Apr 18, 2014 at 08:00:45AM +0200, Marek Polacek wrote:
On Fri, Apr 18, 2014 at 07:49:22AM +0200, Marc Glisse wrote:
On Fri, 18 Apr 2014, Marek Polacek wrote:
This patch implements a new warning that warns when controlling
expression of a switch has boolean value. (Intentionally
On Fri, Apr 18, 2014 at 07:49:22AM +0200, Marc Glisse wrote:
On Fri, 18 Apr 2014, Marek Polacek wrote:
This patch implements a new warning that warns when controlling
expression of a switch has boolean value. (Intentionally I don't
warn if the controlling expression is (un)signed:1
On Fri, Apr 18, 2014 at 7:30 AM, Marek Polacek wrote:
+ if (TREE_CODE (type) == BOOLEAN_TYPE
+ || exp_code == TRUTH_ANDIF_EXPR
+ || exp_code == TRUTH_AND_EXPR
+ || exp_code == TRUTH_ORIF_EXPR
+ || exp_code == TRUTH_OR_EXPR
+
On Fri, 18 Apr 2014, Steven Bosscher wrote:
On Fri, Apr 18, 2014 at 7:30 AM, Marek Polacek wrote:
+ if (TREE_CODE (type) == BOOLEAN_TYPE
+ || exp_code == TRUTH_ANDIF_EXPR
+ || exp_code == TRUTH_AND_EXPR
+ || exp_code == TRUTH_ORIF_EXPR
+
On Fri, Apr 18, 2014 at 01:20:59PM +0200, Steven Bosscher wrote:
On Fri, Apr 18, 2014 at 7:30 AM, Marek Polacek wrote:
+ if (TREE_CODE (type) == BOOLEAN_TYPE
+ || exp_code == TRUTH_ANDIF_EXPR
+ || exp_code == TRUTH_AND_EXPR
+ || exp_code ==
This patch implements a new warning that warns when controlling
expression of a switch has boolean value. (Intentionally I don't
warn if the controlling expression is (un)signed:1 bit-field.)
I guess the question is if this should be enabled by default or
deserves some new warning option. Since
On Fri, 18 Apr 2014, Marek Polacek wrote:
This patch implements a new warning that warns when controlling
expression of a switch has boolean value. (Intentionally I don't
warn if the controlling expression is (un)signed:1 bit-field.)
I guess the question is if this should be enabled by default
15 matches
Mail list logo