config: make -Werror optional and off by default

Allow end users to build the code even if, for example, warnings are
added with new compilers versions.

-Werror is still enforced for automated builds.

Change-Id: I567009d55cf5b941c452bd41d09f75d03b037209
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-03-18 10:40:34 -07:00
parent eae688576a
commit 55d9ff6a66
4 changed files with 11 additions and 4 deletions

3
CONFIG
View File

@ -34,6 +34,9 @@
# Build with debug logging. Turn off for performance testing and normal usage
CONFIG_DEBUG?=n
# Treat warnings as errors (fail the build on any warning).
CONFIG_WERROR?=n
# Build with code coverage instrumentation.
CONFIG_COVERAGE?=n

View File

@ -43,7 +43,11 @@ endif
OS := $(shell uname)
COMMON_CFLAGS = -g $(C_OPT) -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wmissing-declarations -Wstrict-prototypes -Werror -fno-strict-aliasing -march=native -m64 -I$(SPDK_ROOT_DIR)/include
COMMON_CFLAGS = -g $(C_OPT) -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wmissing-declarations -Wstrict-prototypes -fno-strict-aliasing -march=native -m64 -I$(SPDK_ROOT_DIR)/include
ifeq ($(CONFIG_WERROR), y)
COMMON_CFLAGS += -Werror
endif
COMMON_CFLAGS += -Wformat -Wformat-security -Wformat-nonliteral

View File

@ -1,7 +1,7 @@
set -xe
ulimit -c unlimited
MAKECONFIG='CONFIG_DEBUG=y'
MAKECONFIG='CONFIG_DEBUG=y CONFIG_WERROR=y'
case `uname` in
FreeBSD)

View File

@ -2,7 +2,7 @@
set -xe
make -C test/lib/nvme/unit
make -C test/lib/nvme/unit CONFIG_WERROR=y
test/lib/nvme/unit/nvme_c/nvme_ut
test/lib/nvme/unit/nvme_ctrlr_c/nvme_ctrlr_ut
@ -10,6 +10,6 @@ test/lib/nvme/unit/nvme_ctrlr_cmd_c/nvme_ctrlr_cmd_ut
test/lib/nvme/unit/nvme_ns_cmd_c/nvme_ns_cmd_ut
test/lib/nvme/unit/nvme_qpair_c/nvme_qpair_ut
make -C test/lib/ioat/unit
make -C test/lib/ioat/unit CONFIG_WERROR=y
test/lib/ioat/unit/ioat_ut