Replace dg-require-effective-target directives with a target selector on the dg-do directive.
We can also remove { dg-require-effective-target pthread } and the associated { dg-options "-pthread" } by allowing it to run on non-pthread targets and conditionally adding -pthread only for pthread targets. libstdc++-v3/ChangeLog: * testsuite/20_util/shared_ptr/atomic/3.cc: Simplify dg directives. * testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc: Likewise. * testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/allocate.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/allocate_single.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/cons.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/cons_single.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/is_equal.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/multithreaded.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/options.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/release.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/release_single.cc: Likewise. * testsuite/30_threads/condition_variable_any/stop_token/wait_on.cc: Likewise. * testsuite/30_threads/stop_token/stop_callback/deadlock-mt.cc: Likewise. * testsuite/30_threads/stop_token/stop_callback/destroy.cc: Likewise. --- libstdc++-v3/testsuite/20_util/shared_ptr/atomic/3.cc | 3 +-- .../20_util/shared_ptr/thread/default_weaktoshared.cc | 3 +-- .../20_util/shared_ptr/thread/mutex_weaktoshared.cc | 3 +-- .../20_util/synchronized_pool_resource/allocate.cc | 6 ++---- .../20_util/synchronized_pool_resource/allocate_single.cc | 3 +-- .../testsuite/20_util/synchronized_pool_resource/cons.cc | 6 ++---- .../20_util/synchronized_pool_resource/cons_single.cc | 3 +-- .../20_util/synchronized_pool_resource/is_equal.cc | 6 ++---- .../20_util/synchronized_pool_resource/multithreaded.cc | 6 ++---- .../testsuite/20_util/synchronized_pool_resource/options.cc | 6 ++---- .../testsuite/20_util/synchronized_pool_resource/release.cc | 6 ++---- .../20_util/synchronized_pool_resource/release_single.cc | 3 +-- .../30_threads/condition_variable_any/stop_token/wait_on.cc | 6 ++---- .../30_threads/stop_token/stop_callback/deadlock-mt.cc | 5 ++--- .../30_threads/stop_token/stop_callback/destroy.cc | 5 ++--- 15 files changed, 24 insertions(+), 46 deletions(-) diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/3.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/3.cc index 8346191412c..19efcadb7ec 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/3.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/3.cc @@ -1,6 +1,5 @@ -// { dg-do run } +// { dg-do run { target c++11 } } // { dg-additional-options "-pthread" { target pthread } } -// { dg-require-effective-target c++11 } // { dg-require-gthreads "" } // Copyright (C) 2014-2023 Free Software Foundation, Inc. diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc index 20c910c2fcd..af0e65e9469 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc @@ -17,10 +17,9 @@ // 20.6.6.2 Template class shared_ptr [util.smartptr.shared] -// { dg-do run } +// { dg-do run { target c++11 } } // { dg-additional-options "-pthread" { target pthread } } // { dg-add-options libatomic } -// { dg-require-effective-target c++11 } // { dg-require-gthreads "" } // { dg-require-cstdint "" } diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc index d6c8611aa85..07f7c49bf10 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc @@ -17,10 +17,9 @@ // 20.6.6.2 Template class shared_ptr [util.smartptr.shared] -// { dg-do run } +// { dg-do run { target c++11 } } // { dg-additional-options "-pthread" { target pthread } } // { dg-add-options libatomic } -// { dg-require-effective-target c++11 } // { dg-require-gthreads "" } // { dg-require-cstdint "" } diff --git a/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/allocate.cc b/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/allocate.cc index f9a4a2f3694..822a410b6c2 100644 --- a/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/allocate.cc +++ b/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/allocate.cc @@ -15,10 +15,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-do run } -// { dg-options "-pthread" } -// { dg-require-effective-target c++17 } -// { dg-require-effective-target pthread } +// { dg-do run { target c++17 } } +// { dg-additional-options "-pthread" { target pthread } } // { dg-require-gthreads "" } #include <memory_resource> diff --git a/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/allocate_single.cc b/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/allocate_single.cc index a29575fdd80..4acfde6e9d7 100644 --- a/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/allocate_single.cc +++ b/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/allocate_single.cc @@ -15,8 +15,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-do run } -// { dg-require-effective-target c++17 } +// { dg-do run { target c++17 } } // { dg-require-gthreads "" } // This runs the same tests as allocate.cc but without -pthread diff --git a/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/cons.cc b/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/cons.cc index f8b74d9d8cc..a3f98586684 100644 --- a/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/cons.cc +++ b/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/cons.cc @@ -15,10 +15,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-do run } -// { dg-options "-pthread" } -// { dg-require-effective-target c++17 } -// { dg-require-effective-target pthread } +// { dg-do run { target c++17 } } +// { dg-additional-options "-pthread" { target pthread } } // { dg-require-gthreads "" } #include <memory_resource> diff --git a/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/cons_single.cc b/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/cons_single.cc index ab215ba3c93..9668a51c346 100644 --- a/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/cons_single.cc +++ b/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/cons_single.cc @@ -15,8 +15,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-do run } -// { dg-require-effective-target c++17 } +// { dg-do run { target c++17 } } // { dg-require-gthreads "" } // This runs the same tests as cons.cc but without -pthread diff --git a/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/is_equal.cc b/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/is_equal.cc index 5be6bd69663..aacf00b079c 100644 --- a/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/is_equal.cc +++ b/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/is_equal.cc @@ -15,10 +15,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-do run } -// { dg-options "-pthread" } -// { dg-require-effective-target c++17 } -// { dg-require-effective-target pthread } +// { dg-do run { target c++17 } } +// { dg-additional-options "-pthread" { target pthread } } // { dg-require-gthreads "" } #include <memory_resource> diff --git a/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/multithreaded.cc b/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/multithreaded.cc index a7283bf5405..7992367ffda 100644 --- a/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/multithreaded.cc +++ b/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/multithreaded.cc @@ -15,10 +15,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-do run } -// { dg-options "-pthread" } -// { dg-require-effective-target c++17 } -// { dg-require-effective-target pthread } +// { dg-do run { target c++17 } } +// { dg-additional-options "-pthread" { target pthread } } // { dg-require-gthreads "" } #include <memory_resource> diff --git a/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/options.cc b/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/options.cc index a869b993ee3..9d98b5038db 100644 --- a/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/options.cc +++ b/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/options.cc @@ -15,10 +15,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-do run } -// { dg-options "-pthread" } -// { dg-require-effective-target c++17 } -// { dg-require-effective-target pthread } +// { dg-do run { target c++17 } } +// { dg-additional-options "-pthread" { target pthread } } // { dg-require-gthreads "" } #include <memory_resource> diff --git a/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/release.cc b/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/release.cc index d1c60432dd7..6752d6e270c 100644 --- a/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/release.cc +++ b/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/release.cc @@ -15,10 +15,8 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-do run } -// { dg-options "-pthread" } -// { dg-require-effective-target c++17 } -// { dg-require-effective-target pthread } +// { dg-do run { target c++17 } } +// { dg-additional-options "-pthread" { target pthread } } // { dg-require-gthreads "" } #include <memory_resource> diff --git a/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/release_single.cc b/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/release_single.cc index f69e96034ad..9645bc64c02 100644 --- a/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/release_single.cc +++ b/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/release_single.cc @@ -15,8 +15,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-do run } -// { dg-require-effective-target c++17 } +// { dg-do run { target c++17 } } // { dg-require-gthreads "" } // This runs the same tests as release.cc but without -pthread diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable_any/stop_token/wait_on.cc b/libstdc++-v3/testsuite/30_threads/condition_variable_any/stop_token/wait_on.cc index edebaa6acab..bac1f3509b5 100644 --- a/libstdc++-v3/testsuite/30_threads/condition_variable_any/stop_token/wait_on.cc +++ b/libstdc++-v3/testsuite/30_threads/condition_variable_any/stop_token/wait_on.cc @@ -15,11 +15,9 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++2a -pthread" } // { dg-add-options libatomic } -// { dg-do run } -// { dg-require-effective-target c++2a } -// { dg-require-effective-target pthread } +// { dg-do run { target c++20 } } +// { dg-additional-options "-pthread" { target pthread } } #include <condition_variable> #include <thread> diff --git a/libstdc++-v3/testsuite/30_threads/stop_token/stop_callback/deadlock-mt.cc b/libstdc++-v3/testsuite/30_threads/stop_token/stop_callback/deadlock-mt.cc index f6162879e54..e780955dbec 100644 --- a/libstdc++-v3/testsuite/30_threads/stop_token/stop_callback/deadlock-mt.cc +++ b/libstdc++-v3/testsuite/30_threads/stop_token/stop_callback/deadlock-mt.cc @@ -15,10 +15,9 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++2a -pthread" } // { dg-add-options libatomic } -// { dg-require-effective-target c++2a } -// { dg-require-effective-target pthread } +// { dg-do run { target c++20 } } +// { dg-additional-options "-pthread" { target pthread } } // { dg-require-gthreads "" } #include <stop_token> diff --git a/libstdc++-v3/testsuite/30_threads/stop_token/stop_callback/destroy.cc b/libstdc++-v3/testsuite/30_threads/stop_token/stop_callback/destroy.cc index 6bdd4d13f54..f13761ca0fe 100644 --- a/libstdc++-v3/testsuite/30_threads/stop_token/stop_callback/destroy.cc +++ b/libstdc++-v3/testsuite/30_threads/stop_token/stop_callback/destroy.cc @@ -15,10 +15,9 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++2a -pthread" } // { dg-add-options libatomic } -// { dg-require-effective-target c++2a } -// { dg-require-effective-target pthread } +// { dg-do run { target c++20 } } +// { dg-additional-options "-pthread" { target pthread } } // { dg-require-gthreads "" } #include <stop_token> -- 2.41.0