Increase default warning level

This patch enables the warnings -Wextra, -Weffc++, and -Werror for
compiling Genode components. It thereby helps us to detect bugs like
uninitialized member variables or missing virtual destructors at compile
time. The warning level is defined via the new 'CC_CXX_WARN_STRICT'
variable. For targets that compile 3rd-party code where this warning
level is not applicable, the variable may be explictly set to an empty
value in the corresponding build-description file.

Issue #465
This commit is contained in:
Norman Feske 2018-01-02 12:06:20 +01:00 committed by Christian Helmuth
parent eba9c15746
commit c30299feca
1 changed files with 8 additions and 2 deletions

View File

@ -107,6 +107,12 @@ endif
CC_OLEVEL ?= -O2
CC_WARN ?= -Wall
#
# Additional warnings for C++
#
CC_CXX_WARN_STRICT ?= -Wextra -Weffc++ -Werror
CC_CXX_WARN ?= $(CC_WARN) $(CC_CXX_WARN_STRICT)
#
# Aggregate compiler options that are common for C and C++
#
@ -133,7 +139,7 @@ CC_OPT += $(CC_OPT_PIC)
#
# Predefine C and C++ specific compiler options with their common values
#
CC_CXX_OPT += $(CC_OPT)
CC_CXX_OPT += $(CC_OPT) $(CC_CXX_WARN)
CC_C_OPT += $(CC_OPT)
CC_ADA_OPT += $(CC_OPT)
@ -153,7 +159,7 @@ CC_RUSTC_OPT += $(foreach lib,$(LIBS),-L$(LIB_CACHE_DIR)/$(lib))
#
CC_CXX_OPT_STD ?= -std=gnu++11
CC_CXX_OPT += $(lastword $(CC_CXX_OPT_STD) $(CC_CXX_OPT_STD_$(subst .,_,$*)))
#
# Linker options
#