Define "random_device" effective target
Currently only matches targets where _GLIBCXX_USE_RANDOM_TR1 is defined, which means /dev/random and /dev/urandom are usable. * testsuite/25_algorithms/make_heap/complexity.cc: Require effective target for std::random_device. * testsuite/26_numerics/random/random_device/cons/default.cc: Likewise. * testsuite/experimental/algorithm/sample-2.cc: Likewise. * testsuite/experimental/algorithm/shuffle.cc: Likewise. * testsuite/experimental/random/randint.cc: Likewise. * testsuite/lib/libstdc++.exp (check_effective_target_random_device): New proc. From-SVN: r262415
This commit is contained in:
parent
4e4120a27a
commit
89bc4ab198
|
@ -1,3 +1,15 @@
|
|||
2018-07-04 Jonathan Wakely <jwakely@redhat.com>
|
||||
|
||||
* testsuite/25_algorithms/make_heap/complexity.cc: Require effective
|
||||
target for std::random_device.
|
||||
* testsuite/26_numerics/random/random_device/cons/default.cc:
|
||||
Likewise.
|
||||
* testsuite/experimental/algorithm/sample-2.cc: Likewise.
|
||||
* testsuite/experimental/algorithm/shuffle.cc: Likewise.
|
||||
* testsuite/experimental/random/randint.cc: Likewise.
|
||||
* testsuite/lib/libstdc++.exp
|
||||
(check_effective_target_random_device): New proc.
|
||||
|
||||
2018-07-04 Jonathan Wakely <jwakely@redhat.com>
|
||||
Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// { dg-do run { target c++11 } }
|
||||
// { dg-require-effective-target random_device }
|
||||
|
||||
#include <random>
|
||||
#include <vector>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// { dg-do run { target c++11 } }
|
||||
// { dg-require-effective-target random_device }
|
||||
// { dg-require-cstdint "" }
|
||||
//
|
||||
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// { dg-do run { target c++14 } }
|
||||
// { dg-require-effective-target random_device }
|
||||
// { dg-require-effective-target tls_runtime }
|
||||
// { dg-add-options tls }
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// { dg-do run { target c++14 } }
|
||||
// { dg-require-effective-target random_device }
|
||||
// { dg-require-effective-target tls_runtime }
|
||||
// { dg-add-options tls }
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// { dg-do run { target c++14 } }
|
||||
// { dg-require-effective-target random_device }
|
||||
// { dg-require-effective-target tls_runtime }
|
||||
// { dg-add-options tls }
|
||||
|
||||
|
|
|
@ -2061,6 +2061,34 @@ proc check_effective_target_cxx11-abi { } {
|
|||
return 0
|
||||
}
|
||||
|
||||
# Return 1 if std::random_device should be usable using the current flags, 0 otherwise.
|
||||
proc check_effective_target_random_device { } {
|
||||
global cxxflags
|
||||
|
||||
# Set up and preprocess a C++ test program that depends
|
||||
# on std::random_device being usable.
|
||||
set src random_device[pid].cc
|
||||
|
||||
set f [open $src "w"]
|
||||
puts $f "#include <bits/c++config.h>"
|
||||
puts $f "#if ! _GLIBCXX_USE_RANDOM_TR1"
|
||||
puts $f "# error No working std::random_device available"
|
||||
puts $f "#endif"
|
||||
close $f
|
||||
|
||||
set lines [v3_target_compile $src /dev/null preprocess ""]
|
||||
file delete $src
|
||||
|
||||
if [string match "" $lines] {
|
||||
# No error message, preprocessing succeeded.
|
||||
verbose "check_v3_random_device: `1'" 2
|
||||
return 1
|
||||
}
|
||||
|
||||
verbose "check_v3_random_device: `0'" 2
|
||||
return 0
|
||||
}
|
||||
|
||||
set additional_prunes ""
|
||||
|
||||
if { [info exists env(GCC_RUNTEST_PARALLELIZE_DIR)] \
|
||||
|
|
Loading…
Reference in New Issue