From ea8f5b29edd2817528f63be93bbf3fdd9c2ad2d5 Mon Sep 17 00:00:00 2001 From: Keith Short Date: Wed, 19 Apr 2023 16:34:30 -0600 Subject: zmake: Use CONFIG_COMPILER_WARNINGS_AS_ERRORS Zephyr provides the Kconfig option COMPILER_WARNINGS_AS_ERRORS to automatically treat warnings as errors. Use this Kcoonfig in place of an EC specific Cmake option. BUG=none BRANCH=none TEST=zmake build skyrim. Confirm compiler options enable "-Werror" TEST=zmake build skyrim --allow-warnings. Confirm compiler options don't include "-Werror" Change-Id: I9ea85928a9125472bbf00bac6ee452b4ab97fdf9 Signed-off-by: Keith Short Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4451647 Reviewed-by: Tristan Honscheid --- zephyr/CMakeLists.txt | 6 ------ zephyr/zmake/zmake/zmake.py | 4 ++-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 63dc674b05..d27cd63597 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -45,12 +45,6 @@ if(DEFINED CONFIG_PLATFORM_EC) # with Zephyr builds only. zephyr_compile_definitions("CONFIG_ZEPHYR") - # Force compiler warnings to generate errors - option(ALLOW_WARNINGS "Do not treat warnings as errors") - if (NOT ALLOW_WARNINGS) - zephyr_compile_options(-Werror) - endif() - include(fpu.cmake) # When LTO is enabled, enable only for the "app" library, which compiles diff --git a/zephyr/zmake/zmake/zmake.py b/zephyr/zmake/zmake/zmake.py index 4c6d840535..7457a16740 100644 --- a/zephyr/zmake/zmake/zmake.py +++ b/zephyr/zmake/zmake/zmake.py @@ -521,9 +521,9 @@ class Zmake: base_config |= zmake.build_config.BuildConfig( kconfig_defs={"CONFIG_COMPILER_SAVE_TEMPS": "y"} ) - if allow_warnings: + if not allow_warnings: base_config |= zmake.build_config.BuildConfig( - cmake_defs={"ALLOW_WARNINGS": "ON"} + kconfig_defs={"CONFIG_COMPILER_WARNINGS_AS_ERRORS": "y"} ) if extra_cflags: base_config |= zmake.build_config.BuildConfig( -- cgit v1.2.1