From 80970472179a45609c0b11b80619bc8c32b15f77 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Fri, 13 Sep 2013 14:51:40 -0700 Subject: Makefile: enable -Werror=implicit-int and -Werror=strict-prototypes by default The common error found in forward-ported/backported patches is missing headers. One recent example (files and function names are mangled): void foo(){} EXPORT_SYMBOL(foo); gave only warning foo.c:12345678:5: warning: function declaration isn't a prototype [-Wstrict-prototypes] void foo(){} ^ foo.c:12345679:5: warning: data definition has no type or storage class [enabled by default] EXPORT_SYMBOL(foo); foo.c:12345679:5: warning: type defaults to 'int' in declaration of 'EXORT_SYMBOL' [-Werror=implicit-int] Now it's a fatal error. Tested on x86_64 allyesconfig. [akpm@linux-foundation.org: fix typos in comments] Signed-off-by: Sergei Trofimovich Cc: Geert Uytterhoeven Signed-off-by: Andrew Morton Signed-off-by: Michal Marek --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index de004ceb6b5e..c060363f11c3 100644 --- a/Makefile +++ b/Makefile @@ -659,6 +659,12 @@ KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow) # conserve stack if available 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) + # use the deterministic mode of AR if available KBUILD_ARFLAGS := $(call ar-option,D) -- cgit v1.2.3 From ab7474ea5361f5fe883feb5ae637a1c948df1507 Mon Sep 17 00:00:00 2001 From: Borislav Petkov Date: Mon, 11 Nov 2013 15:27:43 +0100 Subject: Kbuild: Ignore GREP_OPTIONS env variable When building the kernel in a shell which defines GREP_OPTIONS so that grep behavior is modified, we can break the generation of the syscalls table like so: __SYSCALL_COMMON(^[[01;31m^[[K0^[[m^[[K, sys_read, sys_read) __SYSCALL_COMMON(^[[01;31m^[[K1^[[m^[[K, sys_write, sys_write) __SYSCALL_COMMON(^[[01;31m^[[K1^[[m^[[K0, sys_mprotect, sys_mprotect) ... This is just the initial breakage, later we barf when generating modules. In this case, GREP_OPTIONS contains "--color=always" which adds the shell colors markup and completely fudges the headers under ...generated/asm/. Fix that by unexporting the GREP_OPTIONS variable for the whole kernel build as we tend to use grep at a bunch of places. Signed-off-by: Borislav Petkov Signed-off-by: Michal Marek --- Makefile | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index c060363f11c3..2f6c0e9c684a 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,9 @@ LC_COLLATE=C LC_NUMERIC=C export LC_COLLATE LC_NUMERIC +# Avoid interference with shell env settings +unexport GREP_OPTIONS + # We are using a recursive build, so we need to do a little thinking # to get the ordering right. # -- cgit v1.2.3