linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kconfig: fix an "implicit declaration of function" warning
@ 2020-01-09 12:56 Bartosz Golaszewski
  2020-01-09 15:58 ` Masahiro Yamada
  0 siblings, 1 reply; 3+ messages in thread
From: Bartosz Golaszewski @ 2020-01-09 12:56 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-kbuild, linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

strncasecmp() & strcasecmp() functions are declared in strings.h, not
string.h. On most environments the former is implicitly included by
the latter but on some setups, building menuconfig results in the
following warning:

  HOSTCC  scripts/kconfig/mconf.o
scripts/kconfig/mconf.c: In function ‘search_conf’:
scripts/kconfig/mconf.c:423:6: warning: implicit declaration of function ‘strncasecmp’ [-Wimplicit-function-declaration]
  if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
      ^~~~~~~~~~~
scripts/kconfig/mconf.c: In function ‘main’:
scripts/kconfig/mconf.c:1021:8: warning: implicit declaration of function ‘strcasecmp’ [-Wimplicit-function-declaration]
   if (!strcasecmp(mode, "single_menu"))
        ^~~~~~~~~~

Fix it by explicitly including strings.h.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 scripts/kconfig/mconf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 49c26ea9dd98..4063dbc1b927 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -15,6 +15,7 @@
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
+#include <strings.h>
 #include <signal.h>
 #include <unistd.h>
 
-- 
2.23.0


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

* Re: [PATCH] kconfig: fix an "implicit declaration of function" warning
  2020-01-09 12:56 [PATCH] kconfig: fix an "implicit declaration of function" warning Bartosz Golaszewski
@ 2020-01-09 15:58 ` Masahiro Yamada
  2020-01-09 16:03   ` Bartosz Golaszewski
  0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2020-01-09 15:58 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Linux Kbuild mailing list, Linux Kernel Mailing List,
	Bartosz Golaszewski

On Thu, Jan 9, 2020 at 9:56 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> strncasecmp() & strcasecmp() functions are declared in strings.h, not
> string.h. On most environments the former is implicitly included by
> the latter but on some setups, building menuconfig results in the
> following warning:
>
>   HOSTCC  scripts/kconfig/mconf.o
> scripts/kconfig/mconf.c: In function ‘search_conf’:
> scripts/kconfig/mconf.c:423:6: warning: implicit declaration of function ‘strncasecmp’ [-Wimplicit-function-declaration]
>   if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
>       ^~~~~~~~~~~
> scripts/kconfig/mconf.c: In function ‘main’:
> scripts/kconfig/mconf.c:1021:8: warning: implicit declaration of function ‘strcasecmp’ [-Wimplicit-function-declaration]
>    if (!strcasecmp(mode, "single_menu"))
>         ^~~~~~~~~~
>
> Fix it by explicitly including strings.h.
>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Thanks.

I see strncasecmp() in
scripts/kconfig/nconf.c too.

Could you fix both in a single patch?

You can try it with "make nconfig".



> ---
>  scripts/kconfig/mconf.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
> index 49c26ea9dd98..4063dbc1b927 100644
> --- a/scripts/kconfig/mconf.c
> +++ b/scripts/kconfig/mconf.c
> @@ -15,6 +15,7 @@
>  #include <stdarg.h>
>  #include <stdlib.h>
>  #include <string.h>
> +#include <strings.h>
>  #include <signal.h>
>  #include <unistd.h>
>
> --
> 2.23.0
>


-- 
Best Regards
Masahiro Yamada

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

* Re: [PATCH] kconfig: fix an "implicit declaration of function" warning
  2020-01-09 15:58 ` Masahiro Yamada
@ 2020-01-09 16:03   ` Bartosz Golaszewski
  0 siblings, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2020-01-09 16:03 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Bartosz Golaszewski, Linux Kbuild mailing list,
	Linux Kernel Mailing List

czw., 9 sty 2020 o 16:59 Masahiro Yamada <masahiroy@kernel.org> napisał(a):
>
> On Thu, Jan 9, 2020 at 9:56 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >
> > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >
> > strncasecmp() & strcasecmp() functions are declared in strings.h, not
> > string.h. On most environments the former is implicitly included by
> > the latter but on some setups, building menuconfig results in the
> > following warning:
> >
> >   HOSTCC  scripts/kconfig/mconf.o
> > scripts/kconfig/mconf.c: In function ‘search_conf’:
> > scripts/kconfig/mconf.c:423:6: warning: implicit declaration of function ‘strncasecmp’ [-Wimplicit-function-declaration]
> >   if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
> >       ^~~~~~~~~~~
> > scripts/kconfig/mconf.c: In function ‘main’:
> > scripts/kconfig/mconf.c:1021:8: warning: implicit declaration of function ‘strcasecmp’ [-Wimplicit-function-declaration]
> >    if (!strcasecmp(mode, "single_menu"))
> >         ^~~~~~~~~~
> >
> > Fix it by explicitly including strings.h.
> >
> > Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> Thanks.
>
> I see strncasecmp() in
> scripts/kconfig/nconf.c too.
>
> Could you fix both in a single patch?
>
> You can try it with "make nconfig".

Sure. It seems gconf needs the same change too.

Bart

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

end of thread, other threads:[~2020-01-09 16:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-09 12:56 [PATCH] kconfig: fix an "implicit declaration of function" warning Bartosz Golaszewski
2020-01-09 15:58 ` Masahiro Yamada
2020-01-09 16:03   ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).