From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH 4/7] Simplify post-process-parser-output.sh
Date: Thu, 19 Nov 2026 10:58:19 -0700 [thread overview]
Message-ID: <20261119-more-parser-cleanups-v1-4-d85241f3fede@adacore.com> (raw)
In-Reply-To: <20261119-more-parser-cleanups-v1-0-d85241f3fede@adacore.com>
This simplifies post-process-parser-output.sh, now that the only use
of flex is gone.
---
gdb/Makefile.in | 4 ++--
gdb/post-process-parser-output.sh | 38 +++++++++++---------------------------
2 files changed, 13 insertions(+), 29 deletions(-)
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index c623cb04753..04ae7c3900d 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2814,9 +2814,9 @@ YY_PREFIX_p-exp-parser = pascal_yy
y.tab.h $*-gen.h.tmp -- \
$(YACC) $(YFLAGS) -p $(YY_PREFIX_$*) -t -d \
|| (rm -f $*-gen.c.tmp $*-gen.h.tmp; false)
- @$(POST_PROCESS_PARSER_OUTPUT) bison $* < $*-gen.c.tmp > $*-gen.c.new \
+ @$(POST_PROCESS_PARSER_OUTPUT) $* < $*-gen.c.tmp > $*-gen.c.new \
&& rm -f $*-gen.c.tmp && mv $*-gen.c.new $*-gen.c
- @$(POST_PROCESS_PARSER_OUTPUT) bison $* < $*-gen.h.tmp > $*-gen.h.new \
+ @$(POST_PROCESS_PARSER_OUTPUT) $* < $*-gen.h.tmp > $*-gen.h.new \
&& rm -f $*-gen.h.tmp && mv $*-gen.h.new $*-gen.h
# XML rules
diff --git a/gdb/post-process-parser-output.sh b/gdb/post-process-parser-output.sh
index ca5f0ba302f..506bd02f7aa 100755
--- a/gdb/post-process-parser-output.sh
+++ b/gdb/post-process-parser-output.sh
@@ -17,24 +17,20 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Post-process a file produced by flex or bison/byacc, reading it from
+# Post-process a file produced by bison/byacc, reading it from
# standard input and writing the result to standard output.
#
# Usage:
#
-# ./post-process-parser-output.sh GENERATOR NAME < INPUT > OUTPUT
+# ./post-process-parser-output.sh NAME < INPUT > OUTPUT
#
-# Where GENERATOR is "bison" (regardless of whether we're using the actual
-# bison or byacc) or "flex", and NAME is the name of the parser (e.g.
-# "cp-name-parser"), used to make the global symbols names bison produces
-# unique.
+# Where NAME is the name of the parser (e.g. "cp-name-parser"), used
+# to make the global symbols names bison produces unique.
set -e
-generator="$1"
-
# Convert e.g. "cp-name-parser" to "cp_name_parser".
-name=$(echo "$2" | sed -e 's/-/_/g')
+name=$(echo "$1" | sed -e 's/-/_/g')
common='
/extern.*malloc/d
@@ -47,21 +43,9 @@ s/\([ \t;,(]\)free\([ \t]*[&(),]\)/\1xfree\2/g
s/\([ \t;,(]\)free$/\1xfree/g
'
-case "$generator" in
- bison)
- sed -e "$common" \
- -e '/^#line.*y.tab.c/d' \
- -e "s/YYSTYPE/${name}_YYSTYPE/g" \
- -e "s/yyalloc/${name}_yyalloc/g" \
- -e "s/yysymbol_kind_t/${name}_yysymbol_kind_t/g" \
- -e "s/YYSTACKDATA/${name}_YYSTACKDATA/g"
- ;;
- flex)
- sed -e "$common" \
- -e 's/yy_flex_xrealloc/yyxrealloc/g'
- ;;
- *)
- echo "$0: unknown parser generator \"$generator\"" >&2
- exit 1
- ;;
-esac
+sed -e "$common" \
+ -e '/^#line.*y.tab.c/d' \
+ -e "s/YYSTYPE/${name}_YYSTYPE/g" \
+ -e "s/yyalloc/${name}_yyalloc/g" \
+ -e "s/yysymbol_kind_t/${name}_yysymbol_kind_t/g" \
+ -e "s/YYSTACKDATA/${name}_YYSTACKDATA/g"
--
2.56.0
next prev parent reply other threads:[~2026-11-19 17:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 17:58 [PATCH 0/7] More minor parser-related cleanups Tom Tromey
2026-11-19 17:58 ` [PATCH 1/7] Use compiled_regex in rust-parse.c Tom Tromey
2026-11-19 17:58 ` [PATCH 2/7] Move ada_tick_completer to ada-exp-parser.c Tom Tromey
2026-11-19 17:58 ` [PATCH 3/7] Change some Ada parser functions into methods Tom Tromey
2026-11-19 18:48 ` Simon Marchi
2026-11-20 20:57 ` Tom Tromey
2026-11-19 17:58 ` Tom Tromey [this message]
2026-11-19 17:58 ` [PATCH 5/7] Remove fixed-sized buffer from ada_parse_state::lex_number Tom Tromey
2026-11-19 17:58 ` [PATCH 6/7] Hoist calls to canonicalize_numeral Tom Tromey
2026-11-19 17:58 ` [PATCH 7/7] Remove canonicalize_numeral Tom Tromey
2026-11-19 18:55 ` [PATCH 0/7] More minor parser-related cleanups Simon Marchi
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=20261119-more-parser-cleanups-v1-4-d85241f3fede@adacore.com \
--to=tromey@adacore.com \
--cc=gdb-patches@sourceware.org \
/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