From c30299feca63fca9c6bd8a499f1ea22dad13f727 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 2 Jan 2018 12:06:20 +0100 Subject: [PATCH] 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 --- repos/base/mk/global.mk | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/repos/base/mk/global.mk b/repos/base/mk/global.mk index 8270ee6211..bb92edd566 100644 --- a/repos/base/mk/global.mk +++ b/repos/base/mk/global.mk @@ -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 #