Commit 40bab83a authored by Masahiro Yamada's avatar Masahiro Yamada

kconfig: associate struct menu with file name directly

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: default avatarMasahiro Yamada <masahiroy@kernel.org>
parent 1d7c4f10
...@@ -256,7 +256,7 @@ struct menu { ...@@ -256,7 +256,7 @@ struct menu {
char *help; char *help;
/* The location where the menu node appears in the Kconfig files */ /* The location where the menu node appears in the Kconfig files */
struct file *file; const char *filename;
int lineno; int lineno;
/* For use by front ends that need to store auxiliary data */ /* For use by front ends that need to store auxiliary data */
......
...@@ -23,7 +23,7 @@ void menu_warn(struct menu *menu, const char *fmt, ...) ...@@ -23,7 +23,7 @@ void menu_warn(struct menu *menu, const char *fmt, ...)
{ {
va_list ap; va_list ap;
va_start(ap, fmt); 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); vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n"); fprintf(stderr, "\n");
va_end(ap); va_end(ap);
...@@ -53,7 +53,7 @@ void menu_add_entry(struct symbol *sym) ...@@ -53,7 +53,7 @@ void menu_add_entry(struct symbol *sym)
memset(menu, 0, sizeof(*menu)); memset(menu, 0, sizeof(*menu));
menu->sym = sym; menu->sym = sym;
menu->parent = current_menu; menu->parent = current_menu;
menu->file = current_file; menu->filename = cur_filename;
menu->lineno = cur_lineno; menu->lineno = cur_lineno;
*last_entry_ptr = menu; *last_entry_ptr = menu;
...@@ -676,7 +676,7 @@ struct menu *menu_get_parent_menu(struct menu *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) static void get_def_str(struct gstr *r, struct menu *menu)
{ {
str_printf(r, "Defined at %s:%d\n", 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) static void get_dep_str(struct gstr *r, struct expr *expr, const char *prefix)
......
...@@ -101,7 +101,7 @@ struct menu *current_menu, *current_entry; ...@@ -101,7 +101,7 @@ struct menu *current_menu, *current_entry;
%destructor { %destructor {
fprintf(stderr, "%s:%d: missing end statement for this entry\n", fprintf(stderr, "%s:%d: missing end statement for this entry\n",
$$->file->name, $$->lineno); $$->filename, $$->lineno);
if (current_menu == $$) if (current_menu == $$)
menu_end_menu(); menu_end_menu();
} if_entry menu_entry choice_entry } if_entry menu_entry choice_entry
...@@ -527,11 +527,11 @@ static bool zconf_endtoken(const char *tokenname, ...@@ -527,11 +527,11 @@ static bool zconf_endtoken(const char *tokenname,
yynerrs++; yynerrs++;
return false; return false;
} }
if (current_menu->file != current_file) { if (strcmp(current_menu->filename, cur_filename)) {
zconf_error("'%s' in different file than '%s'", zconf_error("'%s' in different file than '%s'",
tokenname, expected_tokenname); tokenname, expected_tokenname);
fprintf(stderr, "%s:%d: location of the '%s'\n", fprintf(stderr, "%s:%d: location of the '%s'\n",
current_menu->file->name, current_menu->lineno, current_menu->filename, current_menu->lineno,
expected_tokenname); expected_tokenname);
yynerrs++; yynerrs++;
return false; return false;
......
...@@ -1058,7 +1058,7 @@ void ConfigInfoView::menuInfo(void) ...@@ -1058,7 +1058,7 @@ void ConfigInfoView::menuInfo(void)
stream << "<br><br>"; stream << "<br><br>";
} }
stream << "defined at " << _menu->file->name << ":" stream << "defined at " << _menu->filename << ":"
<< _menu->lineno << "<br><br>"; << _menu->lineno << "<br><br>";
} }
} }
......
...@@ -1045,12 +1045,12 @@ static void sym_check_print_recursive(struct symbol *last_sym) ...@@ -1045,12 +1045,12 @@ static void sym_check_print_recursive(struct symbol *last_sym)
if (sym_is_choice(sym)) { if (sym_is_choice(sym)) {
fprintf(stderr, "%s:%d:\tchoice %s contains symbol %s\n", fprintf(stderr, "%s:%d:\tchoice %s contains symbol %s\n",
menu->file->name, menu->lineno, menu->filename, menu->lineno,
sym->name ? sym->name : "<choice>", sym->name ? sym->name : "<choice>",
next_sym->name ? next_sym->name : "<choice>"); next_sym->name ? next_sym->name : "<choice>");
} else if (sym_is_choice_value(sym)) { } else if (sym_is_choice_value(sym)) {
fprintf(stderr, "%s:%d:\tsymbol %s is part of choice %s\n", 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>", sym->name ? sym->name : "<choice>",
next_sym->name ? next_sym->name : "<choice>"); next_sym->name ? next_sym->name : "<choice>");
} else if (stack->expr == &sym->dir_dep.expr) { } else if (stack->expr == &sym->dir_dep.expr) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment