[PATCH][libstc++v3]Add new dg-require-thread-fence directive.
libstdc++-v3/ 2015-04-22 Renlin Li <renlin.li@arm.com> * testsuite/lib/dg-options.exp (dg-require-thread-fence): New. * testsuite/lib/libstdc++.exp (check_v3_target_thread_fence): New. * testsuite/29_atomics/atomic_flag/clear/1.cc: Use it. * testsuite/29_atomics/atomic_flag/test_and_set/explicit.cc: Likewise. * testsuite/29_atomics/atomic_flag/test_and_set/implicit.cc: Likewise. From-SVN: r222324
This commit is contained in:
parent
860503d8cc
commit
04934297b8
@ -1,3 +1,11 @@
|
||||
2015-04-22 Renlin Li <renlin.li@arm.com>
|
||||
|
||||
* testsuite/lib/dg-options.exp (dg-require-thread-fence): New.
|
||||
* testsuite/lib/libstdc++.exp (check_v3_target_thread_fence): New.
|
||||
* testsuite/29_atomics/atomic_flag/clear/1.cc: Use it.
|
||||
* testsuite/29_atomics/atomic_flag/test_and_set/explicit.cc: Likewise.
|
||||
* testsuite/29_atomics/atomic_flag/test_and_set/implicit.cc: Likewise.
|
||||
|
||||
2015-04-21 Jonathan Wakely <jwakely@redhat.com>
|
||||
|
||||
* doc/xml/manual/configure.xml: Update descriptions of options
|
||||
|
@ -1,4 +1,5 @@
|
||||
// { dg-options "-std=gnu++11" }
|
||||
// { dg-require-thread-fence "" }
|
||||
|
||||
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
|
@ -1,4 +1,5 @@
|
||||
// { dg-options "-std=gnu++11" }
|
||||
// { dg-require-thread-fence "" }
|
||||
|
||||
// Copyright (C) 2008-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
|
@ -1,4 +1,5 @@
|
||||
// { dg-options "-std=gnu++11" }
|
||||
// { dg-require-thread-fence "" }
|
||||
|
||||
// Copyright (C) 2008-2015 Free Software Foundation, Inc.
|
||||
//
|
||||
|
@ -115,6 +115,15 @@ proc dg-require-cmath { args } {
|
||||
return
|
||||
}
|
||||
|
||||
proc dg-require-thread-fence { args } {
|
||||
if { ![ check_v3_target_thread_fence ] } {
|
||||
upvar dg-do-what dg-do-what
|
||||
set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
proc dg-require-atomic-builtins { args } {
|
||||
if { ![ check_v3_target_atomic_builtins ] } {
|
||||
upvar dg-do-what dg-do-what
|
||||
|
@ -1221,6 +1221,62 @@ proc check_v3_target_cmath { } {
|
||||
return $et_c99_math
|
||||
}
|
||||
|
||||
proc check_v3_target_thread_fence { } {
|
||||
global cxxflags
|
||||
global DEFAULT_CXXFLAGS
|
||||
global et_thread_fence
|
||||
|
||||
global tool
|
||||
|
||||
if { ![info exists et_thread_fence_target_name] } {
|
||||
set et_thread_fence_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_thread_fence_target_name } {
|
||||
verbose "check_v3_target_thread_fence: `$et_thread_fence_target_name'" 2
|
||||
set et_thread_fence_target_name $current_target
|
||||
if [info exists et_thread_fence] {
|
||||
verbose "check_v3_target_thread_fence: removing cached result" 2
|
||||
unset et_thread_fence
|
||||
}
|
||||
}
|
||||
|
||||
if [info exists et_thread_fence] {
|
||||
verbose "check_v3_target_thread_fence: using cached result" 2
|
||||
} else {
|
||||
set et_thread_fence 0
|
||||
|
||||
# Set up and preprocess a C++11 test program that depends
|
||||
# on the thread fence to be available.
|
||||
set src thread_fence[pid].cc
|
||||
|
||||
set f [open $src "w"]
|
||||
puts $f "int main() {"
|
||||
puts $f "__atomic_thread_fence (__ATOMIC_SEQ_CST);"
|
||||
puts $f "return 0;"
|
||||
puts $f "}"
|
||||
close $f
|
||||
|
||||
set cxxflags_saved $cxxflags
|
||||
set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror -std=gnu++11"
|
||||
|
||||
set lines [v3_target_compile $src /dev/null executable ""]
|
||||
set cxxflags $cxxflags_saved
|
||||
file delete $src
|
||||
|
||||
if [string match "" $lines] {
|
||||
# No error message, linking succeeded.
|
||||
set et_thread_fence 1
|
||||
} else {
|
||||
verbose "check_v3_target_thread_fence: compilation failed" 2
|
||||
}
|
||||
}
|
||||
verbose "check_v3_target_thread_fence: $et_thread_fence" 2
|
||||
return $et_thread_fence
|
||||
}
|
||||
|
||||
proc check_v3_target_atomic_builtins { } {
|
||||
global cxxflags
|
||||
global DEFAULT_CXXFLAGS
|
||||
|
Loading…
Reference in New Issue
Block a user