Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: simon.marchi@polymtl.ca
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@polymtl.ca>
Subject: [PATCH 00/17] Move C++ support code out of .y files
Date: Fri,  4 Sep 2026 12:56:32 -0400	[thread overview]
Message-ID: <20260904170338.1643894-1-simon.marchi@polymtl.ca> (raw)

From: Simon Marchi <simon.marchi@polymtl.ca>

This series stated because I needed to read and potentially edit some
code inside a .y and got annoyed that the typical C++ tooling didn't
work.  The end goal is to move the support code out of .y files and into
proper C++ source files next to them.

This series uses the yacc flags `-p` (symbol prefix) and `-t` (enable
debug code). I tested this series with bison and the byacc package from
Arch Linux.  I believe that it should work on the various BSDs, but I
have not tested (they all have their own byacc flavors I think).  The
yacc man pages from AIX and Solaris also claim to support them, but I
have not tested.  In any case, if the native yacc from a less commonly
used platform struggles with this, I think it would be fine to ask
people to use bison (assuming bison work on that platform).  And
remember, this is only needed for people who build from git.  Generated
parsers and lexers are shipped in tarballs.

This series uses flex-specific flags, but I think we already required
flex anyway (as opposed to other implementations of lex).

Simon Marchi (17):
  gdb/ada-exp-parser: remove name_info struct
  gdb: replace parse_type macros with functions
  gdb: suffix flex/bison output files with -gen.c
  gdb: move parser output post-processing to a script
  gdb: let the parser and lexer generators prefix their symbols
  gdb: separate cp-name-parser's symbol prefix with an underscore
  gdb: make $(YACC) and $(FLEX) generate headers
  gdb: add check for stale build generated files
  gdb: move cp-name-parser.y's support code to cp-name-parser.c
  gdb: rename LANG-exp.y to LANG-exp-parser.y
  gdb: move c-exp-parser.y's support code to c-exp-parser.c
  gdb: move ada-exp-parser.y's support code to ada-exp-parser.c
  gdb: move d-exp-parser.y's support code to d-exp-parser.c
  gdb: move f-exp-parser.y's support code to f-exp-parser.c
  gdb: move go-exp-parser.y's support code to go-exp-parser.c
  gdb: move m2-exp-parser.y's support code to m2-exp-parser.c
  gdb: move p-exp-parser.y's support code to p-exp-parser.c

 gdb/.gitignore                    |   27 +-
 gdb/Makefile.in                   |  194 +-
 gdb/ada-exp-parser.c              | 1351 +++++++++++
 gdb/ada-exp-parser.h              |  427 ++++
 gdb/ada-exp-parser.y              |  845 +++++++
 gdb/ada-exp.h                     |    2 +-
 gdb/ada-exp.y                     | 2019 ----------------
 gdb/ada-lang.c                    |    1 +
 gdb/ada-lang.h                    |    2 -
 gdb/ada-lex.l                     |  431 +---
 gdb/c-exp-parser.c                | 1696 ++++++++++++++
 gdb/c-exp-parser.h                |  182 ++
 gdb/c-exp-parser.y                | 1858 +++++++++++++++
 gdb/c-exp.y                       | 3626 -----------------------------
 gdb/c-lang.h                      |    6 -
 gdb/cp-name-parser.c              | 1050 +++++++++
 gdb/cp-name-parser.h              |  130 ++
 gdb/cp-name-parser.y              | 1120 +--------
 gdb/cp-support.c                  |    4 +-
 gdb/{d-exp.y => d-exp-parser.c}   |  738 +-----
 gdb/d-exp-parser.h                |   83 +
 gdb/d-exp-parser.y                |  600 +++++
 gdb/d-lang.c                      |    1 +
 gdb/d-lang.h                      |    4 -
 gdb/{f-exp.y => f-exp-parser.c}   |  982 +-------
 gdb/f-exp-parser.h                |  102 +
 gdb/f-exp-parser.y                |  766 ++++++
 gdb/f-lang.c                      |    9 +
 gdb/{go-exp.y => go-exp-parser.c} |  736 +-----
 gdb/go-exp-parser.h               |   59 +
 gdb/go-exp-parser.y               |  603 +++++
 gdb/go-lang.c                     |    9 +
 gdb/language.c                    |    1 +
 gdb/m2-exp-parser.c               |  488 ++++
 gdb/m2-exp-parser.h               |   67 +
 gdb/{m2-exp.y => m2-exp-parser.y} |  467 +---
 gdb/m2-lang.c                     |    9 +
 gdb/macroexp.c                    |    6 +-
 gdb/{p-exp.y => p-exp-parser.c}   |  927 +-------
 gdb/p-exp-parser.h                |   84 +
 gdb/p-exp-parser.y                |  752 ++++++
 gdb/p-lang.c                      |    9 +
 gdb/parser-defs.h                 |    8 +
 gdb/post-process-parser-output.sh |   67 +
 gdb/yy-remap.h                    |   96 -
 45 files changed, 11789 insertions(+), 10855 deletions(-)
 create mode 100644 gdb/ada-exp-parser.c
 create mode 100644 gdb/ada-exp-parser.h
 create mode 100644 gdb/ada-exp-parser.y
 delete mode 100644 gdb/ada-exp.y
 create mode 100644 gdb/c-exp-parser.c
 create mode 100644 gdb/c-exp-parser.h
 create mode 100644 gdb/c-exp-parser.y
 delete mode 100644 gdb/c-exp.y
 create mode 100644 gdb/cp-name-parser.c
 create mode 100644 gdb/cp-name-parser.h
 rename gdb/{d-exp.y => d-exp-parser.c} (58%)
 create mode 100644 gdb/d-exp-parser.h
 create mode 100644 gdb/d-exp-parser.y
 rename gdb/{f-exp.y => f-exp-parser.c} (53%)
 create mode 100644 gdb/f-exp-parser.h
 create mode 100644 gdb/f-exp-parser.y
 rename gdb/{go-exp.y => go-exp-parser.c} (59%)
 create mode 100644 gdb/go-exp-parser.h
 create mode 100644 gdb/go-exp-parser.y
 create mode 100644 gdb/m2-exp-parser.c
 create mode 100644 gdb/m2-exp-parser.h
 rename gdb/{m2-exp.y => m2-exp-parser.y} (53%)
 rename gdb/{p-exp.y => p-exp-parser.c} (50%)
 create mode 100644 gdb/p-exp-parser.h
 create mode 100644 gdb/p-exp-parser.y
 create mode 100755 gdb/post-process-parser-output.sh
 delete mode 100644 gdb/yy-remap.h


base-commit: 97feaffb829a5fcf404d2d093062758123e8795f
-- 
2.55.0


             reply	other threads:[~2026-09-04 17:07 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04 16:56 simon.marchi [this message]
2026-09-04 16:56 ` [PATCH 01/17] gdb/ada-exp-parser: remove name_info struct simon.marchi
2026-09-04 16:56 ` [PATCH 02/17] gdb: replace parse_type macros with functions simon.marchi
2026-09-04 16:56 ` [PATCH 03/17] gdb: suffix flex/bison output files with -gen.c simon.marchi
2026-09-04 16:56 ` [PATCH 04/17] gdb: move parser output post-processing to a script simon.marchi
2026-09-05  0:38   ` Kevin Buettner
2026-09-05  3:59     ` Simon Marchi
2026-09-04 16:56 ` [PATCH 05/17] gdb: let the parser and lexer generators prefix their symbols simon.marchi
2026-09-04 16:56 ` [PATCH 06/17] gdb: separate cp-name-parser's symbol prefix with an underscore simon.marchi
2026-09-04 16:56 ` [PATCH 07/17] gdb: make $(YACC) and $(FLEX) generate headers simon.marchi
2026-09-04 16:56 ` [PATCH 08/17] gdb: add check for stale build generated files simon.marchi
2026-09-04 16:56 ` [PATCH 09/17] gdb: move cp-name-parser.y's support code to cp-name-parser.c simon.marchi
2026-09-04 16:56 ` [PATCH 10/17] gdb: rename LANG-exp.y to LANG-exp-parser.y simon.marchi
2026-09-04 16:56 ` [PATCH 11/17] gdb: move c-exp-parser.y's support code to c-exp-parser.c simon.marchi
2026-09-04 16:56 ` [PATCH 12/17] gdb: move ada-exp-parser.y's support code to ada-exp-parser.c simon.marchi
2026-09-05  0:16   ` Kevin Buettner
2026-09-04 16:56 ` [PATCH 13/17] gdb: move d-exp-parser.y's support code to d-exp-parser.c simon.marchi
2026-09-04 16:56 ` [PATCH 14/17] gdb: move f-exp-parser.y's support code to f-exp-parser.c simon.marchi
2026-09-04 16:56 ` [PATCH 15/17] gdb: move go-exp-parser.y's support code to go-exp-parser.c simon.marchi
2026-09-04 16:56 ` [PATCH 16/17] gdb: move m2-exp-parser.y's support code to m2-exp-parser.c simon.marchi
2026-09-05  0:30   ` Kevin Buettner
2026-09-05  4:04     ` Simon Marchi
2026-09-04 16:56 ` [PATCH 17/17] gdb: move p-exp-parser.y's support code to p-exp-parser.c simon.marchi
2026-09-05  0:29   ` Kevin Buettner
2026-09-05  0:50 ` [PATCH 00/17] Move C++ support code out of .y files Kevin Buettner

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=20260904170338.1643894-1-simon.marchi@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --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