projects
/
gcc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
390e01b
)
(truthvalue_conversion): Optionally warn if an
author
Richard Stallman
<rms@gnu.org>
Fri, 14 Aug 1992 23:45:09 +0000
(23:45 +0000)
committer
Richard Stallman
<rms@gnu.org>
Fri, 14 Aug 1992 23:45:09 +0000
(23:45 +0000)
unparenthesized assignment is used as a truth value.
From-SVN: r1853
gcc/c-common.c
patch
|
blob
|
history
diff --git
a/gcc/c-common.c
b/gcc/c-common.c
index 50aa60e90aeba831bde9a9427e6e27a38b69eabe..33804c41a8d8601040177487ec3732df099ab221 100644
(file)
--- a/
gcc/c-common.c
+++ b/
gcc/c-common.c
@@
-901,6
+901,11
@@
truthvalue_conversion (expr)
fold (build1 (NOP_EXPR,
TREE_TYPE (TREE_OPERAND (expr, 0)),
TREE_OPERAND (expr, 1))), 1);
+
+ case MODIFY_EXPR:
+ if (warn_parentheses && C_EXP_ORIGINAL_CODE (expr) == MODIFY_EXPR)
+ warning ("suggest parentheses around assignment used as truth value");
+ break;
}
return build_binary_op (NE_EXPR, expr, integer_zero_node, 1);