diff options
author | Jakub Jelinek <jakub@redhat.com> | 2002-02-21 21:23:48 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2002-02-21 21:23:48 +0100 |
commit | 7133e9921a9cfd599637a1d539b206b21e79545d (patch) | |
tree | b43c83e9ddfdda467df3d0c0ff6814391dc66cee /gcc/stmt.c | |
parent | e2ec05a6c96065358c2afaafd2c62dc1f1a2db4d (diff) | |
download | gcc-7133e9921a9cfd599637a1d539b206b21e79545d.zip gcc-7133e9921a9cfd599637a1d539b206b21e79545d.tar.gz gcc-7133e9921a9cfd599637a1d539b206b21e79545d.tar.bz2 |
re PR c/4697 (Warning 'value computed is not used' missing)
PR c/4697:
* stmt.c (warn_if_unused_value): Move side effects test once more.
* gcc.dg/20020220-2.c: New test.
From-SVN: r49937
Diffstat (limited to 'gcc/stmt.c')
-rw-r--r-- | gcc/stmt.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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; |