From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 6cMaICiam2pT4SsAWB0awg (envelope-from ) for ; Sat, 05 Sep 2026 00:27:20 -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=nyQhJRZY; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 7AECE1E167; Sat, 05 Sep 2026 00:27:20 -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 CE6371E091 for ; Sat, 05 Sep 2026 00:27:15 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A07094BB58FC for ; Sat, 5 Sep 2026 04:27:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A07094BB58FC 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=nyQhJRZY Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 0BF134BA79AA for ; Sat, 5 Sep 2026 04:26:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0BF134BA79AA 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 0BF134BA79AA 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=1788582368; cv=none; b=Pzarms8mquKEsr9Aldo3lWFenN2/o1txc6PBbGSz9386ORJv6o4rmkQmfts6qOeDN213V1CNLaGo8qscCjZTXMurtzmdj7EtT5yKmOUAiePZsixyvhHDcv/L4oVMPJ8unTUXhLAB1TtZdBxdOliIU6CVMT6B8gc0NUIUflmsSUQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788582368; c=relaxed/simple; bh=18YFJStpSQuCgd1JPueYSe7hFvJQwNxQ+MdrKn+PDOE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=EW3XvPwixUfLy4tJxI4eGU0DOqaCV7qz7As76DRUFirbd0EGXEhYVVJGV54Y6dKSqLN3/89+FHn7niznYdKEzlLq1AYT/CduG4hqbxKfJt5z9ciDohBUrovhIWWV9y6HcA5kGNLDAGKvechmB37U2C8scdjV09v8nhWqyBJ+LyY= 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=nyQhJRZY DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0BF134BA79AA 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 6854Q1hL081807 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 5 Sep 2026 00:26:06 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 6854Q1hL081807 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=oct2025; t=1788582366; bh=YcYR+duzQgyxHjQW9V00X5FbflMqLoXlHmsq4S1RVpY=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=nyQhJRZYLvxj+mGxFibpveg4fvXKSiIIljbAuz6x0Yc1dRlh1z18T8vvCfgSBT8K+ miSYTepj8iCamgXpCA/1mHL1aeeSN14JXQ9p9Bvr2vrK+Hv6DluT+6xd0PhqD6eXRW j5QbTaubde8SQWQb0fxmhcmriO5tcHEENQaU1X3WtgcrBXhLxLoxs6vSFAJHpB3Mvv 8nIsKU1EicbQUU2zvTI5UViygYr4IDNNAKUZKgpB7fKXVgfJ0xpRzOu5coIqMzqNO6 a5fC53+Zp+yqspLjde2yWl+MdlJK4sbKZdTADukuWjCB9BhWnG3e1OAdeZpoy59Lv1 GOmAAYDfeHidQ== Received: by simark.ca (Postfix) id 5A4B01E167; Sat, 05 Sep 2026 00:26:01 -0400 (EDT) From: simon.marchi@polymtl.ca To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH v2 11/19] gdb: rename LANG-exp.y to LANG-exp-parser.y Date: Sat, 5 Sep 2026 00:23:14 -0400 Message-ID: <20260905042353.1702204-12-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260905042353.1702204-1-simon.marchi@polymtl.ca> References: <20260905042353.1702204-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Sat, 5 Sep 2026 04:26:01 +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 I would like to move the hand-written support code out of the expression parsers, the way it was just done for cp-name-parser.y. For consistency, I would like to follow this naming scheme: - LANG-exp-parser.y: bison source file, generates LANG-exp-parser-gen.c and then LANG-exp-parser-gen.o. These files will ultimately only contain the parser rules and the C++ code associated to them, ideally not anything too complex. - LANG-exp-parser.{c,h}: Hand-written support code for the parsers, as well as entry point to the parsers (wrappers around LANG_yyparse). Much of this code currently lives at the bottom of .y files, even though it's just regular C++ code. - The existing files LANG-exp.{c,h} would be reserved for the expression evaluation side of things, which is separate from the parsing. Therefore, rename all the .y files to end with "-parser.y". I think this makes things clear and also consistent with "cp-name-parser.y". Change-Id: I10e8a4de7fa86c2b69b4d62581a9255929237294 --- gdb/.gitignore | 28 +++++++-------- gdb/Makefile.in | 55 +++++++++++++++-------------- gdb/{ada-exp.y => ada-exp-parser.y} | 0 gdb/ada-exp.h | 2 +- gdb/ada-lang.h | 2 +- gdb/ada-lex.l | 2 +- gdb/{c-exp.y => c-exp-parser.y} | 0 gdb/c-lang.h | 2 +- gdb/cp-name-parser.y | 2 +- gdb/{d-exp.y => d-exp-parser.y} | 2 +- gdb/d-lang.h | 2 +- gdb/{f-exp.y => f-exp-parser.y} | 0 gdb/{go-exp.y => go-exp-parser.y} | 8 ++--- gdb/{m2-exp.y => m2-exp-parser.y} | 2 +- gdb/{p-exp.y => p-exp-parser.y} | 2 +- 15 files changed, 55 insertions(+), 54 deletions(-) rename gdb/{ada-exp.y => ada-exp-parser.y} (100%) rename gdb/{c-exp.y => c-exp-parser.y} (100%) rename gdb/{d-exp.y => d-exp-parser.y} (99%) rename gdb/{f-exp.y => f-exp-parser.y} (100%) rename gdb/{go-exp.y => go-exp-parser.y} (99%) rename gdb/{m2-exp.y => m2-exp-parser.y} (99%) rename gdb/{p-exp.y => p-exp-parser.y} (99%) diff --git a/gdb/.gitignore b/gdb/.gitignore index 6b5600dd695e..255cccbb3b24 100644 --- a/gdb/.gitignore +++ b/gdb/.gitignore @@ -5,25 +5,25 @@ /version.c /xml-builtin.c -/ada-exp-gen.c -/ada-exp-gen.h +/ada-exp-parser-gen.c +/ada-exp-parser-gen.h /ada-lex-gen.c /ada-lex-gen.h -/c-exp-gen.c -/c-exp-gen.h +/c-exp-parser-gen.c +/c-exp-parser-gen.h /cp-name-parser-gen.c /cp-name-parser-gen.h -/d-exp-gen.c -/d-exp-gen.h -/f-exp-gen.c -/f-exp-gen.h +/d-exp-parser-gen.c +/d-exp-parser-gen.h +/f-exp-parser-gen.c +/f-exp-parser-gen.h /gdb /gcore -/go-exp-gen.c -/go-exp-gen.h +/go-exp-parser-gen.c +/go-exp-parser-gen.h /init.c /jit-reader.h -/m2-exp-gen.c -/m2-exp-gen.h -/p-exp-gen.c -/p-exp-gen.h +/m2-exp-parser-gen.c +/m2-exp-parser-gen.h +/p-exp-parser-gen.c +/p-exp-parser-gen.h diff --git a/gdb/Makefile.in b/gdb/Makefile.in index a7d79e08655e..1871ef255694 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1232,19 +1232,19 @@ COMMON_SFILES = \ # Links made at configuration time should not be specified here, since # SFILES is used in building the distribution archive. SFILES = \ - ada-exp.y \ + ada-exp-parser.y \ arch/i386.c \ - c-exp.y \ + c-exp-parser.y \ cp-name-parser.y \ - d-exp.y \ + d-exp-parser.y \ dtrace-probe.c \ elf-none-tdep.c \ - f-exp.y \ + f-exp-parser.y \ gcore-elf.c \ gdb.c \ - go-exp.y \ - m2-exp.y \ - p-exp.y \ + go-exp-parser.y \ + m2-exp-parser.y \ + p-exp-parser.y \ proc-service.list \ ser-base.c \ ser-unix.c \ @@ -2059,15 +2059,15 @@ REQUIRED_SUBDIRS = doc | testsuite | data-directory # Parser intermediate files. YYFILES = \ - ada-exp-gen.c \ + ada-exp-parser-gen.c \ ada-lex-gen.c \ - c-exp-gen.c \ + c-exp-parser-gen.c \ cp-name-parser-gen.c \ - d-exp-gen.c \ - f-exp-gen.c \ - go-exp-gen.c \ - m2-exp-gen.c \ - p-exp-gen.c + d-exp-parser-gen.c \ + f-exp-parser-gen.c \ + go-exp-parser-gen.c \ + m2-exp-parser-gen.c \ + p-exp-parser-gen.c # ada-lex-gen.c is included by another file, so it shouldn't wind up as # a .o itself. @@ -2376,7 +2376,7 @@ INIT_FILES_FILTER_OUT = \ INIT_FILES = \ $(patsubst %.o,%.c, \ - $(patsubst %-exp-gen.o,%-exp.y, \ + $(patsubst %-exp-parser-gen.o,%-exp-parser.y, \ $(filter-out $(INIT_FILES_FILTER_OUT), $(COMMON_OBS)))) init.c: stamp-init; @true @@ -2718,12 +2718,13 @@ po/$(PACKAGE).pot: force # # YACC/LEX dependencies # -# LANG-exp-gen.c is generated in objdir from LANG-exp.y if it doesn't -# exist in srcdir, then compiled in objdir to LANG-exp-gen.o. If we -# said LANG-exp-gen.c rather than ./c-exp-gen.c some makes would -# sometimes re-write it into $(srcdir)/c-exp-gen.c. Remove bogus +# LANG-exp-parser-gen.c is generated in objdir from LANG-exp-parser.y if +# it doesn't exist in srcdir, then compiled in objdir to +# LANG-exp-parser-gen.o. If we said LANG-exp-parser-gen.c rather than +# ./c-exp-parser-gen.c some makes would sometimes re-write it into +# $(srcdir)/c-exp-parser-gen.c. Remove bogus # decls for malloc/realloc/free which conflict with everything else. -# Strictly speaking c-exp-gen.c should therefore depend on +# Strictly speaking c-exp-parser-gen.c should therefore depend on # Makefile.in, but that was a pretty big annoyance. # Cancel make's built-in rules for producing a .c file from a .y or .l @@ -2741,15 +2742,15 @@ POST_PROCESS_PARSER_OUTPUT = $(SHELL) $(POST_PROCESS_PARSER_OUTPUT_SH) # The prefix to give to the symbols each parser or lexer generator # produces, so that they can coexist in the same program. There is no # rule tying it to the file name, so spell it out for each one. -YY_PREFIX_ada-exp = ada_yy +YY_PREFIX_ada-exp-parser = ada_yy YY_PREFIX_ada-lex = ada_yy -YY_PREFIX_c-exp = c_yy +YY_PREFIX_c-exp-parser = c_yy YY_PREFIX_cp-name-parser = cpname_yy -YY_PREFIX_d-exp = d_yy -YY_PREFIX_f-exp = f_yy -YY_PREFIX_go-exp = go_yy -YY_PREFIX_m2-exp = m2_yy -YY_PREFIX_p-exp = pascal_yy +YY_PREFIX_d-exp-parser = d_yy +YY_PREFIX_f-exp-parser = f_yy +YY_PREFIX_go-exp-parser = go_yy +YY_PREFIX_m2-exp-parser = m2_yy +YY_PREFIX_p-exp-parser = pascal_yy %-gen.c %-gen.h: %.y $(POST_PROCESS_PARSER_OUTPUT_SH) $(ECHO_YACC) $(SHELL) $(YLWRAP) $< \ diff --git a/gdb/ada-exp.y b/gdb/ada-exp-parser.y similarity index 100% rename from gdb/ada-exp.y rename to gdb/ada-exp-parser.y diff --git a/gdb/ada-exp.h b/gdb/ada-exp.h index be9b441d0c1f..459b7d37b038 100644 --- a/gdb/ada-exp.h +++ b/gdb/ada-exp.h @@ -453,7 +453,7 @@ class ada_structop_operation private: /* We may need to provide a prefix to field name completion. See - ada-exp.y:find_completion_bounds for details. */ + ada-exp-parser.y:find_completion_bounds for details. */ std::string m_prefix; }; diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h index bc821bdaa07f..e224f99dcc19 100644 --- a/gdb/ada-lang.h +++ b/gdb/ada-lang.h @@ -153,7 +153,7 @@ extern int ada_get_field_index (const struct type *type, const char *field_name, int maybe_missing); -extern int ada_parse (struct parser_state *); /* Defined in ada-exp.y */ +extern int ada_parse (struct parser_state *); /* Defined in ada-exp-parser.y */ /* Defined in ada-typeprint.c */ extern void ada_print_type (struct type *, const char *, struct ui_file *, int, diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l index 65989ebd0a56..dab1ad0d0067 100644 --- a/gdb/ada-lex.l +++ b/gdb/ada-lex.l @@ -18,7 +18,7 @@ /*----------------------------------------------------------------------*/ -/* The converted version of this file is to be included in ada-exp.y, */ +/* The converted version of this file is to be included in ada-exp-parser.y, */ /* the Ada parser for gdb. The function yylex obtains characters from */ /* the global pointer lexptr. It returns a syntactic category for */ /* each successive token and places a semantic value into yylval */ diff --git a/gdb/c-exp.y b/gdb/c-exp-parser.y similarity index 100% rename from gdb/c-exp.y rename to gdb/c-exp-parser.y diff --git a/gdb/c-lang.h b/gdb/c-lang.h index dd1fbaefe8eb..f4458f3566db 100644 --- a/gdb/c-lang.h +++ b/gdb/c-lang.h @@ -58,7 +58,7 @@ enum c_string_type_values : unsigned DEF_ENUM_FLAGS_TYPE (enum c_string_type_values, c_string_type); -/* Defined in c-exp.y. */ +/* Defined in c-exp-parser.y. */ extern int c_parse (struct parser_state *); diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y index 687380c4ca68..57247f459fab 100644 --- a/gdb/cp-name-parser.y +++ b/gdb/cp-name-parser.y @@ -2,7 +2,7 @@ Copyright (C) 2003-2026 Free Software Foundation, Inc. - Parts of the lexer are based on c-exp.y from GDB. + Parts of the lexer are based on c-exp-parser.y from GDB. This file is part of GDB. diff --git a/gdb/d-exp.y b/gdb/d-exp-parser.y similarity index 99% rename from gdb/d-exp.y rename to gdb/d-exp-parser.y index 3b3a212cd741..ee23a6c3254c 100644 --- a/gdb/d-exp.y +++ b/gdb/d-exp-parser.y @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -/* This file is derived from c-exp.y, jv-exp.y. */ +/* This file is derived from c-exp-parser.y, jv-exp.y. */ /* Parse a D expression from text in a string, and return the result as a struct expression pointer. diff --git a/gdb/d-lang.h b/gdb/d-lang.h index 7921d3ac804b..e8752ac95306 100644 --- a/gdb/d-lang.h +++ b/gdb/d-lang.h @@ -54,7 +54,7 @@ struct builtin_d_type struct type *builtin_dchar = nullptr; }; -/* Defined in d-exp.y. */ +/* Defined in d-exp-parser.y. */ extern int d_parse (struct parser_state *); diff --git a/gdb/f-exp.y b/gdb/f-exp-parser.y similarity index 100% rename from gdb/f-exp.y rename to gdb/f-exp-parser.y diff --git a/gdb/go-exp.y b/gdb/go-exp-parser.y similarity index 99% rename from gdb/go-exp.y rename to gdb/go-exp-parser.y index 1384c3ebeeec..ce29a00e1228 100644 --- a/gdb/go-exp.y +++ b/gdb/go-exp-parser.y @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -/* This file is derived from c-exp.y, p-exp.y. */ +/* This file is derived from c-exp-parser.y, p-exp-parser.y. */ /* Parse a Go expression from text in a string, and return the result as a struct expression pointer. @@ -626,9 +626,9 @@ name_not_typename LEN is the number of characters in it. */ /* FIXME: Needs some error checking for the float case. */ -/* FIXME(dje): IWBN to use c-exp.y's parse_number if we could. +/* FIXME(dje): IWBN to use c-exp-parser.y's parse_number if we could. That will require moving the guts into a function that we both call - as our YYSTYPE is different than c-exp.y's */ + as our YYSTYPE is different than c-exp-parser.y's */ static int parse_number (struct parser_state *par_state, @@ -1422,7 +1422,7 @@ classify_name (struct parser_state *par_state, const struct block *block) return NAME; } -/* This is taken from c-exp.y mostly to get something working. +/* This is taken from c-exp-parser.y mostly to get something working. The basic structure has been kept because we may yet need some of it. */ static int diff --git a/gdb/m2-exp.y b/gdb/m2-exp-parser.y similarity index 99% rename from gdb/m2-exp.y rename to gdb/m2-exp-parser.y index fae0f86ffdae..0f1c62c7ae52 100644 --- a/gdb/m2-exp.y +++ b/gdb/m2-exp-parser.y @@ -1,6 +1,6 @@ /* YACC grammar for Modula-2 expressions, for GDB. Copyright (C) 1986-2026 Free Software Foundation, Inc. - Generated from expread.y (now c-exp.y) and contributed by the Department + Generated from expread.y (now c-exp-parser.y) and contributed by the Department of Computer Science at the State University of New York at Buffalo, 1991. This file is part of GDB. diff --git a/gdb/p-exp.y b/gdb/p-exp-parser.y similarity index 99% rename from gdb/p-exp.y rename to gdb/p-exp-parser.y index dd4ae2cb209b..0bb2fca36965 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp-parser.y @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -/* This file is derived from c-exp.y */ +/* This file is derived from c-exp-parser.y */ /* Parse a Pascal expression from text in a string, and return the result as a struct expression pointer. -- 2.55.0