From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id lxCbG+GTm2owxisAWB0awg (envelope-from ) for ; Sat, 05 Sep 2026 00:00:33 -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=LSbHcr2X; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 3CA831E09E; Sat, 05 Sep 2026 00:00:33 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.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 autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::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 4E8031E091 for ; Sat, 05 Sep 2026 00:00:31 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D019F4BB58FE for ; Sat, 5 Sep 2026 04:00:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D019F4BB58FE 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=LSbHcr2X Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 15F874BB3BAC for ; Sat, 5 Sep 2026 04:00:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 15F874BB3BAC 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 15F874BB3BAC 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=1788580806; cv=none; b=ex5EbUIEtxiuqB35JPMEGrmWs9z5Oq7ciUc72H7ZCN9p6bGhLV3AFjcDAv9RZS0dpe8WisCwAhjEGEWuT5wMgpXRDvLmyG5ZmpBStQNjj82UOVTD9XFTh/RZg3dqHywBpd91m7aD2E35o0Fm7cc32DBPoaFMADEYvhutAKWS30w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788580806; c=relaxed/simple; bh=nIq4KLxjFID4eX4+dqDeLKk2w4P/rCloifgfTiVymEE=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=ZeGfXyymN4XFdTe4Rm87lEfmb/q6/pXS7lvgLWZsHXBO6qnitoGrD/qrukMh++EC2WUJBQZeqmZoR7h/yru1Ku8W7hXsBm32daJBa+bK74LXlvsxn6APSQD/i6s/y6FvlWmQ+FgntqnQphrXnKXjnh9UitWOarl7+Jqb/mt85Wg= 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=LSbHcr2X DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 15F874BB3BAC 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 6853xte9075337 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 5 Sep 2026 00:00:00 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 6853xte9075337 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=oct2025; t=1788580802; bh=vBOKYtHbQP3nTfIpvZvd7Yr5j9U6dDQP6T/vhwgrg10=; h=Date:Subject:To:From:In-Reply-To:From; b=LSbHcr2Xgb03Xuev1P5hIE9wDEynEiWc7QYiGzFabd2jg3osVMIk5v/cvgSP7BKuu 6tFL+DxQgvqwMZCRNDBgdNQmkPm7lsUrQITI4g0qNk8BU9AlTHXnR3Q9hopBMOenEp 2xVmBUAVIi6oSJkK+ciRbO7O4uwXMw5RM+xm+QWEj2MdYBSKDMIxnThW/NETaX+Byq V0vwtidOf7FB0OfYemg88bA7zsTZFr2zJHRqcIA1eW26oni2GuyQYPJigMuYINirZ9 cbS25TBe3kKnYPycroiWxuNzq7P2TwlTaR3qxmF72UOfnudPJ5V2i0OQSNz2R+wDNu VKBN9iTfc69gg== Received: by simark.ca (Postfix) id 33F641E09B; Fri, 04 Sep 2026 23:59:55 -0400 (EDT) Message-ID: <8dbb9d36-b55f-4954-9fb5-4242261c2641@polymtl.ca> Date: Fri, 4 Sep 2026 23:59:54 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 04/17] gdb: move parser output post-processing to a script To: Kevin Buettner , gdb-patches@sourceware.org References: <20260904170338.1643894-1-simon.marchi@polymtl.ca> <20260904170338.1643894-5-simon.marchi@polymtl.ca> <20260904173835.303e34d8@f44-mesa-1> Content-Language: en-US From: Simon Marchi In-Reply-To: <20260904173835.303e34d8@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 03:59:55 +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:38, Kevin Buettner wrote: > 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. Thanks, that made me look into why we do this substitution at all, and it was become at some point before 2013, bison in C++11 mode would output: #define YY_NULL nullptr while flex would output #define YY_NULL 0 To avoid the clash, we would rename the bison one. It's been fixed in bison 3.0.2, where it was renamed YY_NULLPTR. I think it's safe to assume that any GDB dev today will not use a 13 year old bison, so I will just remove it. Simon