[PATCH] kbuild: add -Werror=implicit-function-declaration

Masahiro Yamada masahiroy at kernel.org
Fri May 8 03:53:34 CEST 2020


On Fri, May 8, 2020 at 10:39 AM Simon Glass <sjg at chromium.org> wrote:
>
> Hi Masahiro,
>
> On Thu, 7 May 2020 at 06:21, Masahiro Yamada
> <yamada.masahiro at socionext.com> wrote:
> >
> > Add -Werror=implicit-function-declaration as Linux does.
> >
> > If you do not check the prototype, it may go wrong run-time.
> > It is better to break the build, and require to include correct
> > headers.
> >
> > Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
> > ---
> >
> >  Makefile | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
>
> NAK
>
> We already get a warning in this situation. This makes it painful for
> development since things that should be warnings end up being errors.
> So your build fails when really it should work well enough to do a
> test run with your new code. I don't think it has any benefit on code
> quality since we already detect warnings in gitlab, etc.
>
> U-Boot is set up so that warnings are reported and are easy to spot if
> you use 'make -s' (i.e. not buried in the output).
>
> Regards,
> Simon



Linux added this flag in 2007.

The intention seems to break the build earlier
when a non-existing function is used.

I have not seen compliant about this flag in Linux.
What does it make different for U-Boot ?




commit 94bed2a9c4ae980838003f5d32681eef794ecc28
Author: Dave Jones <davej at redhat.com>
Date:   Sun Jul 15 23:41:38 2007 -0700

    Add -Werror-implicit-function-declaration

    Add -Werror-implicit-function-declaration
    This makes builds fail sooner if something is implicitly defined instead
    of having to wait half an hour for it to fail at the linking stage.

    Signed-off-by: Dave Jones <davej at redhat.com>
    Cc: Sam Ravnborg <sam at ravnborg.org>
    Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>



-- 
Best Regards
Masahiro Yamada


More information about the U-Boot mailing list