Re: [PATCH v2] travis-ci: enable more warnings on travis linux-gcc job
From: Duy Nguyen <hidden>
Date: 2018-03-17 14:59:32
Subsystem:
kernel build + files below scripts/ (unless maintained elsewhere), the rest · Maintainers:
Nathan Chancellor, Nicolas Schier, Linus Torvalds
On Sat, Mar 17, 2018 at 03:29:31PM +0100, Lars Schneider wrote:
I interpreted Peff's comment like this: If DEVELOPER=1 is set and we detect a gcc-6 in the makefile, then we could set your additional flags in the makefile. This way every developer with a new compiler would run these flags locally (if DEVELOPER=1 is set).
Aha. Something like this? I split developer cflags out to a separate file because I imagine people may start to add gcc7, clang.... -- 8< --
diff --git a/.travis.yml b/.travis.yml
index 5f5ee4f3bd..0b3c50f5e7 100644
--- a/.travis.yml
+++ b/.travis.yml@@ -16,10 +16,13 @@ compiler: addons: apt: + sources: + - ubuntu-toolchain-r-test packages: - language-pack-is - git-svn - apache2 + - gcc-6 matrix: include:
diff --git a/Makefile b/Makefile
index de4b8f0c02..e8321e44d6 100644
--- a/Makefile
+++ b/Makefile@@ -436,15 +436,6 @@ GIT-VERSION-FILE: FORCE # CFLAGS and LDFLAGS are for the users to override from the command line. CFLAGS = -g -O2 -Wall -DEVELOPER_CFLAGS = -Werror \ - -Wdeclaration-after-statement \ - -Wno-format-zero-length \ - -Wold-style-definition \ - -Woverflow \ - -Wpointer-arith \ - -Wstrict-prototypes \ - -Wunused \ - -Wvla LDFLAGS = ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS) ALL_LDFLAGS = $(LDFLAGS)
@@ -1045,7 +1036,8 @@ include config.mak.uname -include config.mak ifdef DEVELOPER -CFLAGS += $(DEVELOPER_CFLAGS) +include config.mak.dev +CFLAGS += $(DEV_CFLAGS) endif comma := ,
diff --git a/config.mak.dev b/config.mak.dev
index e69de29bb2..644d0d581f 100644
--- a/config.mak.dev
+++ b/config.mak.dev@@ -0,0 +1,23 @@ +DEV_CFLAGS = +DEV_CFLAGS += -Werror +DEV_CFLAGS += -Wdeclaration-after-statement +DEV_CFLAGS += -Wno-format-zero-length +DEV_CFLAGS += -Wold-style-definition +DEV_CFLAGS += -Woverflow +DEV_CFLAGS += -Wpointer-arith +DEV_CFLAGS += -Wstrict-prototypes +DEV_CFLAGS += -Wunused +DEV_CFLAGS += -Wvla + +GCC_VER := $(shell sh -c '$(CC) --version | grep ^gcc >/dev/null && $(CC) -dumpversion | cut -f 1 -d .') + +ifeq ($(GCC_VER),6) +DEV_CFLAGS += -Wextra +DEV_CFLAGS += -Wmissing-prototypes +DEV_CFLAGS += -Wno-empty-body +DEV_CFLAGS += -Wno-maybe-uninitialized +DEV_CFLAGS += -Wno-missing-field-initializers +DEV_CFLAGS += -Wno-sign-compare +DEV_CFLAGS += -Wno-unused-function +DEV_CFLAGS += -Wno-unused-parameter +endif -- 8< --