diff options
author | Keith Short <keithshort@chromium.org> | 2023-04-19 16:17:47 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-04-26 00:46:40 +0000 |
commit | cc77132214314039ac2c14db1e73b8859d26e690 (patch) | |
tree | 83c1c56e990346fb582f57d8a3bfe000d25e649e | |
parent | d5041d9800618b6f0f0f5c9254fc6f164f96431b (diff) | |
download | chrome-ec-stabilize-15439.B-main.tar.gz |
zephyr: Honor warnings as errors config for testsstabilize-15439.B-main
The clang compiler flags were unconditionally enabling errors for
several warnings classes. Only enable these errors when the
CONFIG_COMPILER_WARNINGS_AS_ERRORS option is enabled.
BUG=none
BRANCH=none
TEST=./twister -W
Change-Id: I2530a8af9aa51e12b5ae6d0e3d68b4963ecf82a1
Signed-off-by: Keith Short <keithshort@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4451651
Reviewed-by: Yuval Peress <peress@google.com>
-rw-r--r-- | zephyr/cmake/compiler/clang/compiler_flags.cmake | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/zephyr/cmake/compiler/clang/compiler_flags.cmake b/zephyr/cmake/compiler/clang/compiler_flags.cmake index f24e1f1f4c..2fffd4b755 100644 --- a/zephyr/cmake/compiler/clang/compiler_flags.cmake +++ b/zephyr/cmake/compiler/clang/compiler_flags.cmake @@ -9,18 +9,20 @@ set_compiler_property(PROPERTY hosted) # Disable position independent code. if ("${ARCH}" STREQUAL "posix" OR "${ARCH}" STREQUAL "unit_testing") - add_compile_options(-fPIC) + add_compile_options(-fPIC) else() - add_compile_options(-fno-PIC) + add_compile_options(-fno-PIC) endif() # When testing, look for stack smashing add_compile_option_ifdef(CONFIG_ZTEST -fstack-protector-all) -check_set_compiler_property(APPEND PROPERTY warning_extended -Wunused-variable - -Werror=unused-variable -Werror=missing-braces - -Werror=sometimes-uninitialized -Werror=unused-function - -Werror=array-bounds) +if(DEFINED CONFIG_COMPILER_WARNINGS_AS_ERRORS) + check_set_compiler_property(APPEND PROPERTY warning_extended -Wunused-variable + -Werror=unused-variable -Werror=missing-braces + -Werror=sometimes-uninitialized -Werror=unused-function + -Werror=array-bounds) +endif() # clang flags for coverage generation set_property(TARGET compiler PROPERTY coverage --coverage -fno-inline) |