diff options
author | Jason Merrill <jason@redhat.com> | 2022-11-27 14:30:14 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2022-12-02 10:38:32 -0500 |
commit | 6d3c634c8baebd9ff12c39d61947752486758bd3 (patch) | |
tree | 9831db43bb8060835be83e840e7adc83c20fd0ae /gcc/gcc.cc | |
parent | 70596a0fb2a2ec072e1e97e37616e05041dfa4e5 (diff) | |
download | gcc-6d3c634c8baebd9ff12c39d61947752486758bd3.zip gcc-6d3c634c8baebd9ff12c39d61947752486758bd3.tar.gz gcc-6d3c634c8baebd9ff12c39d61947752486758bd3.tar.bz2 |
driver: fix validate_switches logic
Under the old logic for validate_switches, once suffix or starred got set,
they stayed set for all later switches found in the spec. So for e.g.
%{g*:%{%:debug-level-gt(0):
Once we see g*, starred is set. Then we see %:, and it sees that as a
zero-length switch, which because starred is still set, matches any and all
command-line options. So targets that use such a spec accept all options in
the driver, while ones that don't reject some, such as the recent
-nostdlib++.
This patch fixes the inconsistency, so all targets would complain about
-nostdlib++, and then sets SKIPOPT for it so they don't.
gcc/ChangeLog:
* gcc.cc (validate_switches): Reset suffix/starred on loop.
gcc/cp/ChangeLog:
* g++spec.cc (lang_specific_driver): Set SKIPOPT for nostdlib++.
Diffstat (limited to 'gcc/gcc.cc')
-rw-r--r-- | gcc/gcc.cc | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -9299,12 +9299,15 @@ validate_switches (const char *start, bool user_spec, bool braced) const char *atom; size_t len; int i; - bool suffix = false; - bool starred = false; + bool suffix; + bool starred; #define SKIP_WHITE() do { while (*p == ' ' || *p == '\t') p++; } while (0) next_member: + suffix = false; + starred = false; + SKIP_WHITE (); if (*p == '!') |