Commit 89132ebc by Dirk Mueller Committed by Dirk Mueller

c-common.c (warn_logical_operator): Fix condition.

2007-03-10  Dirk Mueller  <dmueller@suse.de>

       * c-common.c (warn_logical_operator): Fix condition.

From-SVN: r122800
parent 4cdffe3d
2007-03-10 Dirk Mueller <dmueller@suse.de>
* c-common.c (warn_logical_operator): Fix condition.
2007-03-10 Tobias Schlter <tobi@gcc.gnu.org> 2007-03-10 Tobias Schlter <tobi@gcc.gnu.org>
* config/i386/darwin.h (DARWIN_MINVERSION_SPEC): Add missing * config/i386/darwin.h (DARWIN_MINVERSION_SPEC): Add missing
......
...@@ -994,24 +994,22 @@ warn_logical_operator (enum tree_code code, tree arg1, tree ...@@ -994,24 +994,22 @@ warn_logical_operator (enum tree_code code, tree arg1, tree
case TRUTH_ORIF_EXPR: case TRUTH_ORIF_EXPR:
case TRUTH_OR_EXPR: case TRUTH_OR_EXPR:
case TRUTH_AND_EXPR: case TRUTH_AND_EXPR:
if (!TREE_NO_WARNING (arg1) if (!TREE_NO_WARNING (arg1)
&& INTEGRAL_TYPE_P (TREE_TYPE (arg1)) && INTEGRAL_TYPE_P (TREE_TYPE (arg1))
&& !CONSTANT_CLASS_P (arg1) && !CONSTANT_CLASS_P (arg1)
&& TREE_CODE (arg2) == INTEGER_CST && TREE_CODE (arg2) == INTEGER_CST
&& !integer_zerop (arg2) && !integer_zerop (arg2))
&& !integer_onep (arg2)) {
{ warning (OPT_Wlogical_op,
warning (OPT_Wlogical_op, "logical %<%s%> with non-zero constant "
"logical %<%s%> with non-zero constant " "will always evaluate as true",
"will always evaluate as true", ((code == TRUTH_ANDIF_EXPR)
((code == TRUTH_ANDIF_EXPR) || (code == TRUTH_AND_EXPR)) ? "&&" : "||");
|| (code == TRUTH_AND_EXPR)) ? "&&" : "||"); TREE_NO_WARNING (arg1) = true;
TREE_NO_WARNING (arg1) = true; }
} break;
break;
default: default:
break; break;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment