All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] kconfig: make input_mode static
@ 2018-01-11 13:39 Masahiro Yamada
  2018-01-11 13:39 ` [PATCH 2/3] kconfig: make xfgets() really static Masahiro Yamada
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Masahiro Yamada @ 2018-01-11 13:39 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

Sparse reports:
  warning: symbol 'input_mode' was not declared. Should it be static?

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 scripts/kconfig/conf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 8b9cdf4..31c09c6 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -35,7 +35,8 @@ enum input_mode {
 	savedefconfig,
 	listnewconfig,
 	olddefconfig,
-} input_mode = oldaskconfig;
+};
+static enum input_mode input_mode = oldaskconfig;
 
 static int indent = 1;
 static int tty_stdio;
-- 
2.7.4

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

* [PATCH 2/3] kconfig: make xfgets() really static
  2018-01-11 13:39 [PATCH 1/3] kconfig: make input_mode static Masahiro Yamada
@ 2018-01-11 13:39 ` Masahiro Yamada
  2018-01-11 13:39 ` [PATCH 3/3] kconfig: make conf_unsaved a local variable of conf_read() Masahiro Yamada
  2018-01-18 13:56 ` [PATCH 1/3] kconfig: make input_mode static Masahiro Yamada
  2 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2018-01-11 13:39 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

Sparse reports:
  warning: symbol 'xfgets' was not declared. Should it be static?

It is declared as static, but it is missing in the definition part.
Move the definition up and remove the forward declaration.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 scripts/kconfig/conf.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 31c09c6..01ed336 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -20,7 +20,6 @@
 
 static void conf(struct menu *menu);
 static void check_conf(struct menu *menu);
-static void xfgets(char *str, int size, FILE *in);
 
 enum input_mode {
 	oldaskconfig,
@@ -83,6 +82,13 @@ static void check_stdin(void)
 	}
 }
 
+/* Helper function to facilitate fgets() by Jean Sacren. */
+static void xfgets(char *str, int size, FILE *in)
+{
+	if (!fgets(str, size, in))
+		fprintf(stderr, "\nError in reading or end of file.\n");
+}
+
 static int conf_askvalue(struct symbol *sym, const char *def)
 {
 	enum symbol_type type = sym_get_type(sym);
@@ -705,12 +711,3 @@ int main(int ac, char **av)
 	}
 	return 0;
 }
-
-/*
- * Helper function to facilitate fgets() by Jean Sacren.
- */
-void xfgets(char *str, int size, FILE *in)
-{
-	if (fgets(str, size, in) == NULL)
-		fprintf(stderr, "\nError in reading or end of file.\n");
-}
-- 
2.7.4

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

* [PATCH 3/3] kconfig: make conf_unsaved a local variable of conf_read()
  2018-01-11 13:39 [PATCH 1/3] kconfig: make input_mode static Masahiro Yamada
  2018-01-11 13:39 ` [PATCH 2/3] kconfig: make xfgets() really static Masahiro Yamada
@ 2018-01-11 13:39 ` Masahiro Yamada
  2018-01-18 13:56 ` [PATCH 1/3] kconfig: make input_mode static Masahiro Yamada
  2 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2018-01-11 13:39 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

conf_unsaved is initialized by conf_read_simple(), but it is possible
to move it to conf_read() so that it can be a local variable.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 scripts/kconfig/confdata.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index bc83965..dfccaab 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -28,7 +28,7 @@ static void conf_message(const char *fmt, ...)
 	__attribute__ ((format (printf, 1, 2)));
 
 static const char *conf_filename;
-static int conf_lineno, conf_warnings, conf_unsaved;
+static int conf_lineno, conf_warnings;
 
 const char conf_defname[] = "arch/$ARCH/defconfig";
 
@@ -290,7 +290,6 @@ int conf_read_simple(const char *name, int def)
 	conf_filename = name;
 	conf_lineno = 0;
 	conf_warnings = 0;
-	conf_unsaved = 0;
 
 	def_flags = SYMBOL_DEF << def;
 	for_all_symbols(i, sym) {
@@ -409,6 +408,7 @@ int conf_read_simple(const char *name, int def)
 int conf_read(const char *name)
 {
 	struct symbol *sym;
+	int conf_unsaved = 0;
 	int i;
 
 	sym_set_change_count(0);
-- 
2.7.4

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

* Re: [PATCH 1/3] kconfig: make input_mode static
  2018-01-11 13:39 [PATCH 1/3] kconfig: make input_mode static Masahiro Yamada
  2018-01-11 13:39 ` [PATCH 2/3] kconfig: make xfgets() really static Masahiro Yamada
  2018-01-11 13:39 ` [PATCH 3/3] kconfig: make conf_unsaved a local variable of conf_read() Masahiro Yamada
@ 2018-01-18 13:56 ` Masahiro Yamada
  2 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2018-01-18 13:56 UTC (permalink / raw)
  To: Linux Kbuild mailing list; +Cc: Masahiro Yamada, Linux Kernel Mailing List

2018-01-11 22:39 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>:
> Sparse reports:
>   warning: symbol 'input_mode' was not declared. Should it be static?
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---


Applied all 3 patches to linux-kbuild/kconfig.




-- 
Best Regards
Masahiro Yamada

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

end of thread, other threads:[~2018-01-18 13:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-11 13:39 [PATCH 1/3] kconfig: make input_mode static Masahiro Yamada
2018-01-11 13:39 ` [PATCH 2/3] kconfig: make xfgets() really static Masahiro Yamada
2018-01-11 13:39 ` [PATCH 3/3] kconfig: make conf_unsaved a local variable of conf_read() Masahiro Yamada
2018-01-18 13:56 ` [PATCH 1/3] kconfig: make input_mode static 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.