diff mbox

[v2,kbuild,for-next,1/2] makefiles: add config option to force all cc warnings to errors

Message ID 1427478671-16379-1-git-send-email-jtoppins@cumulusnetworks.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jonathan Toppins March 27, 2015, 5:51 p.m. UTC
Add a Kconfig option to force cc warnings to errors. For new
development it is recommended this setting be enabled as warnings
in the code will be quite obvious.

v2: * remove DOTs from Kconfig entries
    * reworded Kconfig to not imply suppressing cc warnings was
      acceptable
    * default option to 'n'

Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com>
---
 Makefile          |    4 ++++
 lib/Kconfig.debug |   10 ++++++++++
 2 files changed, 14 insertions(+)

Comments

Michal Marek March 30, 2015, 1:35 p.m. UTC | #1
On 2015-03-27 18:51, Jonathan Toppins wrote:
> Add a Kconfig option to force cc warnings to errors. For new
> development it is recommended this setting be enabled as warnings
> in the code will be quite obvious.

I don't want to add such kconfig option, because it will break
all{mod,yes}config for little gain. And there are warnings like the
preprocessor #warning or the use of a function marked as __deprecated --
these a basically TODOs and there is no point in failing the build. Test
builds can be done with KCFLAGS=-Werror or you can grep build logs.

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Makefile b/Makefile
index dc2d91a..a69562a 100644
--- a/Makefile
+++ b/Makefile
@@ -764,6 +764,10 @@  ifdef CONFIG_DEBUG_SECTION_MISMATCH
 KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
 endif
 
+ifdef CONFIG_DEBUG_FORCE_CC_WARNINGS_TO_ERRORS
+KBUILD_CFLAGS += $(call cc-option, -Werror)
+endif
+
 # arch Makefile may override CC so keep this after arch Makefile is included
 NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
 CHECKFLAGS     += $(NOSTDINC_FLAGS)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 3e0289e..bbe2eed 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -347,6 +347,16 @@  config DEBUG_FORCE_WEAK_PER_CPU
 	  To ensure that generic code follows the above rules, this
 	  option forces all percpu variables to be defined as weak.
 
+config DEBUG_FORCE_CC_WARNINGS_TO_ERRORS
+	bool "Force cc warnings to errors"
+	help
+	  Simply enables the gcc compiler option -Werror for the entire
+	  build. This option is intended to be more in the developer's
+	  face and encourage effort of some kind to remove the
+	  compilation warning.
+
+	  If doing new development recommend setting to y.
+
 endmenu # "Compiler options"
 
 config MAGIC_SYSRQ