summaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authormueller <mueller@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-10 18:49:28 +0000
committermueller <mueller@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-10 18:49:28 +0000
commite69784267d196f76f3143d1194e7a1e52fec9837 (patch)
tree8e1b6ac3759ac38c46f3b1f58ed8355eb1c0a871 /gcc/c-common.c
parentbda81f0365b9cb085a5c59a6877e43c0985554f0 (diff)
downloadgcc-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.c32
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;
}
}