This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[testsuite, committed] Test if host compiler supports -std=c++11 in ms-sysv.exp


Hi,

this patch adds a test to see if the host compiler supports -std=c++11 in ms-sysv.exp, and if not marks ms-sysv as unsupported.

Committed.

Thanks,
- Tom
Test if host compiler supports -std=c++11 in ms-sysv.exp

2017-05-30  Tom de Vries  <tom@codesourcery.com>

	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.

---
 .../gcc.target/x86_64/abi/ms-sysv/ms-sysv.exp      | 36 ++++++++++++++++++++--
 1 file changed, 33 insertions(+), 3 deletions(-)

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
 # <http://www.gnu.org/licenses/>.
 
+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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]