From a77a05dc9cf24a8c88b9d9c70e8984f936d075f3 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 14 Apr 2021 00:08:17 +0900 Subject: [PATCH] kconfig: split menu.c out of parser.y Compile menu.c as an independent compilation unit. Signed-off-by: Masahiro Yamada --- scripts/kconfig/Makefile | 4 ++-- scripts/kconfig/internal.h | 9 +++++++++ scripts/kconfig/menu.c | 1 + scripts/kconfig/parser.y | 5 ++--- 4 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 scripts/kconfig/internal.h diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 1d1a7f8..5a21588 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -143,8 +143,8 @@ help: # =========================================================================== # object files used by all kconfig flavours -common-objs := confdata.o expr.o lexer.lex.o parser.tab.o preprocess.o \ - symbol.o util.o +common-objs := confdata.o expr.o lexer.lex.o menu.o parser.tab.o \ + preprocess.o symbol.o util.o $(obj)/lexer.lex.o: $(obj)/parser.tab.h HOSTCFLAGS_lexer.lex.o := -I $(srctree)/$(src) diff --git a/scripts/kconfig/internal.h b/scripts/kconfig/internal.h new file mode 100644 index 0000000..2f7298c --- /dev/null +++ b/scripts/kconfig/internal.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef INTERNAL_H +#define INTERNAL_H + +struct menu; + +extern struct menu *current_menu, *current_entry; + +#endif /* INTERNAL_H */ diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 8b2108b..606ba8a 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -9,6 +9,7 @@ #include #include "lkc.h" +#include "internal.h" static const char nohelp_text[] = "There is no help available for this option."; diff --git a/scripts/kconfig/parser.y b/scripts/kconfig/parser.y index e90889e..2af7ce4 100644 --- a/scripts/kconfig/parser.y +++ b/scripts/kconfig/parser.y @@ -12,6 +12,7 @@ #include #include "lkc.h" +#include "internal.h" #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) @@ -28,7 +29,7 @@ static bool zconf_endtoken(const char *tokenname, struct symbol *symbol_hash[SYMBOL_HASHSIZE]; -static struct menu *current_menu, *current_entry; +struct menu *current_menu, *current_entry; %} @@ -713,5 +714,3 @@ void zconfdump(FILE *out) } } } - -#include "menu.c" -- 2.7.4