From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id QVVhGJv6mmrw5CgAWB0awg (envelope-from ) for ; Fri, 04 Sep 2026 13:06:35 -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=t0SLWf9k; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 5B1011E166; Fri, 04 Sep 2026 13:06:35 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.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,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham 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 BBC331E033 for ; Fri, 04 Sep 2026 13:06:33 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E64C54BB3BBD for ; Fri, 4 Sep 2026 17:06:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E64C54BB3BBD 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=t0SLWf9k Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 9EA954BB5880 for ; Fri, 4 Sep 2026 17:05:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9EA954BB5880 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 9EA954BB5880 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=1788541556; cv=none; b=ieOHb3CRJtaO5RfRhs/HEnT1YrJeJ04aNbfxp2PhRk+/g+wJG9g+WnuqshD6UEikK8cOKlgJ6/G7ykraup9z/B60oEVA4Vd+9zaSy78uUdiv/6pATC6vmLaV+kkW2QvCfzc5vjNEW4hZ8P7OmBrAeRatHqEaWXHrCNHXm5QD9LM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788541556; c=relaxed/simple; bh=18YFJStpSQuCgd1JPueYSe7hFvJQwNxQ+MdrKn+PDOE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=MEsqG96O50IX+oLfg8reRxbvSke9Y6ppH43C0gtAsKHJggFLDOo834vzcjDI6C+quFEKHr8phb5XtVwWo6h0F3raExvot1aJhtzHH2YgXpQRTrgYuTwaLlKM2Lukd+MlmTQjpG86HWyfkDQfZllq3lcxdNnt4KHtokFJbXGVbSw= 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=t0SLWf9k DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9EA954BB5880 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 684H5ob8142351 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 4 Sep 2026 13:05:55 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 684H5ob8142351 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=oct2025; t=1788541555; bh=YcYR+duzQgyxHjQW9V00X5FbflMqLoXlHmsq4S1RVpY=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=t0SLWf9kKWY0mp6UuX1CSnbaUwBAEQEXd1mw+aFgn+g2L5hMdjsjfId85UziVyuof vPu1UKVUqkRx8Fro1kYNc1F/vwjwOZuBer/xi6Q3BKMhfhGC3PTim3kCnMfKZRjFuo 2z01TAclNOBhu3t9viyehEFb1vM4BpJUA1ztM9afL2m2H0I2t5zFUrQSz1u32VGwQx cqAV7d/+PgULUaaKjH3gncZitw/gHDn8oREGpkf2ZfYnbCd3FOG6okUkJiVEMh97HP 2v5Grdk57BfnSzWuhZGo8Ud+3jhWhN3sja1vKHCWEMzSXC8Kvh0chUY9NZLm5iJ0oN Zd3vJ6CF5cyKw== Received: by simark.ca (Postfix) id 429901E166; Fri, 04 Sep 2026 13:05:49 -0400 (EDT) From: simon.marchi@polymtl.ca To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 10/17] gdb: rename LANG-exp.y to LANG-exp-parser.y Date: Fri, 4 Sep 2026 12:56:42 -0400 Message-ID: <20260904170338.1643894-11-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260904170338.1643894-1-simon.marchi@polymtl.ca> References: <20260904170338.1643894-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 4 Sep 2026 17:05:50 +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