From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id kffIJ6xkm2o91yoAWB0awg (envelope-from ) for ; Fri, 04 Sep 2026 20:39:08 -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=NpwUZBai; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 9CF051E166; Fri, 04 Sep 2026 20:39:08 -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 A30201E033 for ; Fri, 04 Sep 2026 20:39:07 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 216504BB58B3 for ; Sat, 5 Sep 2026 00:39:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 216504BB58B3 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=NpwUZBai Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 6A2AB4BA23E4 for ; Sat, 5 Sep 2026 00:38:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6A2AB4BA23E4 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 6A2AB4BA23E4 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788568721; cv=none; b=AgCD4zV5FRnD0joilpXibYWYqiBDggU9emuxF43zDLuzkQ9X8YmcKa29eAuPwnpijm1/Rhynh9PUV6W8te4nOiaGdssgav/TKaoP3Q8lcb60fGBPpcoxt7Tgd5mu0828OXqFzWt5c2X5kZEqppPIaXhEcL9kC2AyBz6Li/eqG4I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788568721; c=relaxed/simple; bh=ZEiwNVSl7pUInOBnnv5T/jzmydHuwIpZbEeNBPpGSSk=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=Kun77gUamJ0Ob3JX6/CcyNK4P0MCOtRhNmJkhrkvwDD6c4IXbgnjxcpPCcO6oIePXm2WqBNaqaozMe3KI8DGGAhFhD9VRHXH2esjewVeGFcTN5sTTG8K3wlvLL4Wy2WUIPoNRagIThlezEaFUQcpHBBqqsMkU37Su0cu4LdvE3g= 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=NpwUZBai DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6A2AB4BA23E4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1788568721; 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=n/g+eZFc7fApERZPkOsf9ZPvzpSSVD0JzYfXstszOVg=; b=NpwUZBaiIc9YGBdot/BKA4EXZvc3MdyXBdv9TL6LEB3BawzUUEYKWjqzH70Dko2ffhoL4O KcNVnFcrF6t0KwdKPXL78wKCVXFchD0yN+wdwreaYZzt2CaYJliK9MsXJvLvvBoa4liDGP DvflBGwBdlIb3vzy/Gkzho2OBW1YK7A= 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-444-Xb1fW7FdMwqPTj91N9S6SA-1; Fri, 04 Sep 2026 20:38:39 -0400 X-MC-Unique: Xb1fW7FdMwqPTj91N9S6SA-1 X-Mimecast-MFC-AGG-ID: Xb1fW7FdMwqPTj91N9S6SA_1788568718 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 7AA3718862E6; Sat, 5 Sep 2026 00:38:38 +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 B3B5D30002F4; Sat, 5 Sep 2026 00:38:37 +0000 (UTC) Date: Fri, 4 Sep 2026 17:38:35 -0700 From: Kevin Buettner To: gdb-patches@sourceware.org Cc: simon.marchi@polymtl.ca Subject: Re: [PATCH 04/17] gdb: move parser output post-processing to a script Message-ID: <20260904173835.303e34d8@f44-mesa-1> In-Reply-To: <20260904170338.1643894-5-simon.marchi@polymtl.ca> References: <20260904170338.1643894-1-simon.marchi@polymtl.ca> <20260904170338.1643894-5-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: WxGWrjkn7n_UVYNGGsbIGaJ6bSSYgKcART0l3IOQAsI_1788568718 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:36 -0400 simon.marchi@polymtl.ca wrote: > diff --git a/gdb/post-process-parser-output.sh b/gdb/post-process-parser-output.sh > new file mode 100755 > index 000000000000..b246e63ddff1 > --- /dev/null > +++ b/gdb/post-process-parser-output.sh > @@ -0,0 +1,67 @@ > +#!/bin/sh > + > +# Copyright (C) 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 . > + > +# Post-process a file produced by flex or bison/byacc, reading it from > +# standard input and writing the result to standard output. > +# > +# Usage: > +# > +# ./post-process-parser-output.sh GENERATOR NAME < INPUT > OUTPUT > +# > +# Where GENERATOR is "bison" (regardless of whether we're using the actual > +# bison or byacc) or "flex", and NAME is the name of the parser (e.g. > +# "cp-name-parser"), used to make the global symbols names bison produces > +# unique. > + > +set -e > + > +generator="$1" > + > +# Convert e.g. "cp-name-parser" to "cp_name_parser". > +name=$(echo "$2" | sed -e 's/-/_/g') > + > +common=' > +/extern.*malloc/d > +/extern.*realloc/d > +/extern.*free/d > +/include.*malloc.h/d > +s/\([^x]\)malloc/\1xmalloc/g > +s/\([^x]\)realloc/\1xrealloc/g > +s/\([ \t;,(]\)free\([ \t]*[&(),]\)/\1xfree\2/g > +s/\([ \t;,(]\)free$/\1xfree/g > +' > + > +case "$generator" in > + bison) > + sed -e "$common" \ > + -e '/^#line.*y.tab.c/d' \ > + -e 's/YY_NULL/YY_NULLPTR/g' \ Another (pre-existing) nit found by AI code review: post-process-parser-output.sh:53: s/YY_NULL/YY_NULLPTR/g also matches inside YY_NULLPTR, producing YY_NULLPTRPTR; harmless (guarded by #ifndef), faithfully carried over from the old Makefile sed. Opportunity to fix with word boundaries. > + -e "s/YYSTYPE/${name}_YYSTYPE/g" \ > + -e "s/yyalloc/${name}_yyalloc/g" \ > + -e "s/yysymbol_kind_t/${name}_yysymbol_kind_t/g" > + ;; > + flex) > + sed -e "$common" \ > + -e 's/yy_flex_xrealloc/yyxrealloc/g' > + ;; > + *) > + echo "$0: unknown parser generator \"$generator\"" >&2 > + exit 1 > + ;; > +esac > -- > 2.55.0 >