From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id UTiPLptim2q1zCoAWB0awg (envelope-from ) for ; Fri, 04 Sep 2026 20:30:19 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=E4sSGcz7; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id BAE3F1E033; Fri, 04 Sep 2026 20:30:19 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,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=unavailable 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 E7A961E033 for ; Fri, 04 Sep 2026 20:30:18 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 97D3B4BB58D4 for ; Sat, 5 Sep 2026 00:30:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 97D3B4BB58D4 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=E4sSGcz7 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 79B494BB3B96 for ; Sat, 5 Sep 2026 00:29:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 79B494BB3B96 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 79B494BB3B96 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788568186; cv=none; b=iiRhREQ36OuYlSGeP5dV1YOxmFOGg9yP7LxWbL95yfOGaWpPmhFdaI6YCe+tQSYlRdR1dYmGhVgrdqzFnVWzqivhozZIv/3ywKkpUkUf5pS81U+Bg82DRO0THmBjGdgpnQAe0T4Jg+0BccPcI+UCeP5cuX84n9ALk/JcMS7xVA0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788568186; c=relaxed/simple; bh=VAGdInUu31mXqV3AL+3B9yko/wYkfd997/SuHF4neRY=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=MkhcxB7+krphkN8EA16JAGlAVtFQBZ5qVoeW4NzhYj2UWHDx/c5euDtr/lWW3S0sttGNZeEBl3Y3VMDY+TUvDrOtkmbMNZlCvruybRPAeCAfzlwyKeoK55HWBGtsL6HaOMOx4cX6HazKo2O++Rvmh3IoYJuAE8MhM9NQS76E8fw= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=E4sSGcz7 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 79B494BB3B96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1788568186; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TGe4oSsAnv6pFy+vxOCr500EL2dXwnE35KE/8IvhbFY=; b=E4sSGcz7b7MWmt2QauEMe7KfR6INIrr7uTjYKjNZSpPITA0GluGMyJxQOMG3VfTKe0/euL BJt0BfEyo+So9XE9/n3vOcG+WwAorECb0dts1U2/KeIefDRX1aezSnRQWElftt9BRBX11+ xFsVoOW+BNjlHE6V8ELj0rH5yWZZ16s= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-209-ZNyTLqkQPomI80ehVA2URQ-1; Fri, 04 Sep 2026 20:29:42 -0400 X-MC-Unique: ZNyTLqkQPomI80ehVA2URQ-1 X-Mimecast-MFC-AGG-ID: ZNyTLqkQPomI80ehVA2URQ_1788568181 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 83D5F1893EEC; Sat, 5 Sep 2026 00:29:41 +0000 (UTC) Received: from f44-mesa-1 (unknown [10.22.64.36]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6629230002F4; Sat, 5 Sep 2026 00:29:40 +0000 (UTC) Date: Fri, 4 Sep 2026 17:29:37 -0700 From: Kevin Buettner 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 Message-ID: <20260904172937.3f074327@f44-mesa-1> In-Reply-To: <20260904170338.1643894-18-simon.marchi@polymtl.ca> References: <20260904170338.1643894-1-simon.marchi@polymtl.ca> <20260904170338.1643894-18-simon.marchi@polymtl.ca> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: H8JODcDl7kEDYKFdksE6RmHw34XLpmzwrYI_Hz56a5A_1788568181 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 Fri, 4 Sep 2026 12:56:49 -0400 simon.marchi@polymtl.ca wrote: > From: Simon Marchi > > 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 . */ > + > +#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