aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArsen Arsenović <arsen@aarsen.me>2024-09-02 21:29:53 +0200
committerArsen Arsenović <arsen@gcc.gnu.org>2025-01-22 20:11:24 +0100
commitfbc94ff6e7615c7e5aeff8f3e0a2f894889e1b4f (patch)
tree91536a68fd33258bb4859fcedb40cc8978d86cc1 /gcc
parent6db9d4e954bff3dfd926c7c9b71e41e47b7089c8 (diff)
downloadgcc-fbc94ff6e7615c7e5aeff8f3e0a2f894889e1b4f.zip
gcc-fbc94ff6e7615c7e5aeff8f3e0a2f894889e1b4f.tar.gz
gcc-fbc94ff6e7615c7e5aeff8f3e0a2f894889e1b4f.tar.bz2
d,ada/spec: only sub nostd{inc,lib} rather than nostd{inc,lib}*
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 <mgorny@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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/gcc-interface/lang-specs.h6
-rw-r--r--gcc/d/lang-specs.h2
-rw-r--r--gcc/testsuite/gcc.dg/driver-nostdlibstar.c4
3 files changed, 8 insertions, 4 deletions
diff --git a/gcc/ada/gcc-interface/lang-specs.h b/gcc/ada/gcc-interface/lang-specs.h
index 2ba0f1d..bfa41af 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 2292e7e..64e7a5f 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 0000000..b3b2082
--- /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 }