diff mbox series

[2/3] kbuild: add -Werror=strict-prototype flag unconditionally

Message ID 1544774739-13471-2-git-send-email-yamada.masahiro@socionext.com
State Accepted
Commit eeb5687a7139649e1724674441580b778f5ff7ab
Headers show
Series [1/3] kbuild: add -fno-PIE flag unconditionally | expand

Commit Message

Masahiro Yamada Dec. 14, 2018, 8:05 a.m. UTC
-Wstrict-prototype is added to KBUILD_CFLAGS first, then overridden
by -Werror=strict-prototype later.

Let's add -Werror=strict-prototypes unconditionally because it is
supported by GCC 4.6, and also by Clang.

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

---

 Makefile | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

-- 
2.7.4

Comments

Nick Desaulniers Dec. 14, 2018, 6:33 p.m. UTC | #1
On Fri, Dec 14, 2018 at 12:06 AM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>

> -Wstrict-prototype is added to KBUILD_CFLAGS first, then overridden


-Wstrict-prototypes (plural)

> by -Werror=strict-prototype later.


-Werror=strict-prototypes (plural)

LGTM: https://godbolt.org/z/DyEpmU

If you would mind updating the commit message (and subject), then:
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>


>

> Let's add -Werror=strict-prototypes unconditionally because it is

> supported by GCC 4.6, and also by Clang.

>

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

> ---

>

>  Makefile | 5 +----

>  1 file changed, 1 insertion(+), 4 deletions(-)

>

> diff --git a/Makefile b/Makefile

> index 3bbc16a..bcb943e 100644

> --- a/Makefile

> +++ b/Makefile

> @@ -423,7 +423,7 @@ LINUXINCLUDE    := \

>                 $(USERINCLUDE)

>

>  KBUILD_AFLAGS   := -D__ASSEMBLY__ -fno-PIE

> -KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \

> +KBUILD_CFLAGS   := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \

>                    -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \

>                    -Werror-implicit-function-declaration \

>                    -Wno-format-security \

> @@ -828,9 +828,6 @@ KBUILD_CFLAGS   += $(call cc-option,-fconserve-stack)

>  # disallow errors like 'EXPORT_GPL(foo);' with missing header

>  KBUILD_CFLAGS   += $(call cc-option,-Werror=implicit-int)

>

> -# require functions to have arguments in prototypes, not empty 'int foo()'

> -KBUILD_CFLAGS   += $(call cc-option,-Werror=strict-prototypes)

> -

>  # Prohibit date/time macros, which would make the build non-deterministic

>  KBUILD_CFLAGS   += $(call cc-option,-Werror=date-time)

>

> --

> 2.7.4

>



-- 
Thanks,
~Nick Desaulniers
Masahiro Yamada Dec. 16, 2018, 3:31 p.m. UTC | #2
On Sat, Dec 15, 2018 at 3:34 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>

> On Fri, Dec 14, 2018 at 12:06 AM Masahiro Yamada

> <yamada.masahiro@socionext.com> wrote:

> >

> > -Wstrict-prototype is added to KBUILD_CFLAGS first, then overridden

>

> -Wstrict-prototypes (plural)

>

> > by -Werror=strict-prototype later.

>

> -Werror=strict-prototypes (plural)

>

> LGTM: https://godbolt.org/z/DyEpmU

>

> If you would mind updating the commit message (and subject), then:

> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>



Thanks for checking this.

I will locally fix those typos (including the one in the subject).



-- 
Best Regards
Masahiro Yamada
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 3bbc16a..bcb943e 100644
--- a/Makefile
+++ b/Makefile
@@ -423,7 +423,7 @@  LINUXINCLUDE    := \
 		$(USERINCLUDE)
 
 KBUILD_AFLAGS   := -D__ASSEMBLY__ -fno-PIE
-KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
+KBUILD_CFLAGS   := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \
 		   -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \
 		   -Werror-implicit-function-declaration \
 		   -Wno-format-security \
@@ -828,9 +828,6 @@  KBUILD_CFLAGS   += $(call cc-option,-fconserve-stack)
 # disallow errors like 'EXPORT_GPL(foo);' with missing header
 KBUILD_CFLAGS   += $(call cc-option,-Werror=implicit-int)
 
-# require functions to have arguments in prototypes, not empty 'int foo()'
-KBUILD_CFLAGS   += $(call cc-option,-Werror=strict-prototypes)
-
 # Prohibit date/time macros, which would make the build non-deterministic
 KBUILD_CFLAGS   += $(call cc-option,-Werror=date-time)