[13/13] libstdc++: Simplify dejagnu directives for some tests using threads
Checks
Commit Message
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(-)
@@ -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.
@@ -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 "" }
@@ -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 "" }
@@ -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>
@@ -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
@@ -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>
@@ -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
@@ -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>
@@ -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>
@@ -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>
@@ -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>
@@ -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
@@ -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>
@@ -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>
@@ -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>