* [PATCH] Add -Werror build option
@ 2013-01-29 18:51 Simon Que
2013-01-29 18:56 ` Borislav Petkov
0 siblings, 1 reply; 2+ messages in thread
From: Simon Que @ 2013-01-29 18:51 UTC (permalink / raw)
To: linux-kernel; +Cc: Simon Que, Mandeep Singh Baines
Add a config option "ERROR_ON_WARNING" that adds the "-Werror" flag to
gcc, which turns warnings into errors.
This option enables developers to set a stricter level of code checking
for kernel code: all code must be warning-free.
Signed-off-by: Simon Que <sque@chromium.org>
Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
---
Makefile | 4 ++++
lib/Kconfig.debug | 9 +++++++++
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index a687963..7502f5f 100644
--- a/Makefile
+++ b/Makefile
@@ -620,6 +620,10 @@ endif
NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
CHECKFLAGS += $(NOSTDINC_FLAGS)
+ifdef CONFIG_ERROR_ON_WARNING
+KBUILD_CFLAGS += -Werror
+endif
+
# warn about C99 declaration after statement
KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 83b2558..28005ff 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1305,3 +1305,12 @@ source "lib/Kconfig.kmemcheck"
config TEST_KSTRTOX
tristate "Test kstrto*() family of functions at runtime"
+
+config ERROR_ON_WARNING
+ bool "Treat compiler warnings as errors"
+ help
+ If you say Y here, the Makefile will pass the "-Werror" option to the
+ compiler. This will cause the compiler to fail on any warning, as if
+ it were an error.
+
+ If unsure, say N.
--
1.7.8.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Add -Werror build option
2013-01-29 18:51 [PATCH] Add -Werror build option Simon Que
@ 2013-01-29 18:56 ` Borislav Petkov
0 siblings, 0 replies; 2+ messages in thread
From: Borislav Petkov @ 2013-01-29 18:56 UTC (permalink / raw)
To: Simon Que; +Cc: linux-kernel, Mandeep Singh Baines
On Tue, Jan 29, 2013 at 10:51:18AM -0800, Simon Que wrote:
> Add a config option "ERROR_ON_WARNING" that adds the "-Werror" flag to
> gcc, which turns warnings into errors.
>
> This option enables developers to set a stricter level of code checking
> for kernel code: all code must be warning-free.
And we want this because...?
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-29 18:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-29 18:51 [PATCH] Add -Werror build option Simon Que
2013-01-29 18:56 ` Borislav Petkov
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).