]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add '-Wno-complain-wrong-lang', and use it in 'gcc/testsuite/lib/target-supports...
authorThomas Schwinge <thomas@codesourcery.com>
Wed, 14 Dec 2022 16:16:42 +0000 (17:16 +0100)
committerThomas Schwinge <thomas@codesourcery.com>
Wed, 22 Feb 2023 08:19:51 +0000 (09:19 +0100)
I noticed that GCC/Rust recently lost all LTO variants in torture testing:

     PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O0  (test for excess errors)
     PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O1  (test for excess errors)
     PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O2  (test for excess errors)
    -PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O2 -flto -fno-use-linker-plugin -flto-partition=none  (test for excess errors)
    -PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  (test for excess errors)
     PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O3 -g  (test for excess errors)
     PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -Os  (test for excess errors)

Etc.

The reason is that when probing for availability of LTO, we run into:

    spawn [...]/build-gcc/gcc/testsuite/rust/../../gccrs -B[...]/build-gcc/gcc/testsuite/rust/../../ -fdiagnostics-plain-output -frust-incomplete-and-experimental-compiler-do-not-use -flto -c -o lto8274.o lto8274.c
    cc1: warning: command-line option '-frust-incomplete-and-experimental-compiler-do-not-use' is valid for Rust but not for C

For GCC/Rust testing, this flag is (as of recently) defaulted in
'gcc/testsuite/lib/rust.exp:rust_init':

    lappend ALWAYS_RUSTFLAGS "additional_flags=-frust-incomplete-and-experimental-compiler-do-not-use"

A few more "command-line option [...] is valid for [...] but not for [...]"
instances were found in the test suite logs, when more than one language is
involved.

With '-Wno-complain-wrong-lang' used in
'gcc/testsuite/lib/target-supports.exp:check_compile', we get back:

     PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O0  (test for excess errors)
     PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O1  (test for excess errors)
     PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O2  (test for excess errors)
    +PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O2 -flto -fno-use-linker-plugin -flto-partition=none  (test for excess errors)
    +PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  (test for excess errors)
     PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O3 -g  (test for excess errors)
     PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -Os  (test for excess errors)

Etc., and in total:

                    === rust Summary for unix ===

    # of expected passes            [-4990-]{+6718+}
    # of expected failures          [-39-]{+51+}

Anything that 'gcc/opts-global.cc:complain_wrong_lang' might do is cut
short by '-Wno-complain-wrong-lang', not just the one 'warning'
diagnostic.  This corresponds to what already exists via
'lang_hooks.complain_wrong_lang_p'.

The 'gcc/opts-common.cc:prune_options' changes follow the same rationale
as PR67640 "driver passes -fdiagnostics-color= always last": we need to
process '-Wno-complain-wrong-lang' early, so that it properly affects
other options appearing before it on the command line.

gcc/
* common.opt (-Wcomplain-wrong-lang): New.
* doc/invoke.texi (-Wno-complain-wrong-lang): Document it.
* opts-common.cc (prune_options): Handle it.
* opts-global.cc (complain_wrong_lang): Use it.
gcc/testsuite/
* gcc.dg/Wcomplain-wrong-lang-1.c: New.
* gcc.dg/Wcomplain-wrong-lang-2.c: Likewise.
* gcc.dg/Wcomplain-wrong-lang-3.c: Likewise.
* gcc.dg/Wcomplain-wrong-lang-4.c: Likewise.
* gcc.dg/Wcomplain-wrong-lang-5.c: Likewise.
* lib/target-supports.exp (check_compile): Use
'-Wno-complain-wrong-lang'.
* g++.dg/abi/empty12.C: Likewise.
* g++.dg/abi/empty13.C: Likewise.
* g++.dg/abi/empty14.C: Likewise.
* g++.dg/abi/empty15.C: Likewise.
* g++.dg/abi/empty16.C: Likewise.
* g++.dg/abi/empty17.C: Likewise.
* g++.dg/abi/empty18.C: Likewise.
* g++.dg/abi/empty19.C: Likewise.
* g++.dg/abi/empty22.C: Likewise.
* g++.dg/abi/empty25.C: Likewise.
* g++.dg/abi/empty26.C: Likewise.
* gfortran.dg/bind-c-contiguous-1.f90: Likewise.
* gfortran.dg/bind-c-contiguous-4.f90: Likewise.
* gfortran.dg/bind-c-contiguous-5.f90: Likewise.
libgomp/
* testsuite/libgomp.fortran/alloc-10.f90: Use
'-Wno-complain-wrong-lang'.
* testsuite/libgomp.fortran/alloc-11.f90: Likewise.
* testsuite/libgomp.fortran/alloc-7.f90: Likewise.
* testsuite/libgomp.fortran/alloc-9.f90: Likewise.
* testsuite/libgomp.fortran/allocate-1.f90: Likewise.
* testsuite/libgomp.fortran/depend-4.f90: Likewise.
* testsuite/libgomp.fortran/depend-5.f90: Likewise.
* testsuite/libgomp.fortran/depend-6.f90: Likewise.
* testsuite/libgomp.fortran/depend-7.f90: Likewise.
* testsuite/libgomp.fortran/depend-inoutset-1.f90: Likewise.
* testsuite/libgomp.fortran/examples-4/declare_target-1.f90:
Likewise.
* testsuite/libgomp.fortran/examples-4/declare_target-2.f90:
Likewise.
* testsuite/libgomp.fortran/order-reproducible-1.f90: Likewise.
* testsuite/libgomp.fortran/order-reproducible-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/parallel-dims.f90: Likewise.
* testsuite/libgomp.fortran/task-detach-6.f90: Remove left-over
'dg-prune-output'.

40 files changed:
gcc/common.opt
gcc/doc/invoke.texi
gcc/opts-common.cc
gcc/opts-global.cc
gcc/testsuite/g++.dg/abi/empty12.C
gcc/testsuite/g++.dg/abi/empty13.C
gcc/testsuite/g++.dg/abi/empty14.C
gcc/testsuite/g++.dg/abi/empty15.C
gcc/testsuite/g++.dg/abi/empty16.C
gcc/testsuite/g++.dg/abi/empty17.C
gcc/testsuite/g++.dg/abi/empty18.C
gcc/testsuite/g++.dg/abi/empty19.C
gcc/testsuite/g++.dg/abi/empty22.C
gcc/testsuite/g++.dg/abi/empty25.C
gcc/testsuite/g++.dg/abi/empty26.C
gcc/testsuite/gcc.dg/Wcomplain-wrong-lang-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wcomplain-wrong-lang-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wcomplain-wrong-lang-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wcomplain-wrong-lang-4.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wcomplain-wrong-lang-5.c [new file with mode: 0644]
gcc/testsuite/gfortran.dg/bind-c-contiguous-1.f90
gcc/testsuite/gfortran.dg/bind-c-contiguous-4.f90
gcc/testsuite/gfortran.dg/bind-c-contiguous-5.f90
gcc/testsuite/lib/target-supports.exp
libgomp/testsuite/libgomp.fortran/alloc-10.f90
libgomp/testsuite/libgomp.fortran/alloc-11.f90
libgomp/testsuite/libgomp.fortran/alloc-7.f90
libgomp/testsuite/libgomp.fortran/alloc-9.f90
libgomp/testsuite/libgomp.fortran/allocate-1.f90
libgomp/testsuite/libgomp.fortran/depend-4.f90
libgomp/testsuite/libgomp.fortran/depend-5.f90
libgomp/testsuite/libgomp.fortran/depend-6.f90
libgomp/testsuite/libgomp.fortran/depend-7.f90
libgomp/testsuite/libgomp.fortran/depend-inoutset-1.f90
libgomp/testsuite/libgomp.fortran/examples-4/declare_target-1.f90
libgomp/testsuite/libgomp.fortran/examples-4/declare_target-2.f90
libgomp/testsuite/libgomp.fortran/order-reproducible-1.f90
libgomp/testsuite/libgomp.fortran/order-reproducible-2.f90
libgomp/testsuite/libgomp.fortran/task-detach-6.f90
libgomp/testsuite/libgomp.oacc-fortran/parallel-dims.f90

index d0371aec8db5f7736b42d464e916ad79604f9b33..50bcc523fd2b2aa7e267985d3cce9040dadf74a3 100644 (file)
@@ -582,6 +582,10 @@ Wcast-align=strict
 Common Var(warn_cast_align,2) Warning
 Warn about pointer casts which increase alignment.
 
+Wcomplain-wrong-lang
+Common Var(warn_complain_wrong_lang) Init(1) Warning
+Complain when a command-line option is valid, but not applicable to the current front end.
+
 Wcpp
 Common Var(warn_cpp) Init(1) Warning
 Warn when a #warning directive is encountered.
index bcf8510945b105fb84f62e360b0d490e7b6f8b13..a7ec1a99385a7f59b15f95007b96605a29a4d321 100644 (file)
@@ -343,6 +343,7 @@ Objective-C and Objective-C++ Dialects}.
 -Wcast-align  -Wcast-align=strict  -Wcast-function-type  -Wcast-qual  @gol
 -Wchar-subscripts @gol
 -Wclobbered  -Wcomment @gol
+-Wno-complain-wrong-lang @gol
 -Wconversion  -Wno-coverage-mismatch  -Wno-cpp @gol
 -Wdangling-else  -Wdangling-pointer  -Wdangling-pointer=@var{n}  @gol
 -Wdate-time @gol
@@ -8944,6 +8945,25 @@ programs.
 Warn for variables that might be changed by @code{longjmp} or
 @code{vfork}.  This warning is also enabled by @option{-Wextra}.
 
+@item -Wno-complain-wrong-lang
+@opindex Wcomplain-wrong-lang
+@opindex Wno-complain-wrong-lang
+By default, language front ends complain when a command-line option is
+valid, but not applicable to that front end.
+This may be disabled with @option{-Wno-complain-wrong-lang},
+which is mostly useful when invoking a single compiler driver for
+multiple source files written in different languages, for example:
+
+@smallexample
+$ g++ -fno-rtti a.cc b.f90
+@end smallexample
+
+The driver @file{g++} invokes the C++ front end to compile @file{a.cc}
+and the Fortran front end to compile @file{b.f90}.
+The latter front end diagnoses
+@samp{f951: Warning: command-line option '-fno-rtti' is valid for C++/D/ObjC++ but not for Fortran},
+which may be disabled with @option{-Wno-complain-wrong-lang}.
+
 @item -Wconversion
 @opindex Wconversion
 @opindex Wno-conversion
index c3ede438ac025e9d031f92aa2872f68186290d25..23ddcaa3b55d028982b4ec07b3bd33eca7963ef7 100644 (file)
@@ -1112,7 +1112,8 @@ cancel_option (int opt_idx, int next_opt_idx, int orig_next_opt_idx)
   return false;
 }
 
-/* Filter out options canceled by the ones after them.  */
+/* Filter out options canceled by the ones after them, and related
+   rearrangement.  */
 
 static void
 prune_options (struct cl_decoded_option **decoded_options,
@@ -1125,6 +1126,8 @@ prune_options (struct cl_decoded_option **decoded_options,
     = XNEWVEC (struct cl_decoded_option, old_decoded_options_count);
   unsigned int i;
   const struct cl_option *option;
+  unsigned int options_to_prepend = 0;
+  unsigned int Wcomplain_wrong_lang_idx = 0;
   unsigned int fdiagnostics_color_idx = 0;
 
   /* Remove arguments which are negated by others after them.  */
@@ -1146,8 +1149,17 @@ prune_options (struct cl_decoded_option **decoded_options,
        case OPT_SPECIAL_input_file:
          goto keep;
 
-       /* Do not save OPT_fdiagnostics_color_, just remember the last one.  */
+       /* Do not handle the following yet, just remember the last one.  */
+       case OPT_Wcomplain_wrong_lang:
+         gcc_checking_assert (i != 0);
+         if (Wcomplain_wrong_lang_idx == 0)
+           ++options_to_prepend;
+         Wcomplain_wrong_lang_idx = i;
+         continue;
        case OPT_fdiagnostics_color_:
+         gcc_checking_assert (i != 0);
+         if (fdiagnostics_color_idx == 0)
+           ++options_to_prepend;
          fdiagnostics_color_idx = i;
          continue;
 
@@ -1191,15 +1203,29 @@ keep:
        }
     }
 
-  if (fdiagnostics_color_idx >= 1)
+  /* For those not yet handled, put (only) the last at a front position after
+     'argv[0]', so they can take effect immediately.  */
+  if (options_to_prepend)
     {
-      /* We put the last -fdiagnostics-color= at the first position
-        after argv[0] so it can take effect immediately.  */
-      memmove (new_decoded_options + 2, new_decoded_options + 1,
-              sizeof (struct cl_decoded_option) 
-              * (new_decoded_options_count - 1));
-      new_decoded_options[1] = old_decoded_options[fdiagnostics_color_idx];
-      new_decoded_options_count++;
+      const unsigned int argv_0 = 1;
+      memmove (new_decoded_options + argv_0 + options_to_prepend,
+              new_decoded_options + argv_0,
+              sizeof (struct cl_decoded_option)
+              * (new_decoded_options_count - argv_0));
+      unsigned int options_prepended = 0;
+      if (Wcomplain_wrong_lang_idx != 0)
+       {
+         new_decoded_options[argv_0 + options_prepended++]
+           = old_decoded_options[Wcomplain_wrong_lang_idx];
+         new_decoded_options_count++;
+       }
+      if (fdiagnostics_color_idx != 0)
+       {
+         new_decoded_options[argv_0 + options_prepended++]
+           = old_decoded_options[fdiagnostics_color_idx];
+         new_decoded_options_count++;
+       }
+      gcc_checking_assert (options_to_prepend == options_prepended);
     }
 
   free (old_decoded_options);
index d07838490fd378d71949461efa089cf9cdf4a48a..b7bba23a3235f7d04b88d88b674bacd23c12940d 100644 (file)
@@ -91,6 +91,9 @@ complain_wrong_lang (const struct cl_decoded_option *decoded,
   char *ok_langs = NULL, *bad_lang = NULL;
   unsigned int opt_flags = option->flags;
 
+  if (!warn_complain_wrong_lang)
+    return;
+
   if (!lang_hooks.complain_wrong_lang_p (option))
     return;
 
index 6568fc6202c78ca7bb30d98ec35d26ec53a31c64..6d67f8d5519b35ddde2ea9cda672379e7474132f 100644 (file)
@@ -2,7 +2,7 @@
 // { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } }
 // { dg-options "-Wabi=11 -x c" }
 // { dg-additional-sources "empty12a.c" }
-// { dg-prune-output "command-line option" }
+// { dg-additional-options -Wno-complain-wrong-lang }
 
 #include "empty12.h"
 extern "C" void fun(struct dummy, struct foo);
index 9ec188760c72680c1f1e17037578026c058d9920..47f1d7367a4221fe8a26c27cc44c4de86ba0b4c9 100644 (file)
@@ -2,7 +2,7 @@
 // { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } }
 // { dg-options "-x c -fabi-version=11" }
 // { dg-additional-sources "empty13a.c" }
-// { dg-prune-output "command-line option" }
+// { dg-additional-options -Wno-complain-wrong-lang }
 
 #include "empty13.h"
 extern "C" void fun(struct dummy, struct foo);
index 7deb463f5e4810c03882addb400f22f2b7951299..8881bebf87b1d6c7dc8fd08df85e2d10fb675d70 100644 (file)
@@ -2,7 +2,7 @@
 // { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } }
 // { dg-options "-Wabi=11 -x c" }
 // { dg-additional-sources "empty14a.c" }
-// { dg-prune-output "command-line option" }
+// { dg-additional-options -Wno-complain-wrong-lang }
 
 #include "empty14.h"
 extern "C" void fun(struct dummy, struct foo);
index fd36194b459e59d746ac99029232b42fb933d68b..2474911c5bb1c34c5cd25cb1e71998a47134c775 100644 (file)
@@ -2,7 +2,7 @@
 // { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } }
 // { dg-options "-Wabi=11 -x c" }
 // { dg-additional-sources "empty15a.c" }
-// { dg-prune-output "command-line option" }
+// { dg-additional-options -Wno-complain-wrong-lang }
 
 #include "empty15.h"
 extern "C" void fun(struct dummy, struct foo);
index 024b00e74327ac6406b1c481724c76b89b243725..6db82a25620cc70a8c44d29774d6de45a9bbeb08 100644 (file)
@@ -2,7 +2,7 @@
 // { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } }
 // { dg-options "-Wabi=11 -x c" }
 // { dg-additional-sources "empty16a.c" }
-// { dg-prune-output "command-line option" }
+// { dg-additional-options -Wno-complain-wrong-lang }
 
 #include "empty16.h"
 extern "C" void fun(struct dummy, struct foo);
index a6e58fa4d5f822908d7ce15965f434662ac2c7ae..26f3d774715d6a519647e7faeb728b17f24aeaa5 100644 (file)
@@ -2,7 +2,7 @@
 // { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } }
 // { dg-options "-Wabi=11 -x c" }
 // { dg-additional-sources "empty17a.c" }
-// { dg-prune-output "command-line option" }
+// { dg-additional-options -Wno-complain-wrong-lang }
 
 #include "empty17.h"
 extern "C" void fun(struct dummy, struct foo);
index 6e64dae8d47ecccc38b99c9eb6259419f23a12a1..02e41cad394b23c51e00ea6b19ea1b66cae34f6b 100644 (file)
@@ -2,7 +2,7 @@
 // { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } }
 // { dg-options "-Wabi=11 -x c" }
 // { dg-additional-sources "empty18a.c" }
-// { dg-prune-output "command-line option" }
+// { dg-additional-options -Wno-complain-wrong-lang }
 
 #include "empty18.h"
 extern "C" void fun(struct dummy, struct foo);
index 8707db86be66e27c3c060e9f1dafdbaf04737fdf..89b92f11469b333addf6dbe4ef5e623f8f81b4cf 100644 (file)
@@ -2,7 +2,7 @@
 // { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } }
 // { dg-options "-Wabi=11 -x c" }
 // { dg-additional-sources "empty19a.c" }
-// { dg-prune-output "command-line option" }
+// { dg-additional-options -Wno-complain-wrong-lang }
 
 #include "empty19.h"
 extern "C" void fun(struct dummy, struct foo);
index d3720f86fdebf8dc6f5327976b807f6cecfa8cb4..1502ea01d12cdc15f5351d16de876216bb8ab272 100644 (file)
@@ -2,7 +2,7 @@
 // { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } }
 // { dg-options "-Wabi=11 -x c" }
 // { dg-additional-sources "empty22a.c" }
-// { dg-prune-output "command-line option" }
+// { dg-additional-options -Wno-complain-wrong-lang }
 
 #include "empty22.h"
 extern "C" void fun(struct dummy, struct foo);
index 50a4c266ca00653112af6f6f6ed827cb9a68bef3..bfbaa837760caee06d2e92290dcdf9b55e1a52eb 100644 (file)
@@ -2,7 +2,7 @@
 // { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } }
 // { dg-options "-Wabi=11 -x c" }
 // { dg-additional-sources "empty25a.c" }
-// { dg-prune-output "command-line option" }
+// { dg-additional-options -Wno-complain-wrong-lang }
 
 #include "empty25.h"
 extern "C" void fun(struct dummy, struct foo);
index 785cdc7d9743092203e8a70f2f6d149c80e2b502..3a27bf69b15183bb769a3902adaa12778579def1 100644 (file)
@@ -2,7 +2,7 @@
 // { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } }
 // { dg-options "-Wabi=11 -x c" }
 // { dg-additional-sources "empty26a.c" }
-// { dg-prune-output "command-line option" }
+// { dg-additional-options -Wno-complain-wrong-lang }
 
 #include "empty26.h"
 extern "C" void fun(struct dummy, struct foo);
diff --git a/gcc/testsuite/gcc.dg/Wcomplain-wrong-lang-1.c b/gcc/testsuite/gcc.dg/Wcomplain-wrong-lang-1.c
new file mode 100644 (file)
index 0000000..71016e0
--- /dev/null
@@ -0,0 +1,2 @@
+/* { dg-options -Wctad-maybe-unsupported } and '-Wcomplain-wrong-lang' enabled by default:
+   { dg-warning {command-line option '-Wctad-maybe-unsupported' is valid for C\+\+/ObjC\+\+ but not for C} {} { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/Wcomplain-wrong-lang-2.c b/gcc/testsuite/gcc.dg/Wcomplain-wrong-lang-2.c
new file mode 100644 (file)
index 0000000..ba2192d
--- /dev/null
@@ -0,0 +1,2 @@
+/* { dg-options {-Wcomplain-wrong-lang -Wctad-maybe-unsupported} }
+   { dg-warning {command-line option '-Wctad-maybe-unsupported' is valid for C\+\+/ObjC\+\+ but not for C} {} { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/Wcomplain-wrong-lang-3.c b/gcc/testsuite/gcc.dg/Wcomplain-wrong-lang-3.c
new file mode 100644 (file)
index 0000000..36bf748
--- /dev/null
@@ -0,0 +1,2 @@
+/* { dg-options {-Wctad-maybe-unsupported -Wno-complain-wrong-lang} }
+   { dg-bogus {command-line option '-Wctad-maybe-unsupported' is valid for C\+\+/ObjC\+\+ but not for C} {} { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/Wcomplain-wrong-lang-4.c b/gcc/testsuite/gcc.dg/Wcomplain-wrong-lang-4.c
new file mode 100644 (file)
index 0000000..af185f8
--- /dev/null
@@ -0,0 +1,2 @@
+/* { dg-options {-Wno-complain-wrong-lang -Wctad-maybe-unsupported} }
+   { dg-bogus {command-line option '-Wctad-maybe-unsupported' is valid for C\+\+/ObjC\+\+ but not for C} {} { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/Wcomplain-wrong-lang-5.c b/gcc/testsuite/gcc.dg/Wcomplain-wrong-lang-5.c
new file mode 100644 (file)
index 0000000..dc0a42c
--- /dev/null
@@ -0,0 +1,2 @@
+/* { dg-options {-Wcomplain-wrong-lang -Wctad-maybe-unsupported -Wno-complain-wrong-lang} }
+   { dg-bogus {command-line option '-Wctad-maybe-unsupported' is valid for C\+\+/ObjC\+\+ but not for C} {} { target *-*-* } 0 } */
index 975f74b062728f2f2e989d662ac263bb84984e7a..d638dbbef252bc8a291cd67983e71280ca714f7a 100644 (file)
@@ -1,7 +1,7 @@
 ! { dg-do run }
 ! { dg-additional-sources bind-c-contiguous-1.c }
 ! { dg-additional-options "-fcheck=all" }
-! { dg-prune-output "command-line option '-fcheck=.*' is valid for Fortran but not for C" }
+! { dg-additional-options -Wno-complain-wrong-lang }
 
 ! Fortran demands that with bind(C), the callee ensure that for
 ! * 'contiguous'
index a58ba20df35e10952f6116ea3dfb775c66658211..591c5a7146e7d282d8431f8c8620ac24d2363aee 100644 (file)
@@ -4,7 +4,7 @@
 !
 ! { dg-additional-sources bind-c-contiguous-4.c }
 ! { dg-additional-options "-fcheck=all" }
-! { dg-prune-output "command-line option '-fcheck=.*' is valid for Fortran but not for C" }
+! { dg-additional-options -Wno-complain-wrong-lang }
 
 ! Fortran demands that with bind(C), the callee ensure that for
 ! * 'contiguous'
index d1af9f7767a33b9f59d7998fa4a216d5a8378366..58d9a98d5149c0d34b04e730e321bb59e0e585eb 100644 (file)
@@ -1,7 +1,7 @@
 ! { dg-do run }
 ! { dg-additional-sources bind-c-contiguous-5.c }
 ! { dg-additional-options "-fcheck=all" }
-! { dg-prune-output "command-line option '-fcheck=.*' is valid for Fortran but not for C" }
+! { dg-additional-options -Wno-complain-wrong-lang }
 !  ---- Same as bind-c-contiguous-1.f90 - but with kind=4 characters
 ! Fortran demands that with bind(C), the callee ensure that for
 ! * 'contiguous'
index 59be4fc9dc998a5befe57d61fe1f6eb4a7ca224e..839e5a62191f659832848e238e70a32c68f54f81 100644 (file)
@@ -59,6 +59,10 @@ proc check_compile {basename type contents args} {
     } else {
        set options ""
     }
+    # Silence "command-line option [...] is valid for [...] but not for [...]"
+    # that we may easily run into here, if more than one language is involved.
+    lappend options additional_flags=-Wno-complain-wrong-lang
+
     switch -glob -- $contents {
        "*/\\* Assembly*" { set src ${basename}[pid].S }
        "*! Fortran*" { set src ${basename}[pid].f90 }
index 3eab8598deca2f6b742170321775b73963124268..834a2d259326c48abb8ba2bfd65823340f640e76 100644 (file)
@@ -1,5 +1,6 @@
 ! { dg-additional-sources alloc-7.c }
-! { dg-prune-output "command-line option '-fintrinsic-modules-path=.*' is valid for Fortran but not for C" }
+! { dg-additional-options -Wno-complain-wrong-lang }
+
 module m
   use omp_lib
   use iso_c_binding
index b02c68fbeeae1ebbb664809da1fc57e3f4bdf4c4..e85e2faa11e1750c170f2945d3c06d07d187c7eb 100644 (file)
@@ -1,5 +1,6 @@
 ! { dg-additional-sources alloc-7.c }
-! { dg-prune-output "command-line option '-fintrinsic-modules-path=.*' is valid for Fortran but not for C" }
+! { dg-additional-options -Wno-complain-wrong-lang }
+
 module m
   use omp_lib
   use iso_c_binding
index 57ecd839c2665bcc64103c62c3fde4ca8cc8ce91..8ef40ffcbba7df284d1f50b5cb5f92ad45195bbf 100644 (file)
@@ -1,5 +1,6 @@
 ! { dg-additional-sources alloc-7.c }
-! { dg-prune-output "command-line option '-fintrinsic-modules-path=.*' is valid for Fortran but not for C" }
+! { dg-additional-options -Wno-complain-wrong-lang }
+
 module m
   use omp_lib
   use iso_c_binding
index 1da141631bc39e10eb088d4d594e7d9e0c7c9992..4a1c6a75a4a662973cc96724cdbb4fe5ed4d00cf 100644 (file)
@@ -1,5 +1,6 @@
 ! { dg-additional-sources alloc-7.c }
-! { dg-prune-output "command-line option '-fintrinsic-modules-path=.*' is valid for Fortran but not for C" }
+! { dg-additional-options -Wno-complain-wrong-lang }
+
 module m
   use omp_lib
   use iso_c_binding
index 1547d2baeeff58b5c8136bdb57d60279325bcc81..c10820e1402219022243ea729c83704e34cd46ed 100644 (file)
@@ -1,6 +1,6 @@
 ! { dg-do run }
 ! { dg-additional-sources allocate-1.c }
-! { dg-prune-output "command-line option '-fintrinsic-modules-path=.*' is valid for Fortran but not for C" }
+! { dg-additional-options -Wno-complain-wrong-lang }
 
 module m
   use omp_lib
index 80d00cae009d6a3659fdb1656949618dba7285f3..35b47e93ac2d6fcc2563915dbe9c3b2bcfe6adff 100644 (file)
@@ -1,7 +1,7 @@
 ! { dg-additional-options "-fdump-tree-gimple" }
 !
 ! { dg-additional-sources my-usleep.c }
-! { dg-prune-output "command-line option '-fintrinsic-modules-path=.*' is valid for Fortran but not for C" }
+! { dg-additional-options -Wno-complain-wrong-lang }
 !
 ! Ensure that 'depend(...: var)' and 'depobj(...) depend(...: var)'
 ! depend on the same variable when 'var' is a pointer
index b812b6dab53f46087eced9ba003212349a6da9ab..7c3f29745cb86fbf0158951537e4b0412b3846d8 100644 (file)
@@ -1,5 +1,5 @@
 ! { dg-additional-sources my-usleep.c }
-! { dg-prune-output "command-line option '-fintrinsic-modules-path=.*' is valid for Fortran but not for C" }
+! { dg-additional-options -Wno-complain-wrong-lang }
 
 module m
   implicit none
index b5032e98a2f5761e1e6de10c40b77d3cfc8b16c7..bb085f21fd76a0cabd3b2268ca42f28f10b025fc 100644 (file)
@@ -1,5 +1,5 @@
 ! { dg-additional-sources my-usleep.c }
-! { dg-prune-output "command-line option '-fintrinsic-modules-path=.*' is valid for Fortran but not for C" }
+! { dg-additional-options -Wno-complain-wrong-lang }
 
 module m
   use omp_lib
index 771a59c50f032a317431abecc2065c1b075c04d9..86e310c440c5d52ccf0b4a2aa39d386e682c4cd7 100644 (file)
@@ -1,5 +1,5 @@
 ! { dg-additional-sources my-usleep.c }
-! { dg-prune-output "command-line option '-fintrinsic-modules-path=.*' is valid for Fortran but not for C" }
+! { dg-additional-options -Wno-complain-wrong-lang }
 
 program main
   implicit none
index 46161c36cd2d98a61daf88eb7b8716878fd9be29..6953b592095f9f47ebbe0d7d9f6db136721b50e1 100644 (file)
@@ -1,5 +1,5 @@
 ! { dg-additional-sources my-usleep.c }
-! { dg-prune-output "command-line option '-fintrinsic-modules-path=.*' is valid for Fortran but not for C" }
+! { dg-additional-options -Wno-complain-wrong-lang }
 
 program main
   use omp_lib
index 5fbf03606ca3f081a6946043563633f45446c22a..fcc7f51f4da85e096fedb7e9362f3a0ca4162ba8 100644 (file)
@@ -1,6 +1,6 @@
 ! { dg-do run }
 ! { dg-additional-sources ../on_device_arch.c }
-! { dg-prune-output "command-line option '-fintrinsic-modules-path=.*' is valid for Fortran but not for C" }
+! { dg-additional-options -Wno-complain-wrong-lang }
 
 module e_53_1_mod
   integer :: THRESHOLD = 20
index 1bcdac97e233023f91b79ceeeb28ce4f9ceb823c..d43d9abecd398209975a7a0c923a4649b0b7b79d 100644 (file)
@@ -1,6 +1,6 @@
 ! { dg-do run }
 ! { dg-additional-sources ../on_device_arch.c }
-! { dg-prune-output "command-line option '-fintrinsic-modules-path=.*' is valid for Fortran but not for C" }
+! { dg-additional-options -Wno-complain-wrong-lang }
 
 program e_53_2
   !$omp declare target (fib)
index ba416b9525e8cca4980c6c75f870164bd1c08075..35a030ec6665e3b03aa3729d7a9db0a9120aa353 100644 (file)
@@ -1,5 +1,6 @@
 ! { dg-additional-sources my-usleep.c }
-! { dg-prune-output "command-line option '-fintrinsic-modules-path=.*' is valid for Fortran but not for C" }
+! { dg-additional-options -Wno-complain-wrong-lang }
+
 program main
   implicit none
   interface
index 9d7202061443e0d8c11c0f422db8ad8c46008158..c88825173c3e7083cd33557895c6391464997d81 100644 (file)
@@ -1,5 +1,6 @@
 ! { dg-additional-sources my-usleep.c }
-! { dg-prune-output "command-line option '-fintrinsic-modules-path=.*' is valid for Fortran but not for C" }
+! { dg-additional-options -Wno-complain-wrong-lang }
+
 program main
   implicit none
   interface
index 03a3b61540dd6e6bbd44b3a5e1299b67e85ab7de..b2c476fd6a6b219281b7f4dee2b02ef9734ecb34 100644 (file)
@@ -1,7 +1,5 @@
 ! { dg-do run }
 
-  ! { dg-prune-output "command-line option '-fintrinsic-modules-path=.*' is valid for Fortran but not for C" }
-
 ! Test tasks with detach clause on an offload device.  Each device
 ! thread spawns off a chain of tasks, that can then be executed by
 ! any available thread.
index d2050e69eb98d5e61244fad65b29e24ad18e6671..178a66d6f79f91fcac00209a6c3905d7a801a57e 100644 (file)
@@ -2,8 +2,8 @@
 ! vector_length.
 
 ! { dg-additional-sources parallel-dims-aux.c }
+! { dg-additional-options -Wno-complain-wrong-lang }
 ! { dg-do run }
-! { dg-prune-output "command-line option '-fintrinsic-modules-path=.*' is valid for Fortran but not for C" }
 
 ! { dg-additional-options "-DEXPENSIVE" { target run_expensive_tests } }
 ! { dg-additional-options "-cpp" }