diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-02-21 20:23:48 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-02-21 20:23:48 +0000 |
commit | 47ed174f8c9f542fbe9fc20f5f2031059724ff8c (patch) | |
tree | b43c83e9ddfdda467df3d0c0ff6814391dc66cee /gcc/stmt.c | |
parent | 78498602c701766719472f1d0c205d95d36e5791 (diff) | |
download | ppe42-gcc-47ed174f8c9f542fbe9fc20f5f2031059724ff8c.tar.gz ppe42-gcc-47ed174f8c9f542fbe9fc20f5f2031059724ff8c.zip |
PR c/4697:
* stmt.c (warn_if_unused_value): Move side effects test once more.
* gcc.dg/20020220-2.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49937 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stmt.c')
-rw-r--r-- | gcc/stmt.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/stmt.c b/gcc/stmt.c index 17b4d0b1972..fc968bcbab3 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -2303,10 +2303,6 @@ warn_if_unused_value (exp) if (VOID_TYPE_P (TREE_TYPE (exp))) return 0; - /* If this is an expression with side effects, don't warn. */ - if (TREE_SIDE_EFFECTS (exp)) - return 0; - switch (TREE_CODE (exp)) { case PREINCREMENT_EXPR: @@ -2366,7 +2362,7 @@ warn_if_unused_value (exp) || TREE_CODE (tem) == CALL_EXPR) return 0; } - goto warn; + goto maybe_warn; case INDIRECT_REF: /* Don't warn about automatic dereferencing of references, since @@ -2389,7 +2385,11 @@ warn_if_unused_value (exp) && TREE_CODE_LENGTH (TREE_CODE (exp)) == 0) return 0; - warn: + maybe_warn: + /* If this is an expression with side effects, don't warn. */ + if (TREE_SIDE_EFFECTS (exp)) + return 0; + warning_with_file_and_line (emit_filename, emit_lineno, "value computed is not used"); return 1; |