From: Simon Que <sque@chromium.org>
To: linux-kernel@vger.kernel.org
Cc: Simon Que <sque@chromium.org>, Mandeep Singh Baines <msb@chromium.org>
Subject: [PATCH] Add -Werror build option
Date: Tue, 29 Jan 2013 10:51:18 -0800 [thread overview]
Message-ID: <1359485478-23639-1-git-send-email-sque@chromium.org> (raw)
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
next reply other threads:[~2013-01-29 18:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-29 18:51 Simon Que [this message]
2013-01-29 18:56 ` [PATCH] Add -Werror build option Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1359485478-23639-1-git-send-email-sque@chromium.org \
--to=sque@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=msb@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).