From bcce980ef4e8223685ba4a05f0b9cc8f189aacdf Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Tue, 30 May 2017 22:00:57 +0000 Subject: [PATCH] Test if host compiler supports -std=c++11 in ms-sysv.exp 2017-05-30 Tom de Vries PR testsuite/80910 * gcc.target/x86_64/abi/ms-sysv/ms-sysv.exp: Exit with status unsupported if host compiler does not support c++11. (host_supports_c++11): New proc. From-SVN: r248701 --- gcc/testsuite/ChangeLog | 7 +++++ .../gcc.target/x86_64/abi/ms-sysv/ms-sysv.exp | 36 ++++++++++++++++++++-- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1754a38..1e8c11b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2017-05-30 Tom de Vries + + PR testsuite/80910 + * gcc.target/x86_64/abi/ms-sysv/ms-sysv.exp: Exit with status + unsupported if host compiler does not support c++11. + (host_supports_c++11): New proc. + 2017-05-30 Martin Sebor PR c/80731 diff --git a/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.exp b/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.exp index e317af9..26777e0 100644 --- a/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.exp +++ b/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.exp @@ -23,17 +23,47 @@ # see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # . +load_lib gcc-dg.exp + +proc host_supports_c++11 {} { + global HOSTCXX HOSTCXXFLAGS + + set pidstr [pid] + set src "host_supports_c++11_$pidstr.C" + set asm "host_supports_c++11_$pidstr.s" + + set f [open $src "w"] + puts $f "" + close $f + + set cxx "$HOSTCXX $HOSTCXXFLAGS" + + # Temporarily switch to the environment for the host compiler. + restore_ld_library_path_env_vars + set status [remote_exec host "$cxx -S $src -std=c++11 -o $asm"] + # And switch back. + set_ld_library_path_env_vars + + file delete $src $asm + + set status [lindex $status 0] + if { $status != 0 } { + return 0 + } + + return 1 +} + # Exit immediately if this isn't a native x86_64 target. if { (![istarget x86_64-*-*] && ![istarget i?86-*-*]) - || ![is-effective-target lp64] || ![isnative] } then { + || ![is-effective-target lp64] || ![isnative] + || ![host_supports_c++11] } then { unsupported "$subdir" return } global GCC_RUNTEST_PARALLELIZE_DIR -load_lib gcc-dg.exp - proc runtest_ms_sysv { cflags generator_args } { global GCC_UNDER_TEST HOSTCXX HOSTCXXFLAGS tmpdir srcdir subdir \ parallel_dir next_test -- 2.7.4