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/c-family | |
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/c-family')
-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 |
3 files changed, 13 insertions, 13 deletions
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); |