[RFC PATCH 1/3] kconfig: move declarations for prepossessing to internal.h

From: Masahiro Yamada
Date: Fri Aug 19 2022 - 02:58:42 EST


These are used by the kconfig core part.

The user interface part (conf, mconf, nconf, gconf, or xconf variants)
does not need them.

Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
---

scripts/kconfig/confdata.c | 1 +
scripts/kconfig/internal.h | 17 +++++++++++++++++
scripts/kconfig/lexer.l | 1 +
scripts/kconfig/lkc_proto.h | 13 -------------
scripts/kconfig/preprocess.c | 1 +
5 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index c4340c90e172..aa8e73828de3 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -19,6 +19,7 @@
#include <unistd.h>

#include "lkc.h"
+#include "internal.h"

/* return true if 'path' exists, false otherwise */
static bool is_present(const char *path)
diff --git a/scripts/kconfig/internal.h b/scripts/kconfig/internal.h
index 2f7298c21b64..8e0e6d315b6c 100644
--- a/scripts/kconfig/internal.h
+++ b/scripts/kconfig/internal.h
@@ -1,4 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Declarations necessary for the kconfig core, but not for
+ * conf, mconf, nconf, gconf, or xconf variants.
+ */
#ifndef INTERNAL_H
#define INTERNAL_H

@@ -6,4 +10,17 @@ struct menu;

extern struct menu *current_menu, *current_entry;

+/* preprocess.c */
+enum variable_flavor {
+ VAR_SIMPLE,
+ VAR_RECURSIVE,
+ VAR_APPEND,
+};
+void env_write_dep(FILE *f, const char *auto_conf_name);
+void variable_add(const char *name, const char *value,
+ enum variable_flavor flavor);
+void variable_all_del(void);
+char *expand_dollar(const char **str);
+char *expand_one_token(const char **str);
+
#endif /* INTERNAL_H */
diff --git a/scripts/kconfig/lexer.l b/scripts/kconfig/lexer.l
index cc386e443683..43e12d0945a7 100644
--- a/scripts/kconfig/lexer.l
+++ b/scripts/kconfig/lexer.l
@@ -14,6 +14,7 @@
#include <string.h>

#include "lkc.h"
+#include "internal.h"
#include "parser.tab.h"

#define YY_DECL static int yylex1(void)
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h
index edd1e617b25c..7fb4953d16ca 100644
--- a/scripts/kconfig/lkc_proto.h
+++ b/scripts/kconfig/lkc_proto.h
@@ -35,18 +35,5 @@ const char * sym_get_string_value(struct symbol *sym);

const char * prop_get_type_name(enum prop_type type);

-/* preprocess.c */
-enum variable_flavor {
- VAR_SIMPLE,
- VAR_RECURSIVE,
- VAR_APPEND,
-};
-void env_write_dep(FILE *f, const char *auto_conf_name);
-void variable_add(const char *name, const char *value,
- enum variable_flavor flavor);
-void variable_all_del(void);
-char *expand_dollar(const char **str);
-char *expand_one_token(const char **str);
-
/* expr.c */
void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken);
diff --git a/scripts/kconfig/preprocess.c b/scripts/kconfig/preprocess.c
index 748da578b418..aeb3fe362c04 100644
--- a/scripts/kconfig/preprocess.c
+++ b/scripts/kconfig/preprocess.c
@@ -11,6 +11,7 @@

#include "list.h"
#include "lkc.h"
+#include "internal.h"

#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))

--
2.34.1