diff options
author | mueller <mueller@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-03-10 18:49:28 +0000 |
---|---|---|
committer | mueller <mueller@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-03-10 18:49:28 +0000 |
commit | e69784267d196f76f3143d1194e7a1e52fec9837 (patch) | |
tree | 8e1b6ac3759ac38c46f3b1f58ed8355eb1c0a871 /gcc/c-common.c | |
parent | bda81f0365b9cb085a5c59a6877e43c0985554f0 (diff) | |
download | gcc-e69784267d196f76f3143d1194e7a1e52fec9837.tar.gz |
2007-03-10 Dirk Mueller <dmueller@suse.de>
* c-common.c (warn_logical_operator): Fix condition.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122800 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 6216d5e123a..6543bd0f1b7 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -994,24 +994,22 @@ warn_logical_operator (enum tree_code code, tree arg1, tree case TRUTH_ORIF_EXPR: case TRUTH_OR_EXPR: case TRUTH_AND_EXPR: - if (!TREE_NO_WARNING (arg1) - && INTEGRAL_TYPE_P (TREE_TYPE (arg1)) - && !CONSTANT_CLASS_P (arg1) - && TREE_CODE (arg2) == INTEGER_CST - && !integer_zerop (arg2) - && !integer_onep (arg2)) - { - warning (OPT_Wlogical_op, - "logical %<%s%> with non-zero constant " - "will always evaluate as true", - ((code == TRUTH_ANDIF_EXPR) - || (code == TRUTH_AND_EXPR)) ? "&&" : "||"); - TREE_NO_WARNING (arg1) = true; - } - - break; + if (!TREE_NO_WARNING (arg1) + && INTEGRAL_TYPE_P (TREE_TYPE (arg1)) + && !CONSTANT_CLASS_P (arg1) + && TREE_CODE (arg2) == INTEGER_CST + && !integer_zerop (arg2)) + { + warning (OPT_Wlogical_op, + "logical %<%s%> with non-zero constant " + "will always evaluate as true", + ((code == TRUTH_ANDIF_EXPR) + || (code == TRUTH_AND_EXPR)) ? "&&" : "||"); + TREE_NO_WARNING (arg1) = true; + } + break; default: - break; + break; } } |