From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +HcYEw6Vm2qhyysAWB0awg (envelope-from ) for ; Sat, 05 Sep 2026 00:05:34 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=d0fwxOzC; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 112C21E09E; Sat, 05 Sep 2026 00:05:34 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id B8DC71E091 for ; Sat, 05 Sep 2026 00:05:32 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 47EB84BB58F3 for ; Sat, 5 Sep 2026 04:05:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 47EB84BB58F3 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=d0fwxOzC Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 3889C4BB58A2 for ; Sat, 5 Sep 2026 04:05:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3889C4BB58A2 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3889C4BB58A2 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788581108; cv=none; b=jxoa0npt1z0VSjRErIhBQ25i71PNpqgtPWt4qp+15QfzKaAlduhASrP4ogTMCwApV0mE0FZ/Nb54RfqrWDu/IlZrOz3gBupMBr3xPOqf+0WqQZKu4z8N8FbfjhxYwIASrvoz1FQng26eZZjbWEAu6AIgmRCvWdVX4UWF4JFg0nE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788581108; c=relaxed/simple; bh=HZCdYzq/l/1Do8zajSb6zJn7N+qMXMPeGF0SBr9t0TU=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=x/WEIO4cLR0QVeTqW+KID47gCaN7zpbLogg+auC0/32UhIjtdP7AFzTPb9/r+kjyvGXZx/LFi0G7KjvRy8ZjS3iZldwjZdAcS/7V47U+3qeF2WMNPNAz6devRwCUu8lYAlMrQ/Az6pUHWzU/6nmkPMWbG0jN1+/59otoaas3Pjs= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=d0fwxOzC DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3889C4BB58A2 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 685450lc076744 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 5 Sep 2026 00:05:05 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 685450lc076744 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=oct2025; t=1788581105; bh=P7IbMmswOgPAHBLAg3yRY/Sv0IEdRnjzzXJxKVBNMDs=; h=Date:Subject:To:From:In-Reply-To:From; b=d0fwxOzCL0YVaQVMt/IxqY7pYkclXQuusfujdqJcDvQoVXlUCFB052+IaA7AyFUli D8Bh+vcDehovf1itAGrthZUeWG/a+CIjwYxXOCjhNqZ0tK0KTQ2B50Zd34CIgKZS06 irE41GAj9Inl2v8AFYekRwg/FIZsCqtfUkcR3ITTraANqUB/4yRzBxLJgdaYSw08VT uPKYJavp7/rxdYZ6Ww7YFv81vdcQptq9hoEwIEZMKbvFNF4mwoL2ruRZqj/kqNzztY zzUUwyagUIC4r56XUNBl7FNtUJ020bLkRofOC9ch2tvI2d7/USSZ+1YFVF8F6iHtk2 nguowb3PMaAWA== Received: by simark.ca (Postfix) id 34AA61E091; Sat, 05 Sep 2026 00:04:59 -0400 (EDT) Message-ID: Date: Sat, 5 Sep 2026 00:04:58 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 16/17] gdb: move m2-exp-parser.y's support code to m2-exp-parser.c To: Kevin Buettner , gdb-patches@sourceware.org References: <20260904170338.1643894-1-simon.marchi@polymtl.ca> <20260904170338.1643894-17-simon.marchi@polymtl.ca> <20260904173018.489d28a8@f44-mesa-1> Content-Language: en-US From: Simon Marchi In-Reply-To: <20260904173018.489d28a8@f44-mesa-1> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Sat, 5 Sep 2026 04:05:00 +0000 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 2026-09-04 20:30, Kevin Buettner wrote: > On Fri, 4 Sep 2026 12:56:48 -0400 > simon.marchi@polymtl.ca wrote: > >> From: Simon Marchi >> >> 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 . */ >> + >> +#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. Ok, I just added them mechanically for all parsers. Most language parsers do something like: scoped_restore restore_yydebug = make_scoped_restore (&c_yydebug, par_state->debug); The m2 and pascal parsers don't, but they probably should. I'll do that and these declarations will end up used. Simon