I can reproduce this problem. I will try to solve this problem (by git bisect


git bisect told me that this behaivor changed since 6d3c634c8baebd9ff12c39d61947752486758bd.

Let's study it: is it a feature or bug ;)

commit 6d3c634c8baebd9ff12c39d61947752486758bd3
Author: Jason Merrill <ja...@redhat.com>
Date:   Sun Nov 27 14:30:14 2022 -0500

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

 gcc/cp/g++spec.cc | 4 +++-
 gcc/gcc.cc        | 7 +++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

Reply via email to