]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Add testsuite proc for testing deprecated features
authorJonathan Wakely <jwakely@redhat.com>
Mon, 2 Aug 2021 22:55:18 +0000 (23:55 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 3 Aug 2021 14:30:17 +0000 (15:30 +0100)
This change adds options to tests that explicitly use deprecated
features, so that -D_GLIBCXX_USE_DEPRECATED=0 can be used to run the
rest of the testsuite. The tests that explicitly/intentionally use
deprecated features will still be able to use them, but they can be
disabled for the majority of tests.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* testsuite/23_containers/forward_list/operations/3.cc:
Use lambda instead of std::bind2nd.
* testsuite/20_util/function_objects/binders/3113.cc: Add
options for testing deprecated features.
* testsuite/20_util/pair/cons/99957.cc: Likewise.
* testsuite/20_util/shared_ptr/assign/auto_ptr.cc: Likewise.
* testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc: Likewise.
* testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue.cc:
Likewise.
* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/auto_ptr.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/dr925.cc: Likewise.
* testsuite/20_util/unique_ptr/cons/auto_ptr.cc: Likewise.
* testsuite/20_util/unique_ptr/cons/auto_ptr_neg.cc: Likewise.
* testsuite/ext/pb_ds/example/priority_queue_erase_if.cc:
Likewise.
* testsuite/ext/pb_ds/example/priority_queue_split_join.cc:
Likewise.
* testsuite/lib/dg-options.exp (dg_add_options_using-deprecated):
New proc.

15 files changed:
libstdc++-v3/testsuite/20_util/function_objects/binders/3113.cc
libstdc++-v3/testsuite/20_util/pair/cons/99957.cc
libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr.cc
libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc
libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue.cc
libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820_neg.cc
libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr.cc
libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc
libstdc++-v3/testsuite/20_util/shared_ptr/creation/dr925.cc
libstdc++-v3/testsuite/20_util/unique_ptr/cons/auto_ptr.cc
libstdc++-v3/testsuite/20_util/unique_ptr/cons/auto_ptr_neg.cc
libstdc++-v3/testsuite/23_containers/forward_list/operations/3.cc
libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_erase_if.cc
libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_split_join.cc
libstdc++-v3/testsuite/lib/dg-options.exp

index c4dd784dd6c803961c059b2143ddac841d3405c0..0b671ae4a0ea3ae4f726b40a1f308c243418db41 100644 (file)
@@ -17,6 +17,8 @@
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
+// { dg-add-options using-deprecated }
+
 // 20.3.6 Binders
 
 #include <vector>
index 150bcd57c9a8a8a42dcb401ed6601f5702a9b48c..82ec54ca1d819fa096e9b5077e3a71ed3cbe1a3f 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-options "-Wdeprecated" }
+// { dg-add-options using-deprecated }
 // { dg-do compile { target { c++11 && { ! c++20 } } } }
 
 #include <utility>
index 9615897cbffa466610ac2c198ea92ee2a87fbdb0..82750dca9a967d0cce7fd28b4893f522b4264b5b 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-options "-Wno-deprecated" }
+// { dg-add-options using-deprecated }
 // { dg-do run { target c++11 } }
 
 // Copyright (C) 2005-2021 Free Software Foundation, Inc.
index 726df89ce10aed961ddd0b58e6df076fd378062e..32af6001366f98de7c303c2733e877df90382c34 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-options "-Wno-deprecated" }
+// { dg-add-options using-deprecated }
 // { dg-do compile { target c++11 } }
 
 // Copyright (C) 2005-2021 Free Software Foundation, Inc.
index b052a6c00eecf19032cd9bb01aa7a6eb20580a97..2f6e4db18d9840e2e3c470c00eddcde1b1ba8611 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-options "-Wno-deprecated" }
+// { dg-add-options using-deprecated }
 // { dg-do compile { target c++11 } }
 
 // Copyright (C) 2008-2021 Free Software Foundation, Inc.
index 07e95b2e16907735b9421519286c3b556abee65f..3131dd3710cbb935d18d8cda77f244d806034dfe 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-options "-Wno-deprecated" }
+// { dg-add-options using-deprecated }
 // { dg-do compile { target c++11 } }
 
 // Copyright (C) 2010-2021 Free Software Foundation, Inc.
index af71f45dad546952db49e49f51294f3b96f8fa03..130861394a9066df4796e9b5db64da1da2bb71d3 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-options "-Wno-deprecated" }
+// { dg-add-options using-deprecated }
 // { dg-do run { target c++11 } }
 
 // Copyright (C) 2005-2021 Free Software Foundation, Inc.
index 97254b0e47128ed4ab6be4da05c46f6625c095df..67d64c674436b33a69120dc8f38aff42f6f3f513 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-options "-Wno-deprecated" }
+// { dg-add-options using-deprecated }
 // { dg-do compile { target c++11 } }
 
 // Copyright (C) 2005-2021 Free Software Foundation, Inc.
index 5822a775c599e20eb59850b5e3e26ecfe6be220f..87e89375d28aa73e83a18b313ca57ff87147403e 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-options "-Wno-deprecated" }
+// { dg-add-options using-deprecated }
 // { dg-do run { target c++11 } }
 
 // Copyright (C) 2010-2021 Free Software Foundation, Inc.
index 608a0a0a4e0c64207591f43af0b8b1e73dd3976c..8c25b56d88928668c6989236d545b4b40f841312 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-options "-Wno-deprecated" }
+// { dg-add-options using-deprecated }
 // { dg-do run { target c++11 } }
 
 // Copyright (C) 2010-2021 Free Software Foundation, Inc.
@@ -25,7 +26,7 @@
 
 struct A { };
 
-// 20.9.10.2.1 unique_ptr constructors [unique.ptr.single.ctor] 
+// 20.9.10.2.1 unique_ptr constructors [unique.ptr.single.ctor]
 
 // Construction from auto_ptr
 void
index abfc9d790ebfebdada887af103224175661db6ec..b9eb0b20d582d045b5eddbaf681ce710b80ae1df 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-options "-Wno-deprecated" }
+// { dg-add-options using-deprecated }
 // { dg-do compile { target c++11 } }
 
 // Copyright (C) 2010-2021 Free Software Foundation, Inc.
@@ -24,7 +25,7 @@
 
 struct A { };
 
-// 20.9.10.2.1 unique_ptr constructors [unique.ptr.single.ctor] 
+// 20.9.10.2.1 unique_ptr constructors [unique.ptr.single.ctor]
 
 // Construction from const auto_ptr
 void
index 9792ff6c9acbd84f16a05ff34676e40582654502..37733122d71798f863932b53ce3edcc550c0ef0a 100644 (file)
@@ -22,8 +22,6 @@
 #include <forward_list>
 #include <testsuite_hooks.h>
 
-#include <algorithm>
-
 // This test verifies the following:
 //   remove_if
 void
@@ -31,7 +29,7 @@ test01()
 {
   std::forward_list<int> fl ={0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
 
-  fl.remove_if(std::bind2nd(std::less<int>(),5));
+  fl.remove_if([](int i) { return i < 5; });
 
   std::forward_list<int>::const_iterator pos = fl.cbegin();
   VERIFY(*pos == 5);
index 6f2ff4457ff01c642ff9dc69197d946351a900e9..d72526e0078469e760b0944967ab06e6a9d1a4b5 100644 (file)
@@ -29,6 +29,8 @@
 // purpose. It is provided "as is" without express or implied
 // warranty.
 
+// { dg-add-options using-deprecated }
+
 /**
  * @file priority_queue_erase_if.cpp
  * Example showing how to conditionally erase values from a priority queue.
index e4b017ab297a731a3ff3d0bdf139d1fc26e21e84..986f032c8ab13723aa498baacff3c7be7aa353c6 100644 (file)
@@ -29,6 +29,8 @@
 // purpose. It is provided "as is" without express or implied
 // warranty.
 
+// { dg-add-options using-deprecated }
+
 /**
  * @file priority_queue_split_join_example.cpp
  * A basic example showing how to split and join priority queues.
index 872768f26201aed9f4df7857762263f35078b2d2..79fa23aba9a106870d13a4bedd8e708b409fd364 100644 (file)
@@ -316,6 +316,11 @@ proc add_options_for_libatomic { flags } {
     return $flags
 }
 
+# Add options to enable use of deprecated features.
+proc add_options_for_using-deprecated { flags } {
+    return "$flags -U_GLIBCXX_USE_DEPRECATED -D_GLIBCXX_USE_DEPRECATED=1"
+}
+
 # Like dg-options, but adds to the default options rather than replacing them.
 
 proc dg-additional-options { args } {