public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Alexandre Oliva <oliva@adacore.com>,
	Iain Sandoe <idsandoe@googlemail.com>
Cc: Joseph Myers <joseph@codesourcery.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
	Nathan Sidwell <nathan@acm.org>
Subject: Re: [PATCH] Introduce -nolibstdc++ option
Date: Mon, 28 Nov 2022 12:56:52 -0500	[thread overview]
Message-ID: <54b2a170-b89f-5420-a070-61c9138971d2@redhat.com> (raw)
In-Reply-To: <82f812d9-5d3c-ab08-528c-61f64e7fc4e1@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1191 bytes --]

On 9/16/22 07:52, Jason Merrill wrote:
> On 6/24/22 01:23, Alexandre Oliva via Gcc-patches wrote:
>> On Jun 23, 2022, Alexandre Oliva <oliva@adacore.com> wrote:
>>
>>> Here's the patch.  Regstrapped on x86_64-linux-gnu, also tested with a
>>> cross to aarch64-rtems6.  Ok to install?
>>
>>> Introduce -nostdlib++ option
>>
>> Uhh, I went ahead and installed this.  The earlier patch was approved if
>> nobody objected, and so, having overcome the objection to the option
>> spelling, it ended up in my "approved" patchset.
>>
>> In case there are objections to it, please let me know, and I'll revert
>> it promptly, but I guess it makes little sense to revert it on the odd
>> change that someone does.  Thanks for your understanding.
> 
> I'm getting failures from pure-virtual1.C with
> 
> xg++: error: unrecognized command-line option '-nostdlib++'
> 
> I guess that's because it isn't handled by the specs in the way nostdlib 
> and nodefautlibs are.  Maybe the solution is to set SKIPOPT in the driver?
> 
> Are you not seeing this problem?

I started seeing this again and decided to track it down more.  It seems 
to be dependent on specs, as explained in this commit message:


[-- Attachment #2: 0001-driver-fix-validate_switches-logic.patch --]
[-- Type: text/x-patch, Size: 1450 bytes --]

From 0e74112cf494c93f170739b87ecc89b2d5d97f92 Mon Sep 17 00:00:00 2001
From: Jason Merrill <jason@redhat.com>
Date: Sun, 27 Nov 2022 14:30:14 -0500
Subject: [PATCH] driver: fix validate_switches logic
To: gcc-patches@gcc.gnu.org

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

gcc/ChangeLog:

	* gcc.cc (validate_switches): Reset suffix/starred on loop.
---
 gcc/gcc.cc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index ca1c9e27a94..2278e2b6bb1 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -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 == '!')
-- 
2.31.1


  parent reply	other threads:[~2022-11-28 17:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-21  5:55 Alexandre Oliva
2022-06-21  7:37 ` Richard Biener
2022-06-21  7:53   ` Fangrui Song
2022-06-21  8:03     ` Richard Biener
2022-06-21  8:19       ` Fangrui Song
2022-06-22  0:36     ` Alexandre Oliva
2022-06-22 18:39       ` Iain Sandoe
2022-06-22 23:28         ` Alexandre Oliva
2022-06-22 23:42           ` Fangrui Song
2022-06-23 11:27           ` Alexandre Oliva
2022-06-24  5:23             ` Alexandre Oliva
2022-09-16 11:52               ` Jason Merrill
2022-09-16 11:53                 ` Jason Merrill
2022-11-28 17:56                 ` Jason Merrill [this message]
2023-02-11  9:09             ` Gerald Pfeifer
2023-03-30 11:23               ` Alexandre Oliva
2023-03-30 13:38                 ` Arsen Arsenović
2023-03-30 23:13                 ` Gerald Pfeifer
2023-04-06  1:25                   ` Alexandre Oliva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54b2a170-b89f-5420-a070-61c9138971d2@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=idsandoe@googlemail.com \
    --cc=joseph@codesourcery.com \
    --cc=nathan@acm.org \
    --cc=oliva@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).