Patchwork Fix up compat.exp C testing

login
register
mail settings
Submitter Jakub Jelinek
Date Jan. 2, 2013, 12:58 p.m.
Message ID <20130102125818.GQ2315@tucnak.redhat.com>
Download mbox | patch
Permalink /patch/209040/
State New
Headers show

Comments

Jakub Jelinek - Jan. 2, 2013, 12:58 p.m.
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.


	Jakub
Mike Stump - Jan. 2, 2013, 6:31 p.m.
On Jan 2, 2013, at 4:58 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> Anyway, this fixes the most urgent issue.  Ok for trunk?

Ok.  If you find any breakage in the patch and need to fix it, ok for that as well.  :-o

For a fun time, compat testing clang and gcc would be a curious test.

> 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.

Patch

--- 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