From: Alexandre Oliva <oliva@adacore.com>
To: Richard Biener <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org, ebotcazou@adacore.com, joseph@codesourcery.com
Subject: Re: drop -aux{dir,base}, revamp -dump{dir,base}
Date: Tue, 26 May 2020 10:52:57 -0300 [thread overview]
Message-ID: <or7dwyajly.fsf@livre.home> (raw)
In-Reply-To: <nycvar.YFH.7.76.2005261051380.4397@zhemvz.fhfr.qr> (Richard Biener's message of "Tue, 26 May 2020 10:52:57 +0200 (CEST)")
On May 26, 2020, Richard Biener <rguenther@suse.de> wrote:
> xgcc: error: unrecognized command-line option '-dumpbase'^M
> xg++: error: unrecognized command-line option '-dA'; did you mean '-A'
Here's a proper patch submission. I'm still throwing tests at it, but
it's already proved (with a non-bootstrapped build and test run) to fix
the latent (to me) problems above, exposed by configuring GCC without
Ada support, so I think putting it in is highly desirable, and a strict
improvement. Ok to install?
do not skip validation of switch after %<opt
From: Alexandre Oliva <oliva@adacore.com>
After the patch that revamped dump and aux outputs, GCC compilation
drivers built without Ada would reject -d* options. Such options
would only be validated because of the %{d*} in Ada lang specs, though
other languages had it as well. Other languages had %< specs that had
to be there before %{d*} %:dumps(), while Ada was missing them.
Adding them to Ada brought the same problem to compilers that had Ada
enabled.
The reason validation failed was that they mishandled %< specs,
advancing past the beginning of the next spec, causing it not to be
handled. Since %{d*} appeared after an odd %<, it was thus ignored.
The logic of validate_switches originally skipped the closing brace
that matched the opening brace, but this shouldn't happen for %<.
Fixed by letting validate_switches know whether it is handling a
braced group or a single atom, and behaving accordingly.
for gcc/ChangeLog
* gcc.c (validate_switches): Add braced parameter. Adjust all
callers. Expected and skip trailing brace only if braced.
Return after handling one atom otherwise.
(DUMPS_OPTIONS): New.
(cpp_debug_options): Define in terms of it.
for gcc/ada/ChangeLog
* gcc-interfaces/lang-specs.h (ADA_DUMPS_OPTIONS): Define in
terms of DUMPS_OPTIONS. Replace occurrences of %{d*} %:dumps
with it.
---
gcc/ada/gcc-interface/lang-specs.h | 10 +++++++---
gcc/gcc.c | 32 +++++++++++++++++++++++---------
2 files changed, 30 insertions(+), 12 deletions(-)
diff --git a/gcc/ada/gcc-interface/lang-specs.h b/gcc/ada/gcc-interface/lang-specs.h
index 12b7cf5e..f0ef3b92 100644
--- a/gcc/ada/gcc-interface/lang-specs.h
+++ b/gcc/ada/gcc-interface/lang-specs.h
@@ -23,6 +23,10 @@
* *
****************************************************************************/
+/* Pass -d* flags to the actual compiler, but mapping non-Ada
+ extensions to .ada in dump file names. */
+#define ADA_DUMPS_OPTIONS DUMPS_OPTIONS ("%{!.adb:%{!.ads:.ada}}")
+
/* This is the contribution to the `default_compilers' array in gcc.c for
GNAT. */
@@ -35,7 +39,7 @@
gnat1 %{I*} %{k8:-gnatk8} %{Wall:-gnatwa} %{w:-gnatws} %{!Q:-quiet}\
%{nostdinc*} %{nostdlib*}\
%{fcompare-debug-second:-gnatd_A} \
- %{O*} %{W*} %{w} %{p} %{pg:-p} %{d*} %:dumps(%{!.adb:%{!.ads:.ada}}) \
+ %{O*} %{W*} %{w} %{p} %{pg:-p} " ADA_DUMPS_OPTIONS " \
%{coverage:-fprofile-arcs -ftest-coverage} "
#if defined(TARGET_VXWORKS_RTP)
"%{fRTS=rtp|fRTS=rtp-smp|fRTS=ravenscar-cert-rtp:-mrtp} "
@@ -51,7 +55,7 @@
%{!c:%e-c required for gnat2why}\
gnat1why %{I*} %{k8:-gnatk8} %{!Q:-quiet}\
%{nostdinc*} %{nostdlib*}\
- %{a} %{d*} %:dumps(%{!.adb:%{!.ads:.ada}}) \
+ %{a} " ADA_DUMPS_OPTIONS " \
%{gnatea:-gnatez} %{g*&m*&f*} \
%1 %{o*:%w%*-gnatO} \
%i \
@@ -62,7 +66,7 @@
%{!c:%e-c required for gnat2scil}\
gnat1scil %{I*} %{k8:-gnatk8} %{!Q:-quiet}\
%{nostdinc*} %{nostdlib*}\
- %{a} %{d*} %:dumps(%{!.adb:%{!.ads:.ada}}) \
+ %{a} " ADA_DUMPS_OPTIONS " \
%{gnatea:-gnatez} %{g*&m*&f*} \
%1 %{o*:%w%*-gnatO} \
%i \
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 8c851d7..e2362175f4 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -388,7 +388,7 @@ static void do_option_spec (const char *, const char *);
static void do_self_spec (const char *);
static const char *find_file (const char *);
static int is_directory (const char *, bool);
-static const char *validate_switches (const char *, bool);
+static const char *validate_switches (const char *, bool, bool);
static void validate_all_switches (void);
static inline void validate_switches_from_spec (const char *, bool);
static void give_switch (int, int);
@@ -1176,9 +1176,16 @@ static const char *cpp_options =
%{!fno-working-directory:-fworking-directory}}} %{O*}\
%{undef} %{save-temps*:-fpch-preprocess}";
+/* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al.
+
+ Make it easy for a language to override the argument for the
+ %:dumps specs function call. */
+#define DUMPS_OPTIONS(EXTS) \
+ "%<dumpdir %<dumpbase %<dumpbase-ext %{d*} %:dumps(" EXTS ")"
+
/* This contains cpp options which are not passed when the preprocessor
output will be used by another program. */
-static const char *cpp_debug_options = "%<dumpdir %<dumpbase %<dumpbase-ext %{d*} %:dumps()";
+static const char *cpp_debug_options = DUMPS_OPTIONS ("");
/* NB: This is shared amongst all front-ends, except for Ada. */
static const char *cc1_options =
@@ -9061,7 +9068,7 @@ validate_switches_from_spec (const char *spec, bool user)
|| (*p == 'W' && *++p == '{')
|| (*p == '@' && *++p == '{')))
/* We have a switch spec. */
- p = validate_switches (p + 1, user);
+ p = validate_switches (p + 1, user, *p == '{');
}
static void
@@ -9080,11 +9087,15 @@ validate_all_switches (void)
validate_switches_from_spec (link_command_spec, false);
}
-/* Look at the switch-name that comes after START
- and mark as valid all supplied switches that match it. */
+/* Look at the switch-name that comes after START and mark as valid
+ all supplied switches that match it. If BRACED, handle other
+ switches after '|' and '&', and specs after ':' until ';' or '}',
+ going back for more switches after ';'. Without BRACED, handle
+ only one atom. Return a pointer to whatever follows the handled
+ items, after the closing brace if BRACED. */
static const char *
-validate_switches (const char *start, bool user_spec)
+validate_switches (const char *start, bool user_spec, bool braced)
{
const char *p = start;
const char *atom;
@@ -9126,6 +9137,9 @@ next_member:
switches[i].validated = true;
}
+ if (!braced)
+ return p;
+
if (*p) p++;
if (*p && (p[-1] == '|' || p[-1] == '&'))
goto next_member;
@@ -9138,11 +9152,11 @@ next_member:
{
p++;
if (*p == '{' || *p == '<')
- p = validate_switches (p+1, user_spec);
+ p = validate_switches (p+1, user_spec, *p == '{');
else if (p[0] == 'W' && p[1] == '{')
- p = validate_switches (p+2, user_spec);
+ p = validate_switches (p+2, user_spec, true);
else if (p[0] == '@' && p[1] == '{')
- p = validate_switches (p+2, user_spec);
+ p = validate_switches (p+2, user_spec, true);
}
else
p++;
--
Alexandre Oliva, freedom fighter he/him https://FSFLA.org/blogs/lxo/
Free Software Evangelist Stallman was right, but he's left :(
GNU Toolchain Engineer Live long and free, and prosper ethically
next prev parent reply other threads:[~2020-05-26 13:53 UTC|newest]
Thread overview: 117+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-26 5:30 introduce -fcallgraph-info option Alexandre Oliva
2019-10-26 8:12 ` Richard Biener
2019-10-26 11:21 ` Alexandre Oliva
2019-10-27 9:08 ` Alexandre Oliva
2019-10-28 8:38 ` Richard Biener
2019-10-30 10:12 ` Alexandre Oliva
2019-10-30 11:28 ` Richard Biener
2019-11-02 19:31 ` Alexandre Oliva
2019-11-04 8:28 ` Richard Biener
2019-11-06 10:53 ` Alexandre Oliva
2019-11-20 4:35 ` Alexandre Oliva
2019-11-20 9:16 ` Richard Biener
2019-11-06 15:38 ` Alexandre Oliva
2019-11-07 7:49 ` Richard Biener
2019-11-07 10:50 ` Alexandre Oliva
2019-11-07 11:48 ` Richard Biener
2019-11-07 12:30 ` Alexandre Oliva
2019-11-07 14:02 ` Richard Biener
2019-11-07 22:39 ` Alexandre Oliva
2019-11-08 8:28 ` Richard Biener
2019-11-08 23:12 ` Eric Gallager
2019-11-15 1:34 ` Alexandre Oliva
2019-11-15 1:01 ` Alexandre Oliva
2019-11-15 7:30 ` Alexandre Oliva
2019-11-15 8:08 ` Richard Biener
2019-11-15 22:50 ` Alexandre Oliva
2019-12-03 22:44 ` Alexandre Oliva
2019-12-09 9:41 ` Richard Biener
2019-12-12 1:14 ` Alexandre Oliva
2019-12-25 10:05 ` Alexandre Oliva
2019-12-26 19:00 ` drop -aux{dir,base}, revamp -dump{dir,base} (was: Re: introduce -fcallgraph-info option) Alexandre Oliva
2020-01-09 13:33 ` Richard Biener
2020-01-09 19:09 ` drop -aux{dir,base}, revamp -dump{dir,base} Alexandre Oliva
2020-01-16 11:06 ` Alexandre Oliva
2020-01-16 11:15 ` Alexandre Oliva
2020-01-17 2:14 ` Joseph Myers
2020-01-20 10:38 ` Richard Biener
2020-01-22 1:25 ` Alexandre Oliva
2020-01-22 8:15 ` Richard Biener
2020-01-23 20:06 ` Alexandre Oliva
2020-01-24 1:50 ` Alexandre Oliva
2020-05-19 8:51 ` Alexandre Oliva
2020-05-19 8:59 ` Alexandre Oliva
2020-05-19 9:29 ` Richard Biener
2020-05-19 8:59 ` Alexandre Oliva
2020-05-19 9:30 ` Richard Biener
2020-05-19 9:00 ` Alexandre Oliva
2020-05-19 9:04 ` Richard Biener
2020-05-22 0:32 ` Alexandre Oliva
2020-05-22 6:05 ` Richard Biener
2020-05-26 7:08 ` Alexandre Oliva
2020-05-26 8:52 ` Richard Biener
2020-05-26 9:02 ` Martin Liška
2020-05-26 10:00 ` Alexandre Oliva
2020-05-26 12:14 ` Alexandre Oliva
2020-05-26 13:52 ` Alexandre Oliva [this message]
2020-05-26 13:56 ` Richard Biener
2020-05-27 22:05 ` Alexandre Oliva
2020-05-27 23:01 ` Jeff Law
2020-06-02 11:52 ` Alexandre Oliva
2020-06-02 12:02 ` Richard Biener
2020-05-27 1:04 ` Broken build (was: Re: drop -aux{dir,base}, revamp -dump{dir,base}) Hans-Peter Nilsson
2020-05-27 14:30 ` Broken build Alexandre Oliva
2020-05-27 15:04 ` Hans-Peter Nilsson
2020-05-28 0:53 ` Alexandre Oliva
2020-05-28 0:39 ` Anthony Green
2020-06-02 11:29 ` Alexandre Oliva
2020-06-02 14:07 ` Hans-Peter Nilsson
2020-05-27 9:45 ` drop -aux{dir,base}, revamp -dump{dir,base} Andreas Schwab
2020-05-27 10:28 ` Andreas Schwab
2020-05-27 14:41 ` Alexandre Oliva
2020-05-27 14:59 ` Andreas Schwab
2020-06-09 12:29 ` Thomas Schwinge
2020-06-09 12:42 ` BRIG FE testsuite: Fix all dump-scans (Was: Re: drop -aux{dir, base}, revamp -dump{dir, base}) Martin Jambor
2020-06-09 18:31 ` BRIG FE testsuite: Fix all dump-scans (Was: Re: drop -aux{dir,base}, revamp -dump{dir,base}) Mike Stump
2020-06-11 14:28 ` BRIG FE testsuite: Fix all dump-scans (Was: Re: drop -aux{dir, base}, revamp -dump{dir, base}) Martin Jambor
2020-06-12 20:52 ` BRIG FE testsuite: Fix all dump-scans (Was: Re: drop -aux{dir,base}, revamp -dump{dir,base}) Mike Stump
2020-06-10 21:50 ` BRIG FE testsuite: Fix all dump-scans Alexandre Oliva
2020-06-23 9:44 ` drop -aux{dir,base}, revamp -dump{dir,base} Alexandre Oliva
2020-06-23 11:30 ` Martin Jambor
2020-06-09 13:08 ` Thomas Schwinge
2020-06-10 22:24 ` Alexandre Oliva
2020-06-17 10:50 ` Tobias Burnus
2020-06-18 2:58 ` Alexandre Oliva
2020-06-18 6:10 ` Alexandre Oliva
2020-06-18 9:41 ` Tobias Burnus
2020-06-18 10:39 ` Alexandre Oliva
2020-06-18 12:06 ` Tobias Burnus
2020-06-30 16:13 ` Thomas Schwinge
2020-07-14 5:46 ` Alexandre Oliva
2020-07-24 6:08 ` Thomas Schwinge
2020-07-24 17:54 ` Alexandre Oliva
2020-07-14 5:49 ` Alexandre Oliva
2020-06-19 9:53 ` Alexandre Oliva
2020-06-19 16:09 ` Tobias Burnus
2020-06-22 6:08 ` Alexandre Oliva
2020-06-22 7:07 ` Tobias Burnus
2020-06-22 14:32 ` Alexandre Oliva
2020-06-23 8:17 ` Richard Biener
2020-06-30 16:35 ` Thomas Schwinge
2020-07-24 12:06 ` Thomas Schwinge
2020-06-30 18:52 ` Thomas Schwinge
2020-07-14 4:48 ` Alexandre Oliva
2020-07-24 6:01 ` Thomas Schwinge
2020-07-24 18:00 ` Alexandre Oliva
2023-11-24 12:46 ` testsuite: Add 'only_for_offload_target' wrapper for 'scan-offload-tree-dump' etc. (was: drop -aux{dir,base}, revamp -dump{dir,base}) Thomas Schwinge
2020-06-23 9:50 ` drop -aux{dir,base}, revamp -dump{dir,base} Alexandre Oliva
2020-06-30 16:07 ` Thomas Schwinge
2020-07-23 21:12 ` [PR95720] protect gluefile and wrap_flags with -Wl too (was: Re: drop -aux{dir,base}, revamp -dump{dir,base}) Alexandre Oliva
2020-07-24 6:48 ` Richard Biener
2020-05-26 8:09 ` [wwwdocs] Re: drop -aux{dir,base}, revamp -dump{dir,base} Alexandre Oliva
2019-10-28 23:56 ` introduce -fcallgraph-info option Joseph Myers
2019-10-30 9:22 ` Alexandre Oliva
2019-10-30 9:43 ` Alexandre Oliva
2019-10-30 18:17 ` Joseph Myers
2019-11-06 21:27 ` Thomas Schwinge
2019-11-07 11:23 ` 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=or7dwyajly.fsf@livre.home \
--to=oliva@adacore.com \
--cc=ebotcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=joseph@codesourcery.com \
--cc=rguenther@suse.de \
/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).