oops
On 14/07/2026 10:24, Nathan Sidwell wrote:
On 14/07/2026 03:03, Richard Biener wrote:
On Mon, Jul 13, 2026 at 4:53 PM Nathan Sidwell <[email protected]> wrote:
This annoying.
I contemplated just changing AWK to only accept the names at the beginning of a
line (with whitespace), but then considered just running the C preprocessor
first -- that way one gets all the CPP behaviour and no surprises.
Hmm, I'm not sure it's good to open up the can of worms of using the host
preprocessor (is there a CPP_FOR_BUILD?). Can't you fix the awk script
to honor comments? Can't we perform what the awk script does by
clever use of C++ constexpr of some sorts?
grep didn't find a CPP_FOR_BUILD, but I do agree it's a bit of a Pandora's box.
Here's the earlier approach I mentioned. It's sufficient to skip line-comments,
which is IMHO the natural way to temporarily stub out a pass.
not sure why awk wanted '[[:blank:]]` (rather than `[:blank:]`, but one awk
complained and the other didn't
I'm just looking for a simple solution here, not reengineer things with exciting
C++
ok?
nathan
--
Nathan Sidwell
From 8ba04dcba190e5140656a53923c92811c33ba6c8 Mon Sep 17 00:00:00 2001
From: Nathan Sidwell <[email protected]>
Date: Mon, 13 Jul 2026 09:21:45 -0400
Subject: [PATCH] Robustify awk pass generation
gcc/
* Makefile.in (pass-instances.def): Avoid repetition
* gen-pass-instances.awk: Require only white-space before
macro invocations.
---
gcc/Makefile.in | 7 +++----
gcc/gen-pass-instances.awk | 6 +++---
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index fa46ada4980..a0b79a27ca0 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -2741,10 +2741,9 @@ CFLAGS-tree-diagnostic-client-data-hooks.o += -DTARGET_NAME=\"$(target_noncanoni
CFLAGS-optinfo-emit-json.o += -DTARGET_NAME=\"$(target_noncanonical)\" $(ZLIBINC)
CFLAGS-analyzer/engine.o += $(ZLIBINC)
-pass-instances.def: $(srcdir)/passes.def $(PASSES_EXTRA) \
- $(srcdir)/gen-pass-instances.awk
- $(AWK) -f $(srcdir)/gen-pass-instances.awk \
- $(srcdir)/passes.def $(PASSES_EXTRA) > pass-instances.def
+pass-instances.def: $(srcdir)/gen-pass-instances.awk \
+ $(srcdir)/passes.def $(PASSES_EXTRA)
+ $(AWK) -f $< $(wordlist 2,99,$^) >$@
$(out_object_file): $(out_file)
$(COMPILE) $<
diff --git a/gcc/gen-pass-instances.awk b/gcc/gen-pass-instances.awk
index 66484e8c563..300e3ebad5b 100644
--- a/gcc/gen-pass-instances.awk
+++ b/gcc/gen-pass-instances.awk
@@ -167,17 +167,17 @@ function replace_pass(line, fnname, num, i)
lines[num] = new_line;
}
-/INSERT_PASS_AFTER \(.+\)/ {
+/^[[:blank:]]*INSERT_PASS_AFTER \(.+\)/ {
insert_pass($0, "INSERT_PASS_AFTER", 1);
next;
}
-/INSERT_PASS_BEFORE \(.+\)/ {
+/^[[:blank:]]*INSERT_PASS_BEFORE \(.+\)/ {
insert_pass($0, "INSERT_PASS_BEFORE", 0);
next;
}
-/REPLACE_PASS \(.+\)/ {
+/^[[:blank:]]*REPLACE_PASS \(.+\)/ {
replace_pass($0, "REPLACE_PASS");
next;
}
--
2.55.0