diff --git a/Kconfig b/Kconfig index 6379a454166..70dc385dd2f 100644 --- a/Kconfig +++ b/Kconfig @@ -27,6 +27,17 @@ config DEPRECATED code that relies on deprecated features that will be removed and the conversion deadline has passed. +config WERROR + bool "Compile U-Boot with warnings as errors" + help + A U-Boot build should not cause any compiler warnings, and this + enables the '-Werror' flag to enforce that rule. + + However, if you have a new (or very old) compiler or linker with odd + and unusual warnings, or you have some architecture with problems, + you may need to disable this config option in order to + successfully build U-Boot. + config LOCALVERSION string "Local version - append to U-Boot release" help diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index 7d39b27d24a..f687515fc79 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -13,6 +13,9 @@ KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned) +KBUILD_CPPFLAGS-$(CONFIG_WERROR) += -Werror +KBUILD_CPPFLAGS += $(KBUILD_CPPFLAGS-y) + ifeq ("$(origin W)", "command line") export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W) endif