All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Masahiro Yamada <masahiroy@kernel.org>
Subject: [PATCH 11/27] kconfig: associate struct menu with file name directly
Date: Sat,  3 Feb 2024 00:58:09 +0900	[thread overview]
Message-ID: <20240202155825.314567-12-masahiroy@kernel.org> (raw)
In-Reply-To: <20240202155825.314567-1-masahiroy@kernel.org>

struct menu is linked to struct file for diagnostic purposes.
It is always used to retrieve the file name through menu->file->name.

Associate struct menu with the file name directly.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/expr.h   | 2 +-
 scripts/kconfig/menu.c   | 6 +++---
 scripts/kconfig/parser.y | 6 +++---
 scripts/kconfig/qconf.cc | 2 +-
 scripts/kconfig/symbol.c | 4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index e0d866569155..e8fc85d98cdd 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -256,7 +256,7 @@ struct menu {
 	char *help;
 
 	/* The location where the menu node appears in the Kconfig files */
-	struct file *file;
+	const char *filename;
 	int lineno;
 
 	/* For use by front ends that need to store auxiliary data */
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index ddca95879631..5ad4d2b9fb82 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -23,7 +23,7 @@ void menu_warn(struct menu *menu, const char *fmt, ...)
 {
 	va_list ap;
 	va_start(ap, fmt);
-	fprintf(stderr, "%s:%d:warning: ", menu->file->name, menu->lineno);
+	fprintf(stderr, "%s:%d:warning: ", menu->filename, menu->lineno);
 	vfprintf(stderr, fmt, ap);
 	fprintf(stderr, "\n");
 	va_end(ap);
@@ -53,7 +53,7 @@ void menu_add_entry(struct symbol *sym)
 	memset(menu, 0, sizeof(*menu));
 	menu->sym = sym;
 	menu->parent = current_menu;
-	menu->file = current_file;
+	menu->filename = cur_filename;
 	menu->lineno = cur_lineno;
 
 	*last_entry_ptr = menu;
@@ -676,7 +676,7 @@ struct menu *menu_get_parent_menu(struct menu *menu)
 static void get_def_str(struct gstr *r, struct menu *menu)
 {
 	str_printf(r, "Defined at %s:%d\n",
-		   menu->file->name, menu->lineno);
+		   menu->filename, menu->lineno);
 }
 
 static void get_dep_str(struct gstr *r, struct expr *expr, const char *prefix)
diff --git a/scripts/kconfig/parser.y b/scripts/kconfig/parser.y
index b9d7e26fc160..d1d05c8cd89d 100644
--- a/scripts/kconfig/parser.y
+++ b/scripts/kconfig/parser.y
@@ -101,7 +101,7 @@ struct menu *current_menu, *current_entry;
 
 %destructor {
 	fprintf(stderr, "%s:%d: missing end statement for this entry\n",
-		$$->file->name, $$->lineno);
+		$$->filename, $$->lineno);
 	if (current_menu == $$)
 		menu_end_menu();
 } if_entry menu_entry choice_entry
@@ -527,11 +527,11 @@ static bool zconf_endtoken(const char *tokenname,
 		yynerrs++;
 		return false;
 	}
-	if (current_menu->file != current_file) {
+	if (strcmp(current_menu->filename, cur_filename)) {
 		zconf_error("'%s' in different file than '%s'",
 			    tokenname, expected_tokenname);
 		fprintf(stderr, "%s:%d: location of the '%s'\n",
-			current_menu->file->name, current_menu->lineno,
+			current_menu->filename, current_menu->lineno,
 			expected_tokenname);
 		yynerrs++;
 		return false;
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 620a3527c767..c6c42c0f4e5d 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1058,7 +1058,7 @@ void ConfigInfoView::menuInfo(void)
 				stream << "<br><br>";
 			}
 
-			stream << "defined at " << _menu->file->name << ":"
+			stream << "defined at " << _menu->filename << ":"
 			       << _menu->lineno << "<br><br>";
 		}
 	}
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index e9e9fb8d8674..7647e3e87cd5 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -1045,12 +1045,12 @@ static void sym_check_print_recursive(struct symbol *last_sym)
 
 		if (sym_is_choice(sym)) {
 			fprintf(stderr, "%s:%d:\tchoice %s contains symbol %s\n",
-				menu->file->name, menu->lineno,
+				menu->filename, menu->lineno,
 				sym->name ? sym->name : "<choice>",
 				next_sym->name ? next_sym->name : "<choice>");
 		} else if (sym_is_choice_value(sym)) {
 			fprintf(stderr, "%s:%d:\tsymbol %s is part of choice %s\n",
-				menu->file->name, menu->lineno,
+				menu->filename, menu->lineno,
 				sym->name ? sym->name : "<choice>",
 				next_sym->name ? next_sym->name : "<choice>");
 		} else if (stack->expr == &sym->dir_dep.expr) {
-- 
2.40.1


  parent reply	other threads:[~2024-02-02 15:58 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-02 15:57 [PATCH 00/27] kconfig: refactor lexer and parser code Masahiro Yamada
2024-02-02 15:57 ` [PATCH 01/27] kconfig: fix infinite loop when expanding a macro at the end of file Masahiro Yamada
2024-02-02 15:58 ` [PATCH 02/27] kconfig: fix off-by-one in zconf_error() Masahiro Yamada
2024-02-02 15:58 ` [PATCH 03/27] kconfig: remove orphan lookup_file() declaration Masahiro Yamada
2024-02-02 15:58 ` [PATCH 04/27] kconfig: remove compat_getline() Masahiro Yamada
2024-02-02 15:58 ` [PATCH 05/27] kconfig: remove unneeded sym_find() call in conf_parse() Masahiro Yamada
2024-02-02 15:58 ` [PATCH 06/27] kconfig: write Kconfig files to autoconf.cmd in order Masahiro Yamada
2024-02-02 15:58 ` [PATCH 07/27] kconfig: call env_write_dep() right after yyparse() Masahiro Yamada
2024-02-02 15:58 ` [PATCH 08/27] kconfig: split preprocessor prototypes into preprocess.h Masahiro Yamada
2024-02-02 15:58 ` [PATCH 09/27] kconfig: replace current_pos with separate cur_{filename,lineno} Masahiro Yamada
2024-02-02 15:58 ` [PATCH 10/27] kconfig: remove zconf_curname() and zconf_lineno() Masahiro Yamada
2024-02-02 15:58 ` Masahiro Yamada [this message]
2024-02-02 15:58 ` [PATCH 12/27] kconfig: associate struct property with file name directly Masahiro Yamada
2024-02-02 15:58 ` [PATCH 13/27] kconfig: replace file->name with name in zconf_nextfile() Masahiro Yamada
2024-02-02 15:58 ` [PATCH 14/27] kconfig: do not delay the cur_filename update Masahiro Yamada
2024-02-02 15:58 ` [PATCH 15/27] kconfig: replace remaining current_file->name with cur_filename Masahiro Yamada
2024-02-02 15:58 ` [PATCH 16/27] kconfig: move the file and lineno in struct file to struct buffer Masahiro Yamada
2024-02-02 15:58 ` [PATCH 17/27] kconfig: make file::name a flexible array member Masahiro Yamada
2024-02-02 15:58 ` [PATCH 18/27] kconfig: change file_lookup() to return the file name Masahiro Yamada
2024-02-02 15:58 ` [PATCH 19/27] kconfig: split list_head into a separate header Masahiro Yamada
2024-02-02 15:58 ` [PATCH 20/27] kconfig: resync list.h Masahiro Yamada
2024-02-02 15:58 ` [PATCH 21/27] kconfig: import more list macros and inline functions Masahiro Yamada
2024-02-02 15:58 ` [PATCH 22/27] kconfig: add macros useful for hashtable Masahiro Yamada
2024-02-02 15:58 ` [PATCH 23/27] kconfig: move ARRAY_SIZE to a header Masahiro Yamada
2024-02-02 15:58 ` [PATCH 24/27] kconfig: move strhash() " Masahiro Yamada
2024-02-02 15:58 ` [PATCH 25/27] kconfig: convert linked list of files to hash table Masahiro Yamada
2024-02-02 15:58 ` [PATCH 26/27] kconfig: use generic macros to implement symbol hashtable Masahiro Yamada
2024-02-02 15:58 ` [PATCH 27/27] kconfig: do not imply the type of choice value Masahiro Yamada
2024-02-10 23:47 ` [PATCH 00/27] kconfig: refactor lexer and parser code Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240202155825.314567-12-masahiroy@kernel.org \
    --to=masahiroy@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.