diff options
author | mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-08-22 19:44:27 +0000 |
---|---|---|
committer | mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-08-22 19:44:27 +0000 |
commit | dc6229e8136143d84807a878908949c97b617bf2 (patch) | |
tree | 172770434748d3c011b458569b6b2790b8b20842 /gcc | |
parent | 47ed88a3b306762b293ff8f9407453a6dc166207 (diff) | |
download | gcc-dc6229e8136143d84807a878908949c97b617bf2.tar.gz |
PR c++/62199
* doc/invoke.texi: Update -Wlogical-not-parentheses description.
c-family/
* c-common.c (warn_logical_not_parentheses): Don't check LHS. Don't
check for vector types. Drop LHS argument.
* c-common.h (warn_logical_not_parentheses): Adjust.
c/
* c-typeck.c (parser_build_binary_op): Adjust call to
warn_logical_not_parentheses.
cp/
* parser.c (cp_parser_binary_expression): Check each LHS if it's
preceded with logical not. Adjust call to
warn_logical_not_parentheses.
testsuite/
* c-c++-common/pr62199.c: New test.
* c-c++-common/pr62199-2.c: New test.
* g++.dg/warn/Wparentheses-25.C: Drop XFAILs.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214360 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c-family/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-family/c-common.c | 16 | ||||
-rw-r--r-- | gcc/c-family/c-common.h | 3 | ||||
-rw-r--r-- | gcc/c/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 2 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/parser.c | 13 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/pr62199-2.c | 20 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/pr62199.c | 22 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/warn/Wparentheses-25.C | 110 |
13 files changed, 144 insertions, 78 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2b78565a070..caa40b37f2f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2014-08-22 Marek Polacek <polacek@redhat.com> + PR c++/62199 + * doc/invoke.texi: Update -Wlogical-not-parentheses description. + +2014-08-22 Marek Polacek <polacek@redhat.com> + PR c/61271 * ira-color.c (coalesced_pseudo_reg_slot_compare): Wrap LHS of a comparison in parens. diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 3bc50ef2526..4042306398d 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,10 @@ +2014-08-22 Marek Polacek <polacek@redhat.com> + + PR c++/62199 + * c-common.c (warn_logical_not_parentheses): Don't check LHS. Don't + check for vector types. Drop LHS argument. + * c-common.h (warn_logical_not_parentheses): Adjust. + 2014-08-22 Manuel López-Ibáñez <manu@gcc.gnu.org> * c.opt (Wcomment): Use CPP, Var and LangEnabledBy. diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index c5eb2a773e6..58b976378d5 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -1727,21 +1727,15 @@ warn_logical_operator (location_t location, enum tree_code code, tree type, /* Warn about logical not used on the left hand side operand of a comparison. This function assumes that the LHS is inside of TRUTH_NOT_EXPR. - Do not warn if the LHS or RHS is of a boolean or a vector type. */ + Do not warn if RHS is of a boolean type. */ void warn_logical_not_parentheses (location_t location, enum tree_code code, - tree lhs, tree rhs) + tree rhs) { - if (TREE_CODE_CLASS (code) != tcc_comparison) - return; - if (TREE_TYPE (lhs) == NULL_TREE - || TREE_TYPE (rhs) == NULL_TREE) - ; - else if (TREE_CODE (TREE_TYPE (lhs)) == BOOLEAN_TYPE - || TREE_CODE (TREE_TYPE (rhs)) == BOOLEAN_TYPE - || VECTOR_TYPE_P (TREE_TYPE (lhs)) - || VECTOR_TYPE_P (TREE_TYPE (rhs))) + if (TREE_CODE_CLASS (code) != tcc_comparison + || TREE_TYPE (rhs) == NULL_TREE + || TREE_CODE (TREE_TYPE (rhs)) == BOOLEAN_TYPE) return; warning_at (location, OPT_Wlogical_not_parentheses, diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index 995bc8ca50e..20b65e99663 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -780,8 +780,7 @@ extern void overflow_warning (location_t, tree); extern bool warn_if_unused_value (const_tree, location_t); extern void warn_logical_operator (location_t, enum tree_code, tree, enum tree_code, tree, enum tree_code, tree); -extern void warn_logical_not_parentheses (location_t, enum tree_code, tree, - tree); +extern void warn_logical_not_parentheses (location_t, enum tree_code, tree); extern void check_main_parameter_types (tree decl); extern bool c_determine_visibility (tree); extern bool vector_types_compatible_elements_p (tree, tree); diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 77bc05bbcca..00fb275613e 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2014-08-22 Marek Polacek <polacek@redhat.com> + + PR c++/62199 + * c-typeck.c (parser_build_binary_op): Adjust call to + warn_logical_not_parentheses. + 2014-08-22 Igor Zamyatin <igor.zamyatin@intel.com> PR other/62008 diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index d6d96cf3550..a7de8f3c734 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -3414,7 +3414,7 @@ parser_build_binary_op (location_t location, enum tree_code code, if (warn_logical_not_paren && code1 == TRUTH_NOT_EXPR && code2 != TRUTH_NOT_EXPR) - warn_logical_not_parentheses (location, code, arg1.value, arg2.value); + warn_logical_not_parentheses (location, code, arg2.value); /* Warn about comparisons against string literals, with the exception of testing for equality or inequality of a string literal with NULL. */ diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2ea26653901..b71dcba151f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2014-08-22 Marek Polacek <polacek@redhat.com> + + PR c++/62199 + * parser.c (cp_parser_binary_expression): Check each LHS if it's + preceded with logical not. Adjust call to + warn_logical_not_parentheses. + 2014-08-22 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/57709 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 9053bfa62e5..4dc7c33cb33 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -8020,13 +8020,12 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p, enum tree_code rhs_type; enum cp_parser_prec new_prec, lookahead_prec; tree overload; - bool parenthesized_not_lhs_warn - = cp_lexer_next_token_is (parser->lexer, CPP_NOT); /* Parse the first expression. */ + current.lhs_type = (cp_lexer_next_token_is (parser->lexer, CPP_NOT) + ? TRUTH_NOT_EXPR : ERROR_MARK); current.lhs = cp_parser_cast_expression (parser, /*address_p=*/false, cast_p, decltype_p, pidk); - current.lhs_type = ERROR_MARK; current.prec = prec; if (cp_parser_error_occurred (parser)) @@ -8081,8 +8080,9 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p, /* Extract another operand. It may be the RHS of this expression or the LHS of a new, higher priority expression. */ + rhs_type = (cp_lexer_next_token_is (parser->lexer, CPP_NOT) + ? TRUTH_NOT_EXPR : ERROR_MARK); rhs = cp_parser_simple_cast_expression (parser); - rhs_type = ERROR_MARK; /* Get another operator token. Look up its precedence to avoid building a useless (immediately popped) stack entry for common @@ -8125,9 +8125,8 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p, c_inhibit_evaluation_warnings -= current.lhs == truthvalue_true_node; if (warn_logical_not_paren - && parenthesized_not_lhs_warn) - warn_logical_not_parentheses (current.loc, current.tree_type, - TREE_OPERAND (current.lhs, 0), rhs); + && current.lhs_type == TRUTH_NOT_EXPR) + warn_logical_not_parentheses (current.loc, current.tree_type, rhs); overload = NULL; /* ??? Currently we pass lhs_type == ERROR_MARK and rhs_type == diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index f8499bc046a..dda8e91250c 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -4776,8 +4776,8 @@ bit-wise operator is likely to be expected. @opindex Wlogical-not-parentheses @opindex Wno-logical-not-parentheses Warn about logical not used on the left hand side operand of a comparison. -This option does not warn if the LHS or RHS operand is of a boolean or -a vector type. Its purpose is to detect suspicious code like the following: +This option does not warn if the RHS operand is of a boolean type. Its +purpose is to detect suspicious code like the following: @smallexample int a; @dots{} diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ce3e30e3572..9f40c35c159 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2014-08-22 Marek Polacek <polacek@redhat.com> + + PR c++/62199 + * c-c++-common/pr62199.c: New test. + * c-c++-common/pr62199-2.c: New test. + * g++.dg/warn/Wparentheses-25.C: Drop XFAILs. + 2014-08-22 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c++/57709 diff --git a/gcc/testsuite/c-c++-common/pr62199-2.c b/gcc/testsuite/c-c++-common/pr62199-2.c new file mode 100644 index 00000000000..7647f16042b --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr62199-2.c @@ -0,0 +1,20 @@ +/* PR c++/62199 */ +/* { dg-do compile } */ +/* { dg-options "-Wlogical-not-parentheses" } */ + +#ifndef __cplusplus +# define bool _Bool +#endif + +bool r; + +void +foo (bool b) +{ + r = !b == 1; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */ + r = !b != 1; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */ + r = !b > 1; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */ + r = !b >= 1; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */ + r = !b < 1; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */ + r = !b <= 1; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */ +} diff --git a/gcc/testsuite/c-c++-common/pr62199.c b/gcc/testsuite/c-c++-common/pr62199.c new file mode 100644 index 00000000000..51078c8403f --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr62199.c @@ -0,0 +1,22 @@ +/* PR c++/62199 */ +/* { dg-do compile } */ +/* { dg-options "-Wlogical-not-parentheses" } */ + +int r; +void +foo (int a) +{ + r = a > 0 || !a >= 2; /* { dg-warning "19:logical not is only applied to the left hand side of comparison" } */ + r = !a || a == 10; + r = !a && !a < 4; /* { dg-warning "16:logical not is only applied to the left hand side of comparison" } */ + r = !a > 0 && a < 6; /* { dg-warning "10:logical not is only applied to the left hand side of comparison" } */ + r = a + (!a < 12); /* { dg-warning "15:logical not is only applied to the left hand side of comparison" } */ + r = a == 7 || !a < 12; /* { dg-warning "20:logical not is only applied to the left hand side of comparison" } */ + r = (a == 7 * a > 0) || !a < 2; /* { dg-warning "30:logical not is only applied to the left hand side of comparison" } */ + r = (1 > !a) || (!42 > a); /* { dg-warning "24:logical not is only applied to the left hand side of comparison" } */ + r = (!5 > a); /* { dg-warning "11:logical not is only applied to the left hand side of comparison" } */ + r = (!0 > a); /* { dg-warning "11:logical not is only applied to the left hand side of comparison" } */ + r = (!-5 > a); /* { dg-warning "12:logical not is only applied to the left hand side of comparison" } */ + r = (!(5 + 3) > a); /* { dg-warning "17:logical not is only applied to the left hand side of comparison" } */ + r = (!(5 - a) > a); /* { dg-warning "17:logical not is only applied to the left hand side of comparison" } */ +} diff --git a/gcc/testsuite/g++.dg/warn/Wparentheses-25.C b/gcc/testsuite/g++.dg/warn/Wparentheses-25.C index ab00c25f02a..d9951a4f46b 100644 --- a/gcc/testsuite/g++.dg/warn/Wparentheses-25.C +++ b/gcc/testsuite/g++.dg/warn/Wparentheses-25.C @@ -8,7 +8,7 @@ int foo (int); int bar (int a, int b, int c) { - foo (!a & b); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ + foo (!a & b); /* { dg-warning "parentheses" "correct warning" } */ foo (!a & (b < c)); foo (!a & (b > c)); foo (!a & (b == c)); @@ -20,7 +20,7 @@ bar (int a, int b, int c) foo (!a & !b); foo (!(a & b)); foo ((!a) & b); - foo (!a & 2); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ + foo (!a & 2); /* { dg-warning "parentheses" "correct warning" } */ foo (!a & (2 < c)); foo (!a & (2 > c)); foo (!a & (2 == c)); @@ -32,7 +32,7 @@ bar (int a, int b, int c) foo (!a & !2); foo (!(a & 2)); foo ((!a) & 2); - foo (!1 & 2); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ + foo (!1 & 2); /* { dg-warning "parentheses" "correct warning" } */ foo (!1 & (2 < c)); foo (!1 & (2 > c)); foo (!1 & (2 == c)); @@ -44,7 +44,7 @@ bar (int a, int b, int c) foo (!1 & !2); foo (!(1 & 2)); - foo (!a | b); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ + foo (!a | b); /* { dg-warning "parentheses" "correct warning" } */ foo (!a | (b < c)); foo (!a | (b > c)); foo (!a | (b == c)); @@ -56,7 +56,7 @@ bar (int a, int b, int c) foo (!a | !b); foo (!(a | b)); foo ((!a) | b); - foo (!a | 2); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ + foo (!a | 2); /* { dg-warning "parentheses" "correct warning" } */ foo (!a | (2 < c)); foo (!a | (2 > c)); foo (!a | (2 == c)); @@ -68,7 +68,7 @@ bar (int a, int b, int c) foo (!a | !2); foo (!(a | 2)); foo ((!a) | 2); - foo (!1 | 2); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ + foo (!1 | 2); /* { dg-warning "parentheses" "correct warning" } */ foo (!1 | (2 < c)); foo (!1 | (2 > c)); foo (!1 | (2 == c)); @@ -159,55 +159,55 @@ bar (int a, int b, int c) int baz (int a, int b, int c) { - foo (!a & (b << c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a & (b >> c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a & (b + c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a & (b - c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a & (b = c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a & ~b); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a & (b & c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a & (b | c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a & 2); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a & (2 << c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a & (2 >> c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a & (2 + c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a & (2 - c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a & (c = 2)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a & ~2); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a & (2 & c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a & (2 | c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!1 & (2 << c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!1 & (2 >> c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!1 & (2 + c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!1 & (2 - c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!1 & (c = 2)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!1 & ~2); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!1 & (2 & c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!1 & (2 | c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a | (b << c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a | (b >> c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a | (b + c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a | (b - c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a | (b = c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a | ~b); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a | (b & c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a | (b | c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a | (2 << c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a | (2 >> c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a | (2 + c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a | (2 - c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a | (c = 2)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a | ~2); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a | (2 & c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!a | (2 | c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!1 | (2 << c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!1 | (2 >> c));/* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!1 | (2 + c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!1 | (2 - c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!1 | (c = 2)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!1 | ~2); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!1 | (2 & c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ - foo (!1 | (2 | c)); /* { dg-warning "parentheses" "correct warning" { xfail *-*-* } } */ + foo (!a & (b << c));/* { dg-warning "parentheses" "correct warning" } */ + foo (!a & (b >> c));/* { dg-warning "parentheses" "correct warning" } */ + foo (!a & (b + c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a & (b - c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a & (b = c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a & ~b); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a & (b & c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a & (b | c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a & 2); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a & (2 << c));/* { dg-warning "parentheses" "correct warning" } */ + foo (!a & (2 >> c));/* { dg-warning "parentheses" "correct warning" } */ + foo (!a & (2 + c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a & (2 - c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a & (c = 2)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a & ~2); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a & (2 & c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a & (2 | c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!1 & (2 << c));/* { dg-warning "parentheses" "correct warning" } */ + foo (!1 & (2 >> c));/* { dg-warning "parentheses" "correct warning" } */ + foo (!1 & (2 + c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!1 & (2 - c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!1 & (c = 2)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!1 & ~2); /* { dg-warning "parentheses" "correct warning" } */ + foo (!1 & (2 & c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!1 & (2 | c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a | (b << c));/* { dg-warning "parentheses" "correct warning" } */ + foo (!a | (b >> c));/* { dg-warning "parentheses" "correct warning" } */ + foo (!a | (b + c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a | (b - c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a | (b = c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a | ~b); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a | (b & c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a | (b | c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a | (2 << c));/* { dg-warning "parentheses" "correct warning" } */ + foo (!a | (2 >> c));/* { dg-warning "parentheses" "correct warning" } */ + foo (!a | (2 + c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a | (2 - c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a | (c = 2)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a | ~2); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a | (2 & c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!a | (2 | c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!1 | (2 << c));/* { dg-warning "parentheses" "correct warning" } */ + foo (!1 | (2 >> c));/* { dg-warning "parentheses" "correct warning" } */ + foo (!1 | (2 + c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!1 | (2 - c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!1 | (c = 2)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!1 | ~2); /* { dg-warning "parentheses" "correct warning" } */ + foo (!1 | (2 & c)); /* { dg-warning "parentheses" "correct warning" } */ + foo (!1 | (2 | c)); /* { dg-warning "parentheses" "correct warning" } */ foo ((b << c) & !a); foo ((b >> c) & !a); foo ((b + c) & !a); |