Commit c10cdb3d by Mark Mitchell Committed by Mark Mitchell

re PR c++/9165 (false "defined but not used" warnings)

	PR c++/9165
	* decl2.c (build_cleanup): Mark the object as used.

	PR c++/9165
	* g++.dg/warn/Wunused-3.C: New test.

From-SVN: r60972
parent 69f794a7
2003-01-06 Mark Mitchell <mark@codesourcery.com> 2003-01-06 Mark Mitchell <mark@codesourcery.com>
PR c++/9165
* decl2.c (build_cleanup): Mark the object as used.
* pt.c (retrieve_local_specialization): Revert 2003-01-05 change. * pt.c (retrieve_local_specialization): Revert 2003-01-05 change.
(hash_local_specialization): New function. (hash_local_specialization): New function.
(register_local_specialization): Revert 2003-01-05 change. (register_local_specialization): Revert 2003-01-05 change.
......
...@@ -1865,12 +1865,24 @@ import_export_tinfo (tree decl, tree type, bool is_in_library) ...@@ -1865,12 +1865,24 @@ import_export_tinfo (tree decl, tree type, bool is_in_library)
DECL_INTERFACE_KNOWN (decl) = 1; DECL_INTERFACE_KNOWN (decl) = 1;
} }
/* Return an expression that performs the destruction of DECL, which
must be a VAR_DECL whose type has a non-trivial destructor, or is
an array whose (innermost) elements have a non-trivial destructor. */
tree tree
build_cleanup (tree decl) build_cleanup (tree decl)
{ {
tree temp; tree temp;
tree type = TREE_TYPE (decl); tree type = TREE_TYPE (decl);
/* This function should only be called for declarations that really
require cleanups. */
my_friendly_assert (!TYPE_HAS_TRIVIAL_DESTRUCTOR (type), 20030106);
/* Treat all objects with destructors as used; the destructor may do
something substantive. */
mark_used (decl);
if (TREE_CODE (type) == ARRAY_TYPE) if (TREE_CODE (type) == ARRAY_TYPE)
temp = decl; temp = decl;
else else
......
2003-01-06 Mark Mitchell <mark@codesourcery.com> 2003-01-06 Mark Mitchell <mark@codesourcery.com>
* testsuite/g++.dg/abi/bitfield9.C: New test. PR c++/9165
* g++.dg/warn/Wunused-3.C: New test.
* g++.dg/abi/bitfield9.C: New test.
PR c++/9189 PR c++/9189
* g++.dg/parse/defarg3.C: New test. * g++.dg/parse/defarg3.C: New test.
......
// { dg-do compile }
// { dg-options "-Wunused -O" }
void do_cleanups();
class Cleanup {
public:
~Cleanup() { do_cleanups();}
};
static Cleanup dummy;
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