public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] Fix up compat.exp C testing
Date: Wed, 02 Jan 2013 12:58:00 -0000	[thread overview]
Message-ID: <20130102125818.GQ2315@tucnak.redhat.com> (raw)

Hi!

I've noticed when using ALT_CC_UNDER_TEST=gcc all compat.exp and
struct-layout-1.exp tests fail, because prune.exp adds
-fno-diagnostics-show-caret unconditionally, which is undesirable if
$ALT_CC_UNDER_TEST doesn't support that option (but of course desirable
if $ALT_CC_UNDER_TEST supports carets).
check-g++ compat.exp & struct-layout-1.exp don't suffer from this problem,
because they apparently clear ALWAYS_CXXFLAGS completely in their
compat-use-alt-compiler (which isn't right either, when testing say g++ 4.9
against 4.8 we will want to pass -fno-diagnostics-show-caret, and also
perhaps -fmessage-length=0 should be passed too conditionally depending on
whether alt g++ supports it or not).
Another thing is that ALT_*_UNDER_TEST testing doesn't work when testing
a compiler built with different prefix from the alt compiler, then the
problem is that GCC_RUN_PATH is put into environment.  Perhaps
compat-use-alt-compiler should remove GCC_RUN_PATH from environment and
compat-use-tst-compiler add it back if it was initially in the environment?

Anyway, this fixes the most urgent issue.  Ok for trunk?

2013-01-02  Jakub Jelinek  <jakub@redhat.com>

	* lib/c-compat.exp (compat-use-alt-compiler): Remove
	-fno-diagnostics-show-caret from TEST_ALWAYS_FLAGS if needed.
	(compat-use-tst-compiler): Restore TEST_ALWAYS_FLAGS.
	(compat_setup_dfp): Initialize compat_alt_caret and
	compat_save_TEST_ALWAYS_FLAGS.

--- gcc/testsuite/lib/c-compat.exp.jj	2009-02-20 15:43:09.000000000 +0100
+++ gcc/testsuite/lib/c-compat.exp	2013-01-02 13:41:28.595153560 +0100
@@ -1,4 +1,4 @@
-# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2013
 # Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -35,12 +35,16 @@ load_lib target-supports.exp
 # 
 proc compat-use-alt-compiler { } {
     global GCC_UNDER_TEST ALT_CC_UNDER_TEST
-    global compat_same_alt
+    global compat_same_alt compat_alt_caret
+    global TEST_ALWAYS_FLAGS
 
     # We don't need to do this if the alternate compiler is actually
     # the same as the compiler under test.
     if { $compat_same_alt == 0 } then {
 	set GCC_UNDER_TEST $ALT_CC_UNDER_TEST
+	if { $compat_alt_caret == 0 } then {
+	    regsub -- "-fno-diagnostics-show-caret" $TEST_ALWAYS_FLAGS "" TEST_ALWAYS_FLAGS
+	}
     }
 }
 
@@ -50,12 +54,14 @@ proc compat-use-alt-compiler { } {
 proc compat-use-tst-compiler { } {
     global GCC_UNDER_TEST compat_save_gcc_under_test
     global compat_same_alt
+    global TEST_ALWAYS_FLAGS compat_save_TEST_ALWAYS_FLAGS
 
     # We don't need to do this if the alternate compiler is actually
     # the same as the compiler under test.
 
     if { $compat_same_alt == 0 } then {
 	set GCC_UNDER_TEST $compat_save_gcc_under_test
+	set TEST_ALWAYS_FLAGS $compat_save_TEST_ALWAYS_FLAGS
     }
 }
 
@@ -64,6 +70,11 @@ proc compat_setup_dfp { } {
     global compat_use_alt
     global compat_same_alt
     global compat_have_dfp
+    global compat_alt_caret
+    global TEST_ALWAYS_FLAGS compat_save_TEST_ALWAYS_FLAGS
+
+    set compat_alt_caret 0
+    set compat_save_TEST_ALWAYS_FLAGS $TEST_ALWAYS_FLAGS
 
     verbose "compat_setup_dfp: $compat_use_alt $compat_same_alt" 2
 
@@ -72,6 +83,15 @@ proc compat_setup_dfp { } {
     set compat_have_dfp [check_effective_target_dfprt_nocache]
     verbose "compat_have_dfp for tst compiler: $compat_have_dfp" 2
 
+    if { $compat_use_alt == 1 && $compat_same_alt == 0 } {
+	compat-use-alt-compiler
+	if { [check_no_compiler_messages_nocache compat_alt_has_caret object {
+		int dummy; } "-fno-diagnostics-show-caret"] != 0 } {
+	    set compat_alt_caret 1
+	}
+	compat-use-tst-compiler
+    }
+
     # If there is an alternate compiler, does it support decimal float types?
     if { $compat_have_dfp == 1 && $compat_use_alt == 1 && $compat_same_alt == 0 } {
 	compat-use-alt-compiler

	Jakub

             reply	other threads:[~2013-01-02 12:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-02 12:58 Jakub Jelinek [this message]
2013-01-02 18:31 ` Mike Stump

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=20130102125818.GQ2315@tucnak.redhat.com \
    --to=jakub@redhat.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).