From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sourceware.org
Cc: simon.marchi@polymtl.ca
Subject: Re: [PATCH 17/17] gdb: move p-exp-parser.y's support code to p-exp-parser.c
Date: Fri, 4 Sep 2026 17:29:37 -0700 [thread overview]
Message-ID: <20260904172937.3f074327@f44-mesa-1> (raw)
In-Reply-To: <20260904170338.1643894-18-simon.marchi@polymtl.ca>
On Fri, 4 Sep 2026 12:56:49 -0400
simon.marchi@polymtl.ca wrote:
> From: Simon Marchi <simon.marchi@polymtl.ca>
>
> Similar to the previous commits, but for the Pascal expression parser.
>
> Like the Fortran parser, the Pascal parser is entered through the
> pascal_language::parser method rather than a free function, so add a free
> function pascal_parse as the entry point (like the other parsers) and turn
> pascal_language::parser into a thin wrapper around it, defined in p-lang.c.
>
> Put the parser support code inside the p_exp_parser namespace.
>
> The Pascal support code uses malloc, realloc and free directly. These used
> to be rewritten to their x-variants by post-process-parser-output.sh when
> the code was part of the generated parser. Replace them with their
> x-variants in the moved code.
>
> Change-Id: Ia9c7c36cde15f408ec89ecb14957f303410b70b2
> ---
> gdb/Makefile.in | 2 +
> gdb/p-exp-parser.c | 954 +++++++++++++++++++++++++++++++++++++++++++++
> gdb/p-exp-parser.h | 84 ++++
> gdb/p-exp-parser.y | 924 +------------------------------------------
> gdb/p-lang.c | 9 +
> 5 files changed, 1051 insertions(+), 922 deletions(-)
> create mode 100644 gdb/p-exp-parser.c
> create mode 100644 gdb/p-exp-parser.h
>
> diff --git a/gdb/Makefile.in b/gdb/Makefile.in
> index 1c4ba5a12d57..9f1e4a5198d0 100644
> --- a/gdb/Makefile.in
> +++ b/gdb/Makefile.in
> @@ -1163,6 +1163,7 @@ COMMON_SFILES = \
> opencl-lang.c \
> osabi.c \
> osdata.c \
> + p-exp-parser.c \
> p-lang.c \
> p-typeprint.c \
> p-valprint.c \
> @@ -1606,6 +1607,7 @@ HFILES_NO_SRCDIR = \
> osdata.h \
> pager.h \
> parser-defs.h \
> + p-exp-parser.h \
> p-lang.h \
> ppc64-tdep.h \
> ppc-fbsd-tdep.h \
> diff --git a/gdb/p-exp-parser.c b/gdb/p-exp-parser.c
> new file mode 100644
> index 000000000000..108c839d3f51
> --- /dev/null
> +++ b/gdb/p-exp-parser.c
> @@ -0,0 +1,954 @@
> +/* YACC parser support code for Pascal expressions, for GDB.
> +
> + Copyright (C) 2000-2026 Free Software Foundation, Inc.
> +
> + This file is part of GDB.
> +
> + This program is free software; you can redistribute it and/or modify
> + it under the terms of the GNU General Public License as published by
> + the Free Software Foundation; either version 3 of the License, or
> + (at your option) any later version.
> +
> + This program is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + GNU General Public License for more details.
> +
> + You should have received a copy of the GNU General Public License
> + along with this program. If not, see <http://www.gnu.org/licenses/>. */
> +
> +#include "p-exp-parser.h"
> +#include "p-exp-parser-gen.h"
> +#include "block.h"
> +#include "expression.h"
> +#include "language.h"
> +#include "value.h"
> +
> +/* The entry point of the bison/yacc-generated parser, defined in
> + p-exp-parser-gen.c. Bison produces a declaration for pascal_yyparse in
> + p-exp-parser-gen.h, but byacc does not, hence this declaration. */
> +
> +int pascal_yyparse ();
> +
> +/* Likewise, byacc does not produce a declaration for pascal_yydebug. */
> +
> +extern int pascal_yydebug;
This is a nit found by AI code review. pascal_yydebug is defined here
as extern, but never used.
Kevin
next prev parent reply other threads:[~2026-09-05 0:30 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 16:56 [PATCH 00/17] Move C++ support code out of .y files simon.marchi
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 [this message]
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=20260904172937.3f074327@f44-mesa-1 \
--to=kevinb@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@polymtl.ca \
/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