diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-14 09:51:46 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-14 09:51:46 +0000 |
commit | 110526c756ee73123a0e598b2f7f7bfd4e5a7837 (patch) | |
tree | 5ceab0e846550f51138e700c6642807d23e00bbb /gcc/stmt.c | |
parent | 10e53bb3feaefa0c2d905f42674461a8877c5e7d (diff) | |
download | gcc-110526c756ee73123a0e598b2f7f7bfd4e5a7837.tar.gz |
* stmt.c (warn_if_unused_value): Don't warn if the expression
has side effects.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37448 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stmt.c')
-rw-r--r-- | gcc/stmt.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/stmt.c b/gcc/stmt.c index 4e42e699462..82a390d1da1 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -2004,9 +2004,6 @@ warn_if_unused_value (exp) case TRY_CATCH_EXPR: case WITH_CLEANUP_EXPR: case EXIT_EXPR: - /* We don't warn about COND_EXPR because it may be a useful - construct if either arm contains a side effect. */ - case COND_EXPR: return 0; case BIND_EXPR: @@ -2067,6 +2064,10 @@ warn_if_unused_value (exp) && TREE_THIS_VOLATILE (exp)) return 0; + /* If this is an expression with side effects, don't warn. */ + if (TREE_SIDE_EFFECTS (exp)) + return 0; + /* If this is an expression which has no operands, there is no value to be unused. There are no such language-independent codes, but front ends may define such. */ |