diff options
author | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2008-10-24 10:09:06 +0000 |
---|---|---|
committer | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2008-10-24 10:09:06 +0000 |
commit | 100d537d7a7b5c0ef775d568ce3eefffa72f2c41 (patch) | |
tree | 700b750bc17a07e7749365330c49e0f595aaa435 /gcc/fold-const.c | |
parent | 950d63e12fd0a69731a4c1ae313135f2d47d30a9 (diff) | |
download | gcc-100d537d7a7b5c0ef775d568ce3eefffa72f2c41.zip gcc-100d537d7a7b5c0ef775d568ce3eefffa72f2c41.tar.gz gcc-100d537d7a7b5c0ef775d568ce3eefffa72f2c41.tar.bz2 |
re PR c/7543 (no warning for always-false "if (!a & 0x4)" bitwise and on boolean value)
2008-10-24 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c/7543
* value-prof.c (gimple_stringop_fixed_value): Use parentheses
around bit operation.
* profile.c (is_edge_inconsistent): Likewise.
* fold-const.c (truth_value_p): Move from here...
* tree.h (truth_value_p): ... to here.
* c-tree.h (c_expr): Update description of original_code.
* c-typeck.c (parser_build_unary_op): Set original_code.
(parser_build_binary_op): Update call to warn_about_parentheses.
* c-common.c (warn_about_parentheses): Take two additional
arguments of the operands. Use a switch. Quote operators
appropriately. Define macro APPEARS_TO_BE_BOOLEAN_EXPR_P.
Add warning about !x | y and !x & y.
* c-common.h (warn_about_parentheses): Update declaration.
cp/
* typeck.c (build_x_binary_op): Update call to
warn_about_parentheses.
* parser.c (cp_parser_binary_expression): Add note about passing
the correct code for unary expressions.
testsuite/
* gcc.dg/Wparentheses-11.c: New.
* g++.dg/warn/Wparentheses-25.C: New. XFAILED.
From-SVN: r141340
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 88e70d6..1eac946 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -105,7 +105,6 @@ static enum comparison_code comparison_to_compcode (enum tree_code); static enum tree_code compcode_to_comparison (enum comparison_code); static tree combine_comparisons (enum tree_code, enum tree_code, enum tree_code, tree, tree, tree); -static int truth_value_p (enum tree_code); static int operand_equal_for_comparison_p (tree, tree, tree); static int twoval_comparison_p (tree, tree *, tree *, int *); static tree eval_subst (tree, tree, tree, tree, tree); @@ -2981,17 +2980,6 @@ combine_comparisons (enum tree_code code, enum tree_code lcode, return fold_build2 (compcode_to_comparison (compcode), truth_type, ll_arg, lr_arg); } - -/* Return nonzero if CODE is a tree code that represents a truth value. */ - -static int -truth_value_p (enum tree_code code) -{ - return (TREE_CODE_CLASS (code) == tcc_comparison - || code == TRUTH_AND_EXPR || code == TRUTH_ANDIF_EXPR - || code == TRUTH_OR_EXPR || code == TRUTH_ORIF_EXPR - || code == TRUTH_XOR_EXPR || code == TRUTH_NOT_EXPR); -} /* Return nonzero if two operands (typically of the same tree node) are necessarily equal. If either argument has side-effects this |