options.exp: unsupport tests that depend on missing language

There's a help.exp test that checks that the help message for
-Wabsolute-value mentions it's available in C and ObjC, when compiling
a C++ program.

However, if GCC is built with the C++ language disabled, the
.cc file is compiled as C, and the message [available in C...] becomes
[disabled] instead, because that's the default for the flag in C.

I suppose it might also be possible to disable the C language, and
then the multitude of help.exp tests that name c as the source
language will fail.

This patch avoids these fails: it detects the message "compiler not
installed" in the compiler output, and bails out as "unsupported".


for  gcc/testsuite/ChangeLog

	* lib/options.exp (check_for_options_with_filter): Detect
	unavailable compiler for the selected language, and bail out
	as unsupported.
This commit is contained in:
Alexandre Oliva 2020-12-02 22:10:26 -03:00 committed by Alexandre Oliva
parent 5106ff7e60
commit 93d883c773

View File

@ -59,6 +59,11 @@ proc check_for_options_with_filter { language gcc_options exclude \
set gcc_output [gcc_target_compile $srcfname $filebase.x executable $gcc_options] set gcc_output [gcc_target_compile $srcfname $filebase.x executable $gcc_options]
remote_file build delete $srcfname $filebase.x $filebase.gcno remote_file build delete $srcfname $filebase.x $filebase.gcno
if {[regexp -- "compiler not installed on this system" $gcc_output]} {
unsupported "$test: $language compiler not available"
return
}
if { $exclude != "" } { if { $exclude != "" } {
set lines [split $gcc_output "\n"] set lines [split $gcc_output "\n"]
set gcc_output "" set gcc_output ""