Commit 63d6f87a by Mark Mitchell Committed by Mark Mitchell

call.c (build_over_call): Mark COMPOUND_EXPRs generated for empty class…

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
parent 7db19937
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.
......
......@@ -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);
......
// Build don't link:
// Origin: Mark Mitchell <mark@codesourcery.com>
struct E {};
void f () {
E e1, e2;
e1 = e2; // We should not warn about this statement, even though no
// code is generated for it.
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment