[testsuite,c-compat] Handle another c/l option not recognised by older GCC or clang.

Message ID 3ED2368F-937D-474A-A292-5804854ED03F@sandoe.co.uk
State New
Headers show
Series
  • [testsuite,c-compat] Handle another c/l option not recognised by older GCC or clang.
Related show

Commit Message

Iain Sandoe Oct. 29, 2018, 7:53 p.m.
Hi

When using ALT_CC/CXX_UNDER_TEST in the compat/struct-layout-1 tests, the c/l options provided to the “alt” compiler need to avoid latest and greatest GCC capability.  The patch tests to see if the ‘alt’ compiler can handle -fno-diagnostics-show-line-numbers.

OK for trunk?
thanks
Iain

gcc/testsuite/

	* lib/c-compat.exp (compat-use-alt-compiler): handle -fno-diagnostics-show-line-numbers.
	(compat_setup_dfp): Likewise.

Comments

Mike Stump Oct. 30, 2018, 5:13 p.m. | #1
On Oct 29, 2018, at 12:53 PM, Iain Sandoe <iain@sandoe.co.uk> wrote:
> 

> When using ALT_CC/CXX_UNDER_TEST in the compat/struct-layout-1 tests, the c/l options provided to the “alt” compiler need to avoid latest and greatest GCC capability.  The patch tests to see if the ‘alt’ compiler can handle -fno-diagnostics-show-line-numbers.

> 

> OK for trunk?


Ok.
Jeff Law Oct. 30, 2018, 7:09 p.m. | #2
On 10/29/18 1:53 PM, Iain Sandoe wrote:
> Hi

> 

> When using ALT_CC/CXX_UNDER_TEST in the compat/struct-layout-1 tests, the c/l options provided to the “alt” compiler need to avoid latest and greatest GCC capability.  The patch tests to see if the ‘alt’ compiler can handle -fno-diagnostics-show-line-numbers.

> 

> OK for trunk?

> thanks

> Iain

> 

> gcc/testsuite/

> 

> 	* lib/c-compat.exp (compat-use-alt-compiler): handle -fno-diagnostics-show-line-numbers.

> 	(compat_setup_dfp): Likewise.

OK
jeff

Patch

diff --git a/gcc/testsuite/lib/c-compat.exp b/gcc/testsuite/lib/c-compat.exp
index f021890..45aa80a 100644
--- a/gcc/testsuite/lib/c-compat.exp
+++ b/gcc/testsuite/lib/c-compat.exp
@@ -35,7 +35,7 @@  load_lib target-libpath.exp
 # 
 proc compat-use-alt-compiler { } {
     global GCC_UNDER_TEST ALT_CC_UNDER_TEST
-    global compat_same_alt compat_alt_caret compat_alt_color
+    global compat_same_alt compat_alt_caret compat_alt_color compat_no_line_no
     global TEST_ALWAYS_FLAGS
 
     # We don't need to do this if the alternate compiler is actually
@@ -48,6 +48,9 @@  proc compat-use-alt-compiler { } {
 	if { $compat_alt_color == 0 } then {
 	    regsub -- "-fdiagnostics-color=never" $TEST_ALWAYS_FLAGS "" TEST_ALWAYS_FLAGS
 	}
+	if { $compat_no_line_no == 0 } then {
+	    regsub -- "-fno-diagnostics-show-line-numbers" $TEST_ALWAYS_FLAGS "" TEST_ALWAYS_FLAGS
+	}
 	restore_gcc_exec_prefix_env_var
     }
 }
@@ -77,10 +80,12 @@  proc compat_setup_dfp { } {
     global compat_have_dfp
     global compat_alt_caret
     global compat_alt_color
+    global compat_no_line_no
     global TEST_ALWAYS_FLAGS compat_save_TEST_ALWAYS_FLAGS
 
     set compat_alt_caret 0
     set compat_alt_color 0
+    set compat_no_line_no 0
     set compat_save_TEST_ALWAYS_FLAGS $TEST_ALWAYS_FLAGS
 
     verbose "compat_setup_dfp: $compat_use_alt $compat_same_alt" 2
@@ -100,6 +105,11 @@  proc compat_setup_dfp { } {
 		int dummy; } "-fdiagnostics-color=never"] != 0 } {
 	    set compat_alt_color 1
 	}
+	if { [check_no_compiler_messages_nocache compat_alt_has_no_line_no object {
+		int dummy; } "-fno-diagnostics-show-line-numbers"] != 0 } {
+	    set compat_no_line_no 1
+	}
+	
 	compat-use-tst-compiler
     }