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

Regstrapped on x86_64-linux-gnu; also tested with a cross compiler to
arm-eabi with C++ disabled.  Ok to install?


for  gcc/testsuite/ChangeLog

        * lib/options.exp (check_for_options_with_filter): Detect
        unavailable compiler for the selected language, and bail out
        as unsupported.
---
 gcc/testsuite/lib/options.exp |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/testsuite/lib/options.exp b/gcc/testsuite/lib/options.exp
index c7f7316943e41..7700144fd440b 100644
--- a/gcc/testsuite/lib/options.exp
+++ b/gcc/testsuite/lib/options.exp
@@ -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]
     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 != "" } {
        set lines [split $gcc_output "\n"]
        set gcc_output ""


-- 
Alexandre Oliva, happy hacker  https://FSFLA.org/blogs/lxo/
   Free Software Activist         GNU Toolchain Engineer
        Vim, Vi, Voltei pro Emacs -- GNUlius Caesar

Reply via email to