diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 12 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/warn/Wunused-3.C | 11 |
4 files changed, 30 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6e5e223..2ebbbf7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 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. (hash_local_specialization): New function. (register_local_specialization): Revert 2003-01-05 change. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 85b6a2e..6363007 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1865,12 +1865,24 @@ import_export_tinfo (tree decl, tree type, bool is_in_library) 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 build_cleanup (tree decl) { tree temp; 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) temp = decl; else diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8b4fce3..2ae7060 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,9 @@ 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 * g++.dg/parse/defarg3.C: New test. diff --git a/gcc/testsuite/g++.dg/warn/Wunused-3.C b/gcc/testsuite/g++.dg/warn/Wunused-3.C new file mode 100644 index 0000000..3100909 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wunused-3.C @@ -0,0 +1,11 @@ +// { dg-do compile } +// { dg-options "-Wunused -O" } + +void do_cleanups(); + +class Cleanup { +public: + ~Cleanup() { do_cleanups();} +}; + +static Cleanup dummy; |