All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kconfig: split menu.c out of parser.y
@ 2021-04-13 15:08 Masahiro Yamada
  2021-04-15 10:54 ` Boris Kolpackov
  0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2021-04-13 15:08 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

Compile menu.c as an independent compilation unit.

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

 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 1d1a7f83ee8d..5a215880b268 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 000000000000..2f7298c21b64
--- /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 8b2108b74821..606ba8a63c24 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -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.";
 
diff --git a/scripts/kconfig/parser.y b/scripts/kconfig/parser.y
index e90889edf5b3..2af7ce4e1531 100644
--- a/scripts/kconfig/parser.y
+++ b/scripts/kconfig/parser.y
@@ -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"
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kconfig: split menu.c out of parser.y
  2021-04-13 15:08 [PATCH] kconfig: split menu.c out of parser.y Masahiro Yamada
@ 2021-04-15 10:54 ` Boris Kolpackov
  2021-04-15 12:07   ` Masahiro Yamada
  0 siblings, 1 reply; 3+ messages in thread
From: Boris Kolpackov @ 2021-04-15 10:54 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-kbuild, linux-kernel

Masahiro Yamada <masahiroy@kernel.org> writes:

> --- /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 */

Maybe call it menu.h instead of internal.h? Unless you have plans
to put other "internal" stuff in there.


> --- a/scripts/kconfig/parser.y
> +++ b/scripts/kconfig/parser.y
> @@ -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?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kconfig: split menu.c out of parser.y
  2021-04-15 10:54 ` Boris Kolpackov
@ 2021-04-15 12:07   ` Masahiro Yamada
  0 siblings, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2021-04-15 12:07 UTC (permalink / raw)
  To: Boris Kolpackov; +Cc: Linux Kbuild mailing list, Linux Kernel Mailing List

On Thu, Apr 15, 2021 at 7:54 PM Boris Kolpackov <boris@codesynthesis.com> wrote:
>
> Masahiro Yamada <masahiroy@kernel.org> writes:
>
> > --- /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 */
>
> Maybe call it menu.h instead of internal.h? Unless you have plans
> to put other "internal" stuff in there.


Yes, I will use this header for further cleanups
of headers.



>
> > --- a/scripts/kconfig/parser.y
> > +++ b/scripts/kconfig/parser.y
> > @@ -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.


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-15 12:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-13 15:08 [PATCH] kconfig: split menu.c out of parser.y Masahiro Yamada
2021-04-15 10:54 ` Boris Kolpackov
2021-04-15 12:07   ` Masahiro Yamada

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.