From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id E2D883851C14; Tue, 3 Aug 2021 15:33:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E2D883851C14 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-2699] libstdc++: Add testsuite proc for testing deprecated features X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: e9f64fff64d83f5fcaa9ff17f1688490f75bdcb7 X-Git-Newrev: 07b70dfc4eab7869e7a43b3ff5b8b512dba0bb6e Message-Id: <20210803153351.E2D883851C14@sourceware.org> Date: Tue, 3 Aug 2021 15:33:51 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 15:33:52 -0000 https://gcc.gnu.org/g:07b70dfc4eab7869e7a43b3ff5b8b512dba0bb6e commit r12-2699-g07b70dfc4eab7869e7a43b3ff5b8b512dba0bb6e Author: Jonathan Wakely Date: Mon Aug 2 23:55:18 2021 +0100 libstdc++: Add testsuite proc for testing deprecated features 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 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. Diff: --- libstdc++-v3/testsuite/20_util/function_objects/binders/3113.cc | 2 ++ libstdc++-v3/testsuite/20_util/pair/cons/99957.cc | 1 + libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr.cc | 1 + libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc | 1 + libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue.cc | 1 + libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820_neg.cc | 1 + libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr.cc | 1 + libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc | 1 + libstdc++-v3/testsuite/20_util/shared_ptr/creation/dr925.cc | 1 + libstdc++-v3/testsuite/20_util/unique_ptr/cons/auto_ptr.cc | 3 ++- libstdc++-v3/testsuite/20_util/unique_ptr/cons/auto_ptr_neg.cc | 3 ++- libstdc++-v3/testsuite/23_containers/forward_list/operations/3.cc | 4 +--- libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_erase_if.cc | 2 ++ .../testsuite/ext/pb_ds/example/priority_queue_split_join.cc | 2 ++ libstdc++-v3/testsuite/lib/dg-options.exp | 5 +++++ 15 files changed, 24 insertions(+), 5 deletions(-) diff --git a/libstdc++-v3/testsuite/20_util/function_objects/binders/3113.cc b/libstdc++-v3/testsuite/20_util/function_objects/binders/3113.cc index c4dd784dd6c..0b671ae4a0e 100644 --- a/libstdc++-v3/testsuite/20_util/function_objects/binders/3113.cc +++ b/libstdc++-v3/testsuite/20_util/function_objects/binders/3113.cc @@ -17,6 +17,8 @@ // with this library; see the file COPYING3. If not see // . +// { dg-add-options using-deprecated } + // 20.3.6 Binders #include diff --git a/libstdc++-v3/testsuite/20_util/pair/cons/99957.cc b/libstdc++-v3/testsuite/20_util/pair/cons/99957.cc index 150bcd57c9a..82ec54ca1d8 100644 --- a/libstdc++-v3/testsuite/20_util/pair/cons/99957.cc +++ b/libstdc++-v3/testsuite/20_util/pair/cons/99957.cc @@ -1,4 +1,5 @@ // { dg-options "-Wdeprecated" } +// { dg-add-options using-deprecated } // { dg-do compile { target { c++11 && { ! c++20 } } } } #include diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr.cc index 9615897cbff..82750dca9a9 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr.cc @@ -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. diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc index 726df89ce10..32af6001366 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc @@ -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. diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue.cc index b052a6c00ee..2f6e4db18d9 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue.cc @@ -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. diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820_neg.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820_neg.cc index 07e95b2e169..3131dd3710c 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820_neg.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820_neg.cc @@ -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. diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr.cc index af71f45dad5..130861394a9 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr.cc @@ -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. diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc index 97254b0e471..67d64c67443 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc @@ -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. diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/creation/dr925.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/creation/dr925.cc index 5822a775c59..87e89375d28 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/creation/dr925.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/creation/dr925.cc @@ -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. diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/cons/auto_ptr.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/cons/auto_ptr.cc index 608a0a0a4e0..8c25b56d889 100644 --- a/libstdc++-v3/testsuite/20_util/unique_ptr/cons/auto_ptr.cc +++ b/libstdc++-v3/testsuite/20_util/unique_ptr/cons/auto_ptr.cc @@ -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 diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/cons/auto_ptr_neg.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/cons/auto_ptr_neg.cc index abfc9d790eb..b9eb0b20d58 100644 --- a/libstdc++-v3/testsuite/20_util/unique_ptr/cons/auto_ptr_neg.cc +++ b/libstdc++-v3/testsuite/20_util/unique_ptr/cons/auto_ptr_neg.cc @@ -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 diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/operations/3.cc b/libstdc++-v3/testsuite/23_containers/forward_list/operations/3.cc index 9792ff6c9ac..37733122d71 100644 --- a/libstdc++-v3/testsuite/23_containers/forward_list/operations/3.cc +++ b/libstdc++-v3/testsuite/23_containers/forward_list/operations/3.cc @@ -22,8 +22,6 @@ #include #include -#include - // This test verifies the following: // remove_if void @@ -31,7 +29,7 @@ test01() { std::forward_list fl ={0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; - fl.remove_if(std::bind2nd(std::less(),5)); + fl.remove_if([](int i) { return i < 5; }); std::forward_list::const_iterator pos = fl.cbegin(); VERIFY(*pos == 5); diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_erase_if.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_erase_if.cc index 6f2ff4457ff..d72526e0078 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_erase_if.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_erase_if.cc @@ -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. diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_split_join.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_split_join.cc index e4b017ab297..986f032c8ab 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_split_join.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_split_join.cc @@ -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. diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp b/libstdc++-v3/testsuite/lib/dg-options.exp index 872768f2620..79fa23aba9a 100644 --- a/libstdc++-v3/testsuite/lib/dg-options.exp +++ b/libstdc++-v3/testsuite/lib/dg-options.exp @@ -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 } {