Skip to content
Snippets Groups Projects
Commit 5d2a360f authored by Iain Buclaw's avatar Iain Buclaw
Browse files

d: Add warning for call expression without side effects

In the last merge of the dmd front-end with upstream (r14-4830), this
warning got removed from the semantic passes.  Reimplement the warning
for the code generation pass instead, where it cannot have an effect on
conditional compilation.

gcc/d/ChangeLog:

	* d-codegen.cc (call_side_effect_free_p): New function.
	* d-tree.h (CALL_EXPR_WARN_IF_UNUSED): New macro.
	(call_side_effect_free_p): New prototype.
	* expr.cc (ExprVisitor::visit (CallExp *)): Set
	CALL_EXPR_WARN_IF_UNUSED on matched call expressions.
	(ExprVisitor::visit (NewExp *)): Don't dereference the result of an
	allocation call here.
	* toir.cc (add_stmt): Emit warning when call expression added to
	statement list without being used.

gcc/testsuite/ChangeLog:

	* gdc.dg/Wunused_value.d: New test.
parent 7f974c5f
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment