summaryrefslogtreecommitdiff
path: root/Makefile.toolchain
diff options
context:
space:
mode:
authorJeremy Bettis <jbettis@google.com>2021-09-20 16:08:14 -0600
committerCommit Bot <commit-bot@chromium.org>2021-09-24 16:13:29 +0000
commita4056238da1d6bc6327b8d090845db9a44fe5f34 (patch)
tree184b992f1f674f0c55e862801cccdebcc6cc167f /Makefile.toolchain
parent2caf7b2cadb5dd12bee3442565f02abfb76f9077 (diff)
downloadchrome-ec-a4056238da1d6bc6327b8d090845db9a44fe5f34.tar.gz
ec: Fail on uninitialized variables
The zephyr toolchain has -Werror=maybe-uninitialized enabled by default, so enable it for all gcc EC builds to prevent possible uninitialized vars from sneaking into the codebase. For clang builds, use -Werror=uninitialized instead. BRANCH=None BUG=None TEST=in docker: make -j CRYPTOC_DIR="${MODULES_DIR}/cryptoc" \ FTDIVERSION=1 HOSTGCOV='gcov' \ CROSS_COMPILE_arm=/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi- \ coverage in chroot; make try_build_boards buildall_only Change-Id: I3efb4b2958f2037606195743d768870e1d0b18b9 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3171939 Tested-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'Makefile.toolchain')
-rw-r--r--Makefile.toolchain6
1 files changed, 6 insertions, 0 deletions
diff --git a/Makefile.toolchain b/Makefile.toolchain
index e39a1c3016..29e0beca08 100644
--- a/Makefile.toolchain
+++ b/Makefile.toolchain
@@ -52,6 +52,12 @@ C_WARN = -Wstrict-prototypes -Wdeclaration-after-statement -Wno-pointer-sign
COMMON_WARN = -Wall -Wundef -Werror -Werror-implicit-function-declaration \
-Wno-trigraphs -Wno-format-security -Wno-address-of-packed-member \
-fno-common -fno-strict-aliasing -fno-strict-overflow
+ifeq ($(cc-name),clang)
+COMMON_WARN+=-Werror=uninitialized
+endif
+ifeq ($(cc-name),gcc)
+COMMON_WARN+=-Werror=maybe-uninitialized
+endif
UBSAN_FLAGS=-fsanitize=array-bounds,vla-bound \
-fno-sanitize=vptr \