From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 6ZLqF7f6mmrw5CgAWB0awg (envelope-from ) for ; Fri, 04 Sep 2026 13:07:03 -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=OAamLrvQ; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 54FDD1E0A3; Fri, 04 Sep 2026 13:07:03 -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 CD94A1E0A3 for ; Fri, 04 Sep 2026 13:07:00 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 731D94BB58CB for ; Fri, 4 Sep 2026 17:07:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 731D94BB58CB 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=OAamLrvQ Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id E938D4BB589D for ; Fri, 4 Sep 2026 17:03:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E938D4BB589D 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 E938D4BB589D 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=1788541436; cv=none; b=okQ2uzzLMnbjrtrZcAxvE3EeyqTaAHUCBpTPaNy0t9WDUyXQ316GYeFsQIXWvcLs3DbTc7ZolERyjmAvf0UrM1AiYguRBU67t3h+LlXZdYhhXmq6AkCuW3pyGM4sOK7pw6yltdsBC4de+DRbHWjJJ227/+ZPai0G6jlFhYICdZw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788541436; c=relaxed/simple; bh=o4ohRmD8FsYsz9ENGO6MLU+jJpgl1cH9akUno0gPigU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=foEWZw11kl31vB+Qul9j7Qb2AG3mHwgNmyJeLzIFs0P+GEpV6JS1iUwuUEcPIwtSNjTJhQPyCjotTlAqdU3yrXzqlUCqHObBodcfV09NHrP16Wup0ApANM85kBtMVcZt80Dmc8a/0eB1J3kBgCADZm3euY87ncwWiazOZSBh/fA= 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=OAamLrvQ DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E938D4BB589D 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 684H3jik141060 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 4 Sep 2026 13:03:51 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 684H3jik141060 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=oct2025; t=1788541432; bh=3SvrFVrXMum4JrTgpgzfzg92MZS5hfLEnKkdkGeZlHs=; h=From:To:Cc:Subject:Date:From; b=OAamLrvQN1dQpmEfxwXX9KO6LBaWlHyJC+2g2u+os1rPVGk3POjPILNdu8xGXO6tS 2F+/ZfQPR30HB3YR7tMVIiHM+zNgecNTo+elltp4qNSLypuk72tEIKwETj6UAHB7PU 0CjlFSBEA8B6Cw3qF2VeMhb75yfVQKD+27B2+hjUtf+vvQCJp5oHp7X3v8FwOgMQyc 0k9UHFgnmA09Qcorw8/ym8JIWAt28sx0XJU1ehYXbEJvPs9+xpfoY8LDL+cfURRG+P 65A7Zsm4kOE01FAp0+Jp1QIlAunm4sbSRPOqMwkc7f+6/kdZTthyAg8Oot+nCNxBDp ITRED0dQIjRqg== Received: by simark.ca (Postfix) id 52C761E033; Fri, 04 Sep 2026 13:03:44 -0400 (EDT) From: simon.marchi@polymtl.ca To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 00/17] Move C++ support code out of .y files Date: Fri, 4 Sep 2026 12:56:32 -0400 Message-ID: <20260904170338.1643894-1-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.55.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 4 Sep 2026 17:03:46 +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 From: Simon Marchi This series stated because I needed to read and potentially edit some code inside a .y and got annoyed that the typical C++ tooling didn't work. The end goal is to move the support code out of .y files and into proper C++ source files next to them. This series uses the yacc flags `-p` (symbol prefix) and `-t` (enable debug code). I tested this series with bison and the byacc package from Arch Linux. I believe that it should work on the various BSDs, but I have not tested (they all have their own byacc flavors I think). The yacc man pages from AIX and Solaris also claim to support them, but I have not tested. In any case, if the native yacc from a less commonly used platform struggles with this, I think it would be fine to ask people to use bison (assuming bison work on that platform). And remember, this is only needed for people who build from git. Generated parsers and lexers are shipped in tarballs. This series uses flex-specific flags, but I think we already required flex anyway (as opposed to other implementations of lex). Simon Marchi (17): gdb/ada-exp-parser: remove name_info struct gdb: replace parse_type macros with functions gdb: suffix flex/bison output files with -gen.c gdb: move parser output post-processing to a script gdb: let the parser and lexer generators prefix their symbols gdb: separate cp-name-parser's symbol prefix with an underscore gdb: make $(YACC) and $(FLEX) generate headers gdb: add check for stale build generated files gdb: move cp-name-parser.y's support code to cp-name-parser.c gdb: rename LANG-exp.y to LANG-exp-parser.y gdb: move c-exp-parser.y's support code to c-exp-parser.c gdb: move ada-exp-parser.y's support code to ada-exp-parser.c gdb: move d-exp-parser.y's support code to d-exp-parser.c gdb: move f-exp-parser.y's support code to f-exp-parser.c gdb: move go-exp-parser.y's support code to go-exp-parser.c gdb: move m2-exp-parser.y's support code to m2-exp-parser.c gdb: move p-exp-parser.y's support code to p-exp-parser.c gdb/.gitignore | 27 +- gdb/Makefile.in | 194 +- gdb/ada-exp-parser.c | 1351 +++++++++++ gdb/ada-exp-parser.h | 427 ++++ gdb/ada-exp-parser.y | 845 +++++++ gdb/ada-exp.h | 2 +- gdb/ada-exp.y | 2019 ---------------- gdb/ada-lang.c | 1 + gdb/ada-lang.h | 2 - gdb/ada-lex.l | 431 +--- gdb/c-exp-parser.c | 1696 ++++++++++++++ gdb/c-exp-parser.h | 182 ++ gdb/c-exp-parser.y | 1858 +++++++++++++++ gdb/c-exp.y | 3626 ----------------------------- gdb/c-lang.h | 6 - gdb/cp-name-parser.c | 1050 +++++++++ gdb/cp-name-parser.h | 130 ++ gdb/cp-name-parser.y | 1120 +-------- gdb/cp-support.c | 4 +- gdb/{d-exp.y => d-exp-parser.c} | 738 +----- gdb/d-exp-parser.h | 83 + gdb/d-exp-parser.y | 600 +++++ gdb/d-lang.c | 1 + gdb/d-lang.h | 4 - gdb/{f-exp.y => f-exp-parser.c} | 982 +------- gdb/f-exp-parser.h | 102 + gdb/f-exp-parser.y | 766 ++++++ gdb/f-lang.c | 9 + gdb/{go-exp.y => go-exp-parser.c} | 736 +----- gdb/go-exp-parser.h | 59 + gdb/go-exp-parser.y | 603 +++++ gdb/go-lang.c | 9 + gdb/language.c | 1 + gdb/m2-exp-parser.c | 488 ++++ gdb/m2-exp-parser.h | 67 + gdb/{m2-exp.y => m2-exp-parser.y} | 467 +--- gdb/m2-lang.c | 9 + gdb/macroexp.c | 6 +- gdb/{p-exp.y => p-exp-parser.c} | 927 +------- gdb/p-exp-parser.h | 84 + gdb/p-exp-parser.y | 752 ++++++ gdb/p-lang.c | 9 + gdb/parser-defs.h | 8 + gdb/post-process-parser-output.sh | 67 + gdb/yy-remap.h | 96 - 45 files changed, 11789 insertions(+), 10855 deletions(-) create mode 100644 gdb/ada-exp-parser.c create mode 100644 gdb/ada-exp-parser.h create mode 100644 gdb/ada-exp-parser.y delete mode 100644 gdb/ada-exp.y create mode 100644 gdb/c-exp-parser.c create mode 100644 gdb/c-exp-parser.h create mode 100644 gdb/c-exp-parser.y delete mode 100644 gdb/c-exp.y create mode 100644 gdb/cp-name-parser.c create mode 100644 gdb/cp-name-parser.h rename gdb/{d-exp.y => d-exp-parser.c} (58%) create mode 100644 gdb/d-exp-parser.h create mode 100644 gdb/d-exp-parser.y rename gdb/{f-exp.y => f-exp-parser.c} (53%) create mode 100644 gdb/f-exp-parser.h create mode 100644 gdb/f-exp-parser.y rename gdb/{go-exp.y => go-exp-parser.c} (59%) create mode 100644 gdb/go-exp-parser.h create mode 100644 gdb/go-exp-parser.y create mode 100644 gdb/m2-exp-parser.c create mode 100644 gdb/m2-exp-parser.h rename gdb/{m2-exp.y => m2-exp-parser.y} (53%) rename gdb/{p-exp.y => p-exp-parser.c} (50%) create mode 100644 gdb/p-exp-parser.h create mode 100644 gdb/p-exp-parser.y create mode 100755 gdb/post-process-parser-output.sh delete mode 100644 gdb/yy-remap.h base-commit: 97feaffb829a5fcf404d2d093062758123e8795f -- 2.55.0