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 == TRUTH_AND_EXPR
+ || exp_code == TRUTH_ORIF_EXPR
+ || exp_code == TRUTH_OR_EXPR
+ || exp_code == TRUTH_XOR_EXPR
+ || exp_code == TRUTH_NOT_EXPR
+ || exp_code == EQ_EXPR
+ || exp_code == NE_EXPR
+ || exp_code == LE_EXPR
+ || exp_code == GE_EXPR
+ || exp_code == LT_EXPR
+ || exp_code == GT_EXPR)
Is there a TREE_CODE_CLASS or a #define for this?
Good question. I was looking for something nicer and found nothing,
no T_C_C or #define.
But now when I'm looking again, I found truth_value_p... Thanks.
2014-04-18 Marek Polacek <pola...@redhat.com>
PR c/60439
* doc/invoke.texi: Document -Wswitch-bool.
c/
* c-typeck.c (c_start_case): Warn if switch condition has boolean
value.
c-family/
* c.opt (Wswitch-bool): New option.
testsuite/
* gcc.dg/pr60439.c: New test.
Looks reasonable, though I do wonder if we should be warning for this in
the C++ front-end as well?
jeff