summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2001-08-13 21:07:22 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2001-08-13 21:07:22 +0000
commitb3ed30900e0cfe7018551a76e8aa81605327b71c (patch)
treeb3d6a8ca44a45cf8cd9364a50503a60ba3fc29a9 /gcc/cp
parent8bdc9c997821fb0c6c95f9ca81966bcc53df8b40 (diff)
downloadgcc-b3ed30900e0cfe7018551a76e8aa81605327b71c.tar.gz
* call.c (build_over_call): Mark COMPOUND_EXPRs generated for
empty class assignment as having side-effects to avoid spurious warnings. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44868 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/call.c9
2 files changed, 15 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b5f90a07ec7..f49263b2813 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2001-08-13 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (build_over_call): Mark COMPOUND_EXPRs generated for
+ empty class assignment as having side-effects to avoid
+ spurious warnings.
+
2001-08-13 Zack Weinberg <zackw@panix.com>
* Make-lang.in (cp/except.o): Add libfuncs.h to dependencies.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 6278095b834..8203032fc8a 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -4292,6 +4292,15 @@ build_over_call (cand, args, flags)
TREE_USED (arg) = 1;
val = build (COMPOUND_EXPR, DECL_CONTEXT (fn), arg, to);
+ /* Even though the assignment may not actually result in any
+ code being generated, we do not want to warn about the
+ assignment having no effect. That would be confusing to
+ users who may be performing the assignment as part of a
+ generic algorithm, for example.
+
+ Ideally, the notions of having side-effects and of being
+ useless would be orthogonal. */
+ TREE_SIDE_EFFECTS (val) = 1;
}
else
val = build (MODIFY_EXPR, TREE_TYPE (to), to, arg);