Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sourceware.org
Cc: simon.marchi@polymtl.ca
Subject: Re: [PATCH 16/17] gdb: move m2-exp-parser.y's support code to m2-exp-parser.c
Date: Fri, 4 Sep 2026 17:30:18 -0700	[thread overview]
Message-ID: <20260904173018.489d28a8@f44-mesa-1> (raw)
In-Reply-To: <20260904170338.1643894-17-simon.marchi@polymtl.ca>

On Fri,  4 Sep 2026 12:56:48 -0400
simon.marchi@polymtl.ca wrote:

> From: Simon Marchi <simon.marchi@polymtl.ca>
> 
> Similar to the previous commits, but for the Modula-2 expression parser.
> 
> Like the Fortran parser, the Modula-2 parser is entered through the
> m2_language::parser method rather than a free function, so add a free
> function m2_parse as the entry point (like the other parsers) and turn
> m2_language::parser into a thin wrapper around it, defined in m2-lang.c.
> 
> Put the parser support code inside the m2_exp_parser namespace.
> 
> Change-Id: I92669a1af7fb81cf59bfb41e2b8c63ce323652d2
> ---
>  gdb/Makefile.in     |   2 +
>  gdb/m2-exp-parser.c | 488 ++++++++++++++++++++++++++++++++++++++++++++
>  gdb/m2-exp-parser.h |  67 ++++++
>  gdb/m2-exp-parser.y | 465 +----------------------------------------
>  gdb/m2-lang.c       |   9 +
>  5 files changed, 568 insertions(+), 463 deletions(-)
>  create mode 100644 gdb/m2-exp-parser.c
>  create mode 100644 gdb/m2-exp-parser.h
> 
> diff --git a/gdb/Makefile.in b/gdb/Makefile.in
> index 4289c5151fd0..1c4ba5a12d57 100644
> --- a/gdb/Makefile.in
> +++ b/gdb/Makefile.in
> @@ -1137,6 +1137,7 @@ COMMON_SFILES = \
>  	language.c \
>  	linespec.c \
>  	location.c \
> +	m2-exp-parser.c \
>  	m2-lang.c \
>  	m2-typeprint.c \
>  	m2-valprint.c \
> @@ -1518,6 +1519,7 @@ HFILES_NO_SRCDIR = \
>  	linux-tdep.h \
>  	location.h \
>  	loongarch-tdep.h \
> +	m2-exp-parser.h \
>  	m2-exp.h \
>  	m2-lang.h \
>  	m32r-tdep.h \
> diff --git a/gdb/m2-exp-parser.c b/gdb/m2-exp-parser.c
> new file mode 100644
> index 000000000000..821f1507aef3
> --- /dev/null
> +++ b/gdb/m2-exp-parser.c
> @@ -0,0 +1,488 @@
> +/* YACC parser support code for Modula-2 expressions, for GDB.
> +
> +   Copyright (C) 1986-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 "m2-exp-parser.h"
> +#include "m2-exp-parser-gen.h"
> +#include "block.h"
> +#include "expression.h"
> +#include "language.h"
> +#include "m2-exp.h"
> +#include "parser-defs.h"
> +#include "value.h"
> +
> +/* The entry point of the bison/yacc-generated parser, defined in
> +   m2-exp-parser-gen.c.  Bison produces a declaration for m2_yyparse in
> +   m2-exp-parser-gen.h, but byacc does not, hence this declaration.  */
> +
> +int m2_yyparse ();
> +
> +/* Likewise, byacc does not produce a declaration for m2_yydebug.  */
> +
> +extern int m2_yydebug;

Another nit found by the AI patch reviewer; it notes that the extern
for m2_yydebug is never used.  But it also noted that this was
pre-existing behavior.

Kevin


  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 [this message]
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=20260904173018.489d28a8@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