public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Makefile: enable -Werror=implicit-int and -Werror=strict-prototypes by default
@ 2013-08-15 18:37 Sergei Trofimovich
  2013-08-15 21:18 ` Andrew Morton
  2013-08-23 12:18 ` Geert Uytterhoeven
  0 siblings, 2 replies; 5+ messages in thread
From: Sergei Trofimovich @ 2013-08-15 18:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Sergei Trofimovich, Michal Marek, linux-kbuild, Andrew Morton

The common error type 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 fata error. Tested on x86_64 allyesconfig.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: linux-kbuild@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>
---
 Makefile | 5 +++++
 1 file changed, 5 insertions(+)

Change since v1:
 - use 'cc-option' to respect old gccs
 - fix typos. Thanks to Oleg Verych

diff --git a/Makefile b/Makefile
index 6e48848..53f4776 100644
--- a/Makefile
+++ b/Makefile
@@ -374,6 +374,11 @@ KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
 		   -Werror-implicit-function-declaration \
 		   -Wno-format-security \
 		   -fno-delete-null-pointer-checks
+
+# not universally available, but nice to have ones
+KBUILD_CFLAGS   +=  $(call cc-option,-Werror=implicit-int) \
+		    $(call cc-option,-Werror=strict-prototypes)
+
 KBUILD_AFLAGS_KERNEL :=
 KBUILD_CFLAGS_KERNEL :=
 KBUILD_AFLAGS   := -D__ASSEMBLY__
-- 
1.8.3.2


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

end of thread, other threads:[~2013-08-23 17:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-15 18:37 [PATCH v2] Makefile: enable -Werror=implicit-int and -Werror=strict-prototypes by default Sergei Trofimovich
2013-08-15 21:18 ` Andrew Morton
2013-08-23 12:18 ` Geert Uytterhoeven
2013-08-23 17:37   ` Sergei Trofimovich
2013-08-23 17:55   ` [PATCH v3] " Sergei Trofimovich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox