]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Enable std::auto_ptr tests for C++11 and later
authorJonathan Wakely <jwakely@redhat.com>
Mon, 4 Sep 2023 13:25:14 +0000 (14:25 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 4 Sep 2023 15:24:35 +0000 (16:24 +0100)
There is no reason to only test std::auto_ptr with -std=c++03, we just
need to handle the deprecated warnings for C++11 and later.

libstdc++-v3/ChangeLog:

* testsuite/20_util/auto_ptr/1.cc: Remove dg-options -std=c++03
and add dg-warning for deprecation warnings.
* testsuite/20_util/auto_ptr/2.cc: Likewise.
* testsuite/20_util/auto_ptr/3.cc: Likewise.
* testsuite/20_util/auto_ptr/3946.cc: Likewise.
* testsuite/20_util/auto_ptr/4.cc: Likewise.
* testsuite/20_util/auto_ptr/5.cc: Likewise.
* testsuite/20_util/auto_ptr/6.cc: Likewise.
* testsuite/20_util/auto_ptr/7.cc: Likewise.
* testsuite/20_util/auto_ptr/assign_neg.cc: Likewise.
* testsuite/20_util/auto_ptr/requirements/explicit_instantiation/1.cc:
Likewise.
* testsuite/tr1/2_general_utilities/shared_ptr/assign/auto_ptr.cc:
Likewise.
* testsuite/tr1/2_general_utilities/shared_ptr/assign/auto_ptr_neg.cc:
Likewise.
* testsuite/tr1/2_general_utilities/shared_ptr/assign/auto_ptr_rvalue_neg.cc:
Likewise.
* testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc:
Likewise.
* testsuite/tr1/2_general_utilities/shared_ptr/cons/auto_ptr.cc:
Likewise.
* testsuite/tr1/2_general_utilities/shared_ptr/cons/auto_ptr_neg.cc:
Likewise.

16 files changed:
libstdc++-v3/testsuite/20_util/auto_ptr/1.cc
libstdc++-v3/testsuite/20_util/auto_ptr/2.cc
libstdc++-v3/testsuite/20_util/auto_ptr/3.cc
libstdc++-v3/testsuite/20_util/auto_ptr/3946.cc
libstdc++-v3/testsuite/20_util/auto_ptr/4.cc
libstdc++-v3/testsuite/20_util/auto_ptr/5.cc
libstdc++-v3/testsuite/20_util/auto_ptr/6.cc
libstdc++-v3/testsuite/20_util/auto_ptr/7.cc
libstdc++-v3/testsuite/20_util/auto_ptr/assign_neg.cc
libstdc++-v3/testsuite/20_util/auto_ptr/requirements/explicit_instantiation/1.cc
libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/assign/auto_ptr.cc
libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/assign/auto_ptr_neg.cc
libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/assign/auto_ptr_rvalue_neg.cc
libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc
libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/auto_ptr.cc
libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/auto_ptr_neg.cc

index b498711da76590f4262fdf0d44a6b241946bd274..64c0cf97e2ff3ea7951725ee9b1b83442c141dc1 100644 (file)
@@ -15,9 +15,9 @@
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// 20.4.5 Template class auto_ptr [lib.auto.ptr]
+// C++03 20.4.5 Template class auto_ptr [lib.auto.ptr]
 
-// { dg-options "-std=c++98" }
+// { dg-add-options using-deprecated }
 
 #include <memory>
 #include <testsuite_hooks.h>
@@ -63,21 +63,21 @@ test01()
 {
   reset_count_struct __attribute__((unused)) reset;
 
-  std::auto_ptr<A> A_default;
+  std::auto_ptr<A> A_default; // { dg-warning "deprecated" "" { target c++11 } }
   VERIFY( A_default.get() == 0 );
   VERIFY( A::ctor_count == 0 );
   VERIFY( A::dtor_count == 0 );
   VERIFY( B::ctor_count == 0 );
   VERIFY( B::dtor_count == 0 );
 
-  std::auto_ptr<A> A_from_A(new A);
+  std::auto_ptr<A> A_from_A(new A); // { dg-warning "deprecated" "" { target c++11 } }
   VERIFY( A_from_A.get() != 0 );
   VERIFY( A::ctor_count == 1 );
   VERIFY( A::dtor_count == 0 );
   VERIFY( B::ctor_count == 0 );
   VERIFY( B::dtor_count == 0 );
 
-  std::auto_ptr<A> A_from_B(new B);
+  std::auto_ptr<A> A_from_B(new B); // { dg-warning "deprecated" "" { target c++11 } }
   VERIFY( A_from_B.get() != 0 );
   VERIFY( A::ctor_count == 2 );
   VERIFY( A::dtor_count == 0 );
index 0d5aabe61a428a28df70f1c6b16516968b5a7236..9cbab139068babeef652d8a6d9de3a2ab6561d68 100644 (file)
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// 20.4.5 Template class auto_ptr [lib.auto.ptr]
+// C++03 20.4.5 Template class auto_ptr [lib.auto.ptr]
 
-// { dg-options "-std=c++98" }
+// { dg-add-options using-deprecated }
+// { dg-warning "auto_ptr. is deprecated" "" { target c++11 } 0 }
 
 #include <memory>
 #include <testsuite_hooks.h>
index afac4013b59dc93723077e77f88f4f076a10418d..ce020406cb8b98603e069850ae2325539ec95b54 100644 (file)
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// 20.4.5 Template class auto_ptr [lib.auto.ptr]
+// C++03 20.4.5 Template class auto_ptr [lib.auto.ptr]
 
-// { dg-options "-std=c++98" }
+// { dg-add-options using-deprecated }
+// { dg-warning "auto_ptr. is deprecated" "" { target c++11 } 0 }
 
 #include <memory>
 #include <testsuite_hooks.h>
index d6d755ac911375e179cd19d0b64ca08047b53db8..42ccf99c18125e06819ac50d8451f6c436bb846d 100644 (file)
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// 20.4.5 Template class auto_ptr [lib.auto.ptr]
+// C++03 20.4.5 Template class auto_ptr [lib.auto.ptr]
 
-// { dg-options "-std=c++98" }
+// { dg-add-options using-deprecated }
+// { dg-warning "auto_ptr. is deprecated" "" { target c++11 } 0 }
 
 #include <memory>
 #include <testsuite_hooks.h>
index fb896e11f024b15fb65bd9ed4f9d7f7bff1d0d70..7cf59965d7aa52d19eea9f30d21f67dcf329577a 100644 (file)
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// 20.4.5 Template class auto_ptr [lib.auto.ptr]
+// C++03 20.4.5 Template class auto_ptr [lib.auto.ptr]
 
-// { dg-options "-std=c++98" }
+// { dg-add-options using-deprecated }
+// { dg-warning "auto_ptr. is deprecated" "" { target c++11 } 0 }
 
 #include <memory>
 #include <testsuite_hooks.h>
index 8a766e6ec239d2574019c5bfda5af728c558eaf8..1e60f13a20d9e54c73e6504485e86db348d5857e 100644 (file)
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// 20.4.5 Template class auto_ptr [lib.auto.ptr]
+// C++03 20.4.5 Template class auto_ptr [lib.auto.ptr]
 
-// { dg-options "-std=c++98" }
+// { dg-add-options using-deprecated }
+// { dg-warning "auto_ptr. is deprecated" "" { target c++11 } 0 }
 
 #include <memory>
 #include <testsuite_hooks.h>
index cd1f0547f5b2c8fc95174305ad07c98f53e6164f..d888301c76688f6f726264eb87942c0e305a4aa5 100644 (file)
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// 20.4.5 Template class auto_ptr [lib.auto.ptr]
+// C++03 20.4.5 Template class auto_ptr [lib.auto.ptr]
 
-// { dg-options "-std=c++98" }
+// { dg-add-options using-deprecated }
+// { dg-warning "auto_ptr. is deprecated" "" { target c++11 } 0 }
 
 #include <memory>
 #include <testsuite_hooks.h>
index 86338c7e25903d9897b5ebd1d688700fd5354513..fd3f78a46cdad169fafbab8889887a36471a5c2b 100644 (file)
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// 20.4.5 Template class auto_ptr [lib.auto.ptr]
+// C++03 20.4.5 Template class auto_ptr [lib.auto.ptr]
 
-// { dg-options "-std=c++98" }
+// { dg-add-options using-deprecated }
+// { dg-warning "auto_ptr. is deprecated" "" { target c++11 } 0 }
 
 #include <memory>
 #include <testsuite_hooks.h>
index 5ff2ddb9113d8802cd921d2fb937ad1541bff25c..fa890fa4fcd8243680520153e6bc83a0824b81a3 100644 (file)
@@ -1,4 +1,6 @@
 // { dg-do compile }
+// { dg-add-options using-deprecated }
+// { dg-warning "auto_ptr. is deprecated" "" { target c++11 } 0 }
 
 // Copyright (C) 2002-2023 Free Software Foundation, Inc.
 //
@@ -17,9 +19,7 @@
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// 20.4.5 Template class auto_ptr negative tests [lib.auto.ptr]
-
-// { dg-options "-std=c++98" }
+// C++03 20.4.5 Template class auto_ptr negative tests [lib.auto.ptr]
 
 #include <memory>
 #include <testsuite_hooks.h>
index be7fb4822505342c5d562b9d144ded713201fc1f..b26b784fd4ff055be0edcf47a0b30ad543a78d23 100644 (file)
@@ -1,4 +1,6 @@
 // { dg-do compile }
+// { dg-add-options using-deprecated }
+// { dg-warning "auto_ptr. is deprecated" "" { target c++11 } 0 }
 
 // Copyright (C) 2007-2023 Free Software Foundation, Inc.
 //
@@ -18,9 +20,7 @@
 // <http://www.gnu.org/licenses/>.
 
 
-// This file tests explicit instantiation of library containers.
-
-// { dg-options "-std=c++98" }
+// This file tests explicit instantiation of library templates.
 
 #include <memory>
 
index c3ac4af7b7f37565ec71ede4340932917e9cd241..ad39e18eeeee642ba89ce0b2ccd90fc061318ff7 100644 (file)
@@ -17,7 +17,8 @@
 
 // TR1 2.2.2 Template class shared_ptr [tr.util.smartptr.shared]
 
-// { dg-options "-std=c++98" }
+// { dg-add-options using-deprecated }
+// { dg-warning "auto_ptr. is deprecated" "" { target c++11 } 0 }
 
 #include <tr1/memory>
 #include <testsuite_hooks.h>
index 56cc149fd68582ada7ae9d830040aefff5945a29..2f8697a3fa2dd3e7966430dcb4ed1962c162b639 100644 (file)
@@ -19,7 +19,8 @@
 
 // TR1 2.2.2 Template class shared_ptr [tr.util.smartptr.shared]
 
-// { dg-options "-std=c++98" }
+// { dg-add-options using-deprecated }
+// { dg-warning "auto_ptr. is deprecated" "" { target c++11 } 0 }
 
 #include <tr1/memory>
 #include <testsuite_hooks.h>
index b77208a620ee65afc6a51f8904b30760bcd6f75f..2efc9dee82393092bf0eed7b72103a50d10196cd 100644 (file)
@@ -19,7 +19,8 @@
 
 // TR1 2.2.2 Template class shared_ptr [tr.util.smartptr.shared]
 
-// { dg-options "-std=c++98" }
+// { dg-add-options using-deprecated }
+// { dg-warning "auto_ptr. is deprecated" "" { target c++11 } 0 }
 
 #include <tr1/memory>
 #include <testsuite_hooks.h>
index f6ba60aa824f446fab9c70eac75403c2cc939374..3229a52c6369bd23530c4d26124a9a11173a38f5 100644 (file)
@@ -17,7 +17,8 @@
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// { dg-options "-std=c++98 -fno-show-column" }
+// { dg-add-options using-deprecated }
+// { dg-warning "auto_ptr. is deprecated" "" { target c++11 } 0 }
 
 // 2.2.3 Class template shared_ptr [tr.util.smartptr.shared]
 
index 371b2a8c96ef471b3d7485bcdddf07c8579d5c59..d885597798aaae0a6d116b625995f276e3ec3f6d 100644 (file)
@@ -15,7 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// { dg-options "-std=c++98" }
+// { dg-add-options using-deprecated }
+// { dg-warning "auto_ptr. is deprecated" "" { target c++11 } 0 }
 
 // TR1 2.2.2 Template class shared_ptr [tr.util.smartptr.shared]
 
index 88c896cc17f8e485c749ad3d988058eac863613c..8b2fff2e387bff79c88b465f6a9ffe40e953e9be 100644 (file)
@@ -17,7 +17,8 @@
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// { dg-options "-std=c++98" }
+// { dg-add-options using-deprecated }
+// { dg-warning "auto_ptr. is deprecated" "" { target c++11 } 0 }
 
 // TR1 2.2.2 Template class shared_ptr [tr.util.smartptr.shared]