diff options
author | Mark Mitchell <mark@codesourcery.com> | 2001-08-13 21:07:22 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2001-08-13 21:07:22 +0000 |
commit | 63d6f87a6d1eae6411542567d6834c27c4509f40 (patch) | |
tree | b3d6a8ca44a45cf8cd9364a50503a60ba3fc29a9 /gcc/cp | |
parent | 7db19937237a4ae5d1cae179a1614f3294c9d3cc (diff) | |
download | gcc-63d6f87a6d1eae6411542567d6834c27c4509f40.zip gcc-63d6f87a6d1eae6411542567d6834c27c4509f40.tar.gz gcc-63d6f87a6d1eae6411542567d6834c27c4509f40.tar.bz2 |
call.c (build_over_call): Mark COMPOUND_EXPRs generated for empty class assignment as having side-effects...
* call.c (build_over_call): Mark COMPOUND_EXPRs generated for
empty class assignment as having side-effects to avoid
spurious warnings.
From-SVN: r44868
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/call.c | 9 |
2 files changed, 15 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b5f90a0..f49263b 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 6278095..8203032 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); |