summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/lib
diff options
context:
space:
mode:
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-22 21:31:24 +0000
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-22 21:31:24 +0000
commit7a0b241e4f1d941f602c885fc116d9a3f0ee6273 (patch)
tree621f9002ec44cd4395c9dd19659892c43049e647 /libstdc++-v3/testsuite/lib
parenta2eb22f09bcadd9a021cda72aee6aefee477bc55 (diff)
downloadgcc-7a0b241e4f1d941f602c885fc116d9a3f0ee6273.tar.gz
PR libstdc++/50196
* acinclude.m4 (GLIBCXX_HAS_GTHREADS): Don't depend on _POSIX_TIMEOUTS. * configure: Regenerate. * include/std/mutex (timed_mutex, recursive_timed_mutex): Define conditionally on GTHREADS_HAS_MUTEX_TIMEDLOCK. * testsuite/lib/libstdc++.exp (check_v3_target_gthreads_timed): Define. * testsuite/lib/dg-options.exp (dg-require-gthreads-timed): Define. * testsuite/30_threads/recursive_timed_mutex/dest/destructor_locked.cc: Use dg-require-gthreads-timed instead of dg-require-gthreads. * testsuite/30_threads/recursive_timed_mutex/native_handle/ typesizes.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/native_handle/1.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/try_lock_until/1.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/try_lock_until/2.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/cons/assign_neg.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/cons/1.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/cons/copy_neg.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/requirements/typedefs.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/try_lock/1.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/try_lock/2.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/lock/1.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/lock/2.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/unlock/1.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/try_lock_for/1.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/try_lock_for/2.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/try_lock_for/3.cc: Likewise. * testsuite/30_threads/timed_mutex/dest/destructor_locked.cc: Likewise. * testsuite/30_threads/timed_mutex/native_handle/typesizes.cc: Likewise. * testsuite/30_threads/timed_mutex/native_handle/1.cc: Likewise. * testsuite/30_threads/timed_mutex/try_lock_until/1.cc: Likewise. * testsuite/30_threads/timed_mutex/try_lock_until/2.cc: Likewise. * testsuite/30_threads/timed_mutex/cons/assign_neg.cc: Likewise. * testsuite/30_threads/timed_mutex/cons/1.cc: Likewise. * testsuite/30_threads/timed_mutex/cons/copy_neg.cc: Likewise. * testsuite/30_threads/timed_mutex/requirements/standard_layout.cc: Likewise. * testsuite/30_threads/timed_mutex/requirements/typedefs.cc: Likewise. * testsuite/30_threads/timed_mutex/try_lock/1.cc: Likewise. * testsuite/30_threads/timed_mutex/try_lock/2.cc: Likewise. * testsuite/30_threads/timed_mutex/lock/1.cc: Likewise. * testsuite/30_threads/timed_mutex/unlock/1.cc: Likewise. * testsuite/30_threads/timed_mutex/try_lock_for/1.cc: Likewise. * testsuite/30_threads/timed_mutex/try_lock_for/2.cc: Likewise. * testsuite/30_threads/timed_mutex/try_lock_for/3.cc: Likewise. * testsuite/30_threads/unique_lock/cons/5.cc: Likewise. * testsuite/30_threads/unique_lock/cons/6.cc: Likewise. * testsuite/30_threads/unique_lock/locking/3.cc: Likewise. * testsuite/30_threads/unique_lock/locking/4.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180329 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite/lib')
-rw-r--r--libstdc++-v3/testsuite/lib/dg-options.exp9
-rw-r--r--libstdc++-v3/testsuite/lib/libstdc++.exp60
2 files changed, 69 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp b/libstdc++-v3/testsuite/lib/dg-options.exp
index 46d3ce9e71a..d5eb5e827ad 100644
--- a/libstdc++-v3/testsuite/lib/dg-options.exp
+++ b/libstdc++-v3/testsuite/lib/dg-options.exp
@@ -134,6 +134,15 @@ proc dg-require-gthreads { args } {
return
}
+proc dg-require-gthreads-timed { args } {
+ if { ![ check_v3_target_gthreads_timed ] } {
+ upvar dg-do-what dg-do-what
+ set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+ return
+ }
+ return
+}
+
proc dg-require-nanosleep { args } {
if { ![ check_v3_target_nanosleep ] } {
upvar dg-do-what dg-do-what
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
index d39e8ea182c..b510c06126f 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -1299,6 +1299,66 @@ proc check_v3_target_gthreads { } {
return $et_gthreads
}
+proc check_v3_target_gthreads_timed { } {
+ global cxxflags
+ global DEFAULT_CXXFLAGS
+ global et_gthreads_timed
+
+ global tool
+
+ if { ![info exists et_gthreads_timed_target_name] } {
+ set et_gthreads_timed_target_name ""
+ }
+
+ # If the target has changed since we set the cached value, clear it.
+ set current_target [current_target_name]
+ if { $current_target != $et_gthreads_timed_target_name } {
+ verbose "check_v3_target_gthreads_timed: `$et_gthreads_timed_target_name'" 2
+ set et_gthreads_timed_target_name $current_target
+ if [info exists et_gthreads_timed] {
+ verbose "check_v3_target_gthreads_timed: removing cached result" 2
+ unset et_gthreads_timed
+ }
+ }
+
+ if [info exists et_gthreads_timed] {
+ verbose "check_v3_target_gthreads_timed: using cached result" 2
+ } else {
+ set et_gthreads_timed 0
+
+ # Set up and preprocess a C++0x test program that depends
+ # on the gthreads timed mutex facilities to be available.
+ set src gthreads_timed[pid].cc
+
+ set f [open $src "w"]
+ puts $f "#include <bits/c++config.h>"
+ puts $f "#ifndef _GLIBCXX_HAS_GTHREADS"
+ puts $f "# error No gthread"
+ puts $f "#endif"
+ puts $f "#if !_GTHREAD_USE_MUTEX_TIMEDLOCK"
+ puts $f "# error No gthread timed mutexes"
+ puts $f "#endif"
+ close $f
+
+ set cxxflags_saved $cxxflags
+ set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror"
+
+ set lines [v3_target_compile $src /dev/null preprocess ""]
+ set cxxflags $cxxflags_saved
+ file delete $src
+
+ if [string match "" $lines] {
+ # No error message, preprocessing succeeded.
+ set et_gthreads_timed 1
+ } else {
+ verbose "check_v3_target_gthreads_timed: compilation failed" 2
+ }
+ }
+ verbose "check_v3_target_gthreads_timed: $et_gthreads_timed" 2
+ return $et_gthreads_timed
+}
+
+
proc check_v3_target_nanosleep { } {
global cxxflags
global DEFAULT_CXXFLAGS