Commit dc9e1b86 by Jason Merrill Committed by Jason Merrill

re PR c++/59315 (g++.dg/warn/Wunused-3.C FAILs with -fno-use-cxa-atexit)

	PR c++/59315
	* decl.c (cxx_maybe_build_cleanup): Call mark_used.

From-SVN: r207236
parent 4ca56230
2014-01-29 Jason Merrill <jason@redhat.com>
PR c++/59315
* decl.c (cxx_maybe_build_cleanup): Call mark_used.
2014-01-29 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58702
......
......@@ -14353,6 +14353,13 @@ cxx_maybe_build_cleanup (tree decl, tsubst_flags_t complain)
destructor call instead. */
if (cleanup != NULL && EXPR_P (cleanup))
SET_EXPR_LOCATION (cleanup, UNKNOWN_LOCATION);
if (cleanup
&& !lookup_attribute ("warn_unused", TYPE_ATTRIBUTES (TREE_TYPE (decl))))
/* Treat objects with destructors as used; the destructor may do
something substantive. */
mark_used (decl);
return cleanup;
}
......
// { dg-do compile }
// { dg-options "-Wunused -O" }
// { dg-options "-Wunused -O -fno-use-cxa-atexit" }
void do_cleanups();
......
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