aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <merrill@gnu.org>1995-02-13 20:02:34 +0000
committerJason Merrill <merrill@gnu.org>1995-02-13 20:02:34 +0000
commitd1e1adfb128e33b98deb622af8e33844c1d98d2b (patch)
treedea7714ef29ec93f39774a6c5aebcba7d3c8828c /gcc
parentbd2e6d530f25fc84322aafe4eb76e5cbccf14333 (diff)
downloadgcc-d1e1adfb128e33b98deb622af8e33844c1d98d2b.zip
gcc-d1e1adfb128e33b98deb622af8e33844c1d98d2b.tar.gz
gcc-d1e1adfb128e33b98deb622af8e33844c1d98d2b.tar.bz2
(warn_if_unused_value): Don't warn about automatic reference dereference.
From-SVN: r8932
Diffstat (limited to 'gcc')
-rw-r--r--gcc/stmt.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 73c5c9d..b4e503a 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -1746,14 +1746,22 @@ warn_if_unused_value (exp)
if (TREE_CODE (tem) == MODIFY_EXPR || TREE_CODE (tem) == INIT_EXPR)
return 0;
}
- /* ... fall through ... */
+ goto warn;
+ case INDIRECT_REF:
+ /* Don't warn about automatic dereferencing of references, since
+ the user cannot control it. */
+ if (TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == REFERENCE_TYPE)
+ return warn_if_unused_value (TREE_OPERAND (exp, 0));
+ /* ... fall through ... */
+
default:
/* Referencing a volatile value is a side effect, so don't warn. */
if ((TREE_CODE_CLASS (TREE_CODE (exp)) == 'd'
|| TREE_CODE_CLASS (TREE_CODE (exp)) == 'r')
&& TREE_THIS_VOLATILE (exp))
return 0;
+ warn:
warning_with_file_and_line (emit_filename, emit_lineno,
"value computed is not used");
return 1;