]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
build: Option to treat compiler warnings as errors
authorSimon Kuenzer <simon.kuenzer@neclab.eu>
Wed, 2 Jun 2021 20:19:34 +0000 (22:19 +0200)
committerUnikraft <monkey@unikraft.io>
Fri, 4 Feb 2022 21:36:49 +0000 (21:36 +0000)
Introduces an option to treat compiler warnings as errors. The build
system stops compilation if a compiler warning is displayed. This
option is intended to ensure clean builds.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Alexander Jung <alex@unikraft.org>
Approved-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #222

Config.uk
Makefile.uk

index ae68d46d6586d722340d038720715dec20dcb21d..5af8bd1dfa2620f15ccd688811f2e65fea9d5434 100644 (file)
--- a/Config.uk
+++ b/Config.uk
@@ -132,6 +132,13 @@ endchoice
 comment "Hint: Keep frame pointers to ease debugging"
        depends on !OPTIMIZE_NOOMITFP && !DEBUG_SYMBOLS_LVL0
 
+config OPTIMIZE_WARNISERROR
+       bool "Treat warnings as errors"
+       default n
+       help
+               When this option is enabled, the build system stops
+               compilation when a compiler warning is displayed.
+
 config OPTIMIZE_SYMFILE
        bool "Create a symbols file"
        default n
index 19b02ebe579713ad256ed2d5506cfd5740bc6b2e..34b60aaa37532838baae1789874ab13c570bb71a 100644 (file)
@@ -70,6 +70,8 @@ COMPFLAGS-$(CONFIG_OPTIMIZE_LTO)          += -flto
 LIBLDFLAGS-$(CONFIG_OPTIMIZE_LTO)         += $(COMPFLAGS) $(COMPFLAGS-y) $(ARCHFLAGS) $(ARCHFLAGS-y)
 LDFLAGS-$(CONFIG_OPTIMIZE_LTO)            += $(COMPFLAGS) $(COMPFLAGS-y) $(ARCHFLAGS) $(ARCHFLAGS-y)
 
+COMPFLAGS-$(CONFIG_OPTIMIZE_WARNISERROR)  += -Werror
+
 DBGFLAGS-$(CONFIG_DEBUG_SYMBOLS_LVL0)     += -g0
 DBGFLAGS-$(CONFIG_DEBUG_SYMBOLS_LVL1)     += -g1
 DBGFLAGS-$(CONFIG_DEBUG_SYMBOLS_LVL2)     += -g2