public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <Tom_deVries@mentor.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: [testsuite, committed] Test if host compiler supports -std=c++11 in ms-sysv.exp
Date: Tue, 30 May 2017 22:20:00 -0000	[thread overview]
Message-ID: <48432957-1126-012e-fef4-fc42bb64a053@mentor.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 161 bytes --]

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

[-- Attachment #2: 0001-Test-if-host-compiler-supports-std-c-11-in-ms-sysv.exp.patch --]
[-- Type: text/x-patch, Size: 2014 bytes --]

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

                 reply	other threads:[~2017-05-30 22:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48432957-1126-012e-fef4-fc42bb64a053@mentor.com \
    --to=tom_devries@mentor.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).