kconfig: split menu.c out of parser.y
PATCH 1/1 kconfig: split menu.c out of parser.y
Compile menu.c as an independent compilation unit.
---
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
scripts/kconfig/Makefile +2 -2
@@ -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)
scripts/kconfig/internal.h new file +9 -0
@@ -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 */
scripts/kconfig/menu.c +1 -0
@@ -9,6 +9,7 @@#include <string.h> #include "lkc.h" +#include "internal.h" static const char nohelp_text[] ="There is no help available for this option." ;
scripts/kconfig/parser.y +2 -3
@@ -12,6 +12,7 @@ #include <stdbool.h> #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"
Signature · 1 line
2.27.0
scripts/kconfig/internal.h line 9
Quoted 12 lines · Masahiro Yamada
scripts/kconfig/internal.h new file +9
-0@@ -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 */
Maybe call it menu.h instead of internal.h? Unless you have plans to put other "internal" stuff in there.
scripts/kconfig/parser.y static bool zconf_endtoken(const char *tokenname, · line 32
Quoted 8 lines
scripts/kconfig/parser.y +1
-1@@ -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;
Why not put these in menu.c?
Quoted 18 lines · Boris Kolpackov
scripts/kconfig/internal.h line 9
Quoted 12 lines · Masahiro Yamada
scripts/kconfig/internal.h new file +9
-0@@ -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 */ Maybe call it
menu.hinstead ofinternal.h? Unless you have plans to put other "internal" stuff in there.
Yes, I will use this header for further cleanups
of headers.
Quoted 11 lines
scripts/kconfig/parser.y static bool zconf_endtoken(const char *tokenname, · line 32
Quoted 9 lines
scripts/kconfig/parser.y +1
-1@@ -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;Why not put these in
menu.c?
These variables are defined here
before I started to maintain Kconfig.
For now, I am just removing the 'static' directive.
Signature · 2 lines
Best Regards Masahiro Yamada