Tested on x86_64-pc-linux-gnu. OK for trunk? ---------- >8 ---------- This prevents the gcc driver erroneously accepting -nostdlib++ when it should not when Ada was enabled.
Also, similarly, -nostdinc* (where * is nonempty) is unhandled by either the Ada or D compiler, so the spec should not substitute those either (thanks for pointing that out, Jakub). Brought to my attention by Michał Górny <mgo...@gentoo.org>. gcc/ada/ChangeLog: * gcc-interface/lang-specs.h: Replace %{nostdinc*} %{nostdlib*} with %{nostdinc} %{nostdlib}. gcc/d/ChangeLog: * lang-specs.h: Replace %{nostdinc*} with %{nostdinc}. gcc/testsuite/ChangeLog: * gcc.dg/driver-nostdlibstar.c: New test. --- gcc/ada/gcc-interface/lang-specs.h | 6 +++--- gcc/d/lang-specs.h | 2 +- gcc/testsuite/gcc.dg/driver-nostdlibstar.c | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/driver-nostdlibstar.c diff --git a/gcc/ada/gcc-interface/lang-specs.h b/gcc/ada/gcc-interface/lang-specs.h index 22e172b47ac6..267d15d1a2ef 100644 --- a/gcc/ada/gcc-interface/lang-specs.h +++ b/gcc/ada/gcc-interface/lang-specs.h @@ -37,7 +37,7 @@ %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ %{!S:%{!c:%e-c or -S required for Ada}}\ gnat1 %{I*} %{k8:-gnatk8} %{!Q:-quiet}\ - %{nostdinc*} %{nostdlib*}\ + %{nostdinc} %{nostdlib}\ %{fcompare-debug-second:-gnatd_A} \ %{O*} %{W*} %{w} %{p} %{pg:-p} " ADA_DUMPS_OPTIONS " \ %{coverage:-fprofile-arcs -ftest-coverage} " @@ -55,7 +55,7 @@ "\ %{!c:%e-c required for gnat2why}\ gnat1why %{I*} %{k8:-gnatk8} %{!Q:-quiet}\ - %{nostdinc*} %{nostdlib*}\ + %{nostdinc} %{nostdlib}\ %{a} " ADA_DUMPS_OPTIONS " \ %{gnatea:-gnatez} %{g*&m*&f*} \ %1 %{o*:%w%*-gnatO} \ @@ -66,7 +66,7 @@ "\ %{!c:%e-c required for gnat2scil}\ gnat1scil %{I*} %{k8:-gnatk8} %{!Q:-quiet}\ - %{nostdinc*} %{nostdlib*}\ + %{nostdinc} %{nostdlib}\ %{a} " ADA_DUMPS_OPTIONS " \ %{gnatea:-gnatez} %{g*&m*&f*} \ %1 %{o*:%w%*-gnatO} \ diff --git a/gcc/d/lang-specs.h b/gcc/d/lang-specs.h index 6f3ff2f13a72..9c52023964fe 100644 --- a/gcc/d/lang-specs.h +++ b/gcc/d/lang-specs.h @@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see {".dd", "@d", 0, 1, 0 }, {".di", "@d", 0, 1, 0 }, {"@d", - "%{!E:d21 %i %(cc1_options) %I %{nostdinc*} %{i*} %{I*} %{J*} \ + "%{!E:d21 %i %(cc1_options) %I %{nostdinc} %{i*} %{I*} %{J*} \ %{H} %{Hd*} %{Hf*} %{MD:-MD %b.deps} %{MMD:-MMD %b.deps} \ %{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*} \ %{X:-Xf %b.json} %{Xf*} \ diff --git a/gcc/testsuite/gcc.dg/driver-nostdlibstar.c b/gcc/testsuite/gcc.dg/driver-nostdlibstar.c new file mode 100644 index 000000000000..b3b208248abe --- /dev/null +++ b/gcc/testsuite/gcc.dg/driver-nostdlibstar.c @@ -0,0 +1,4 @@ +// Test that the GCC driver (which has no concept of libstdc++) rejects -nostdlib++ +// { dg-additional-options "-nostdlib++" } +// { dg-prune-output "compilation terminated" } +// { dg-error "unrecognized command-line option '-nostdlib\\+\\+'" "" { target *-*-* } 0 } -- 2.46.0