1
0
mirror of https://git.yoctoproject.org/meta-arm synced 2026-01-12 03:10:15 +00:00

optee-test: make -Werror conditional and disabled by default

Unfortunately, new gcc-15 nonstring attribute has just recently been
merged to clang and hasn't made into a release yet - will be part of
clang-21.

For now backport the commit making -Werror conditional and disabled
by default.

Signed-off-by: Denys Dmytriyenko <denys@konsulko.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
Denys Dmytriyenko
2025-05-07 12:30:10 -04:00
committed by Jon Mason
parent 3d3b28ee73
commit 06047003c5
2 changed files with 75 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
From d068b668800a2bacae006f9b4d5d0fcbdabe9223 Mon Sep 17 00:00:00 2001
From: Jerome Forissier <jerome.forissier@linaro.org>
Date: Wed, 7 May 2025 14:01:38 +0200
Subject: [PATCH] build: make, cmake: add -Werror based on CFG_WERROR
Update the build files that currently set -Werror unconditionally to
use set it based on the value of CFG_WERROR instead (disabled by
default).
Upstream-Status: Backport [https://github.com/OP-TEE/optee_test/commit/d068b668800a2bacae006f9b4d5d0fcbdabe9223]
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
---
CMakeLists.txt | 7 ++++++-
host/xtest/Makefile | 6 +++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 77c3a75..0f338b7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,6 +4,8 @@ project (optee_test C)
# Default cross compile settings
set (CMAKE_TOOLCHAIN_FILE CMakeToolchain.txt)
+option(CFG_WERROR "Build with -Werror" FALSE)
+
set (OPTEE_TEST_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
################################################################################
# Compiler flags:
@@ -18,10 +20,13 @@ add_compile_options (
-Wmissing-prototypes -Wnested-externs
-Wpointer-arith -Wshadow -Wstrict-prototypes
-Wswitch-default -Wunsafe-loop-optimizations
- -Wwrite-strings -Werror -fPIC
+ -Wwrite-strings -fPIC
-Wno-missing-field-initializers
-Wno-unused-parameter
)
+if(CFG_WERROR)
+ add_compile_options(-Werror)
+endif(CFG_WERROR)
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
diff --git a/host/xtest/Makefile b/host/xtest/Makefile
index 2bdf759..37f1d32 100644
--- a/host/xtest/Makefile
+++ b/host/xtest/Makefile
@@ -139,7 +139,7 @@ CFLAGS += -DTA_DIR=\"$(TA_DIR)\"
# Include configuration file generated by OP-TEE OS (CFG_* macros)
CFLAGS += -include conf.h
-CFLAGS += -Wall -Wcast-align -Werror \
+CFLAGS += -Wall -Wcast-align \
-Werror-implicit-function-declaration -Wextra -Wfloat-equal \
-Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \
-Wmissing-declarations -Wmissing-format-attribute \
@@ -150,6 +150,10 @@ CFLAGS += -Wall -Wcast-align -Werror \
-Wno-declaration-after-statement \
-Wno-missing-field-initializers -Wno-format-zero-length
+ifeq ($(CFG_WERROR),y)
+CFLAGS += -Werror
+endif
+
CFLAGS += -g3
LDFLAGS += -L$(OPTEE_CLIENT_EXPORT)/lib -lteec
--
2.25.1

View File

@@ -5,6 +5,7 @@ SRCREV = "695231ef8987866663a9ed5afd8f77d1bae3dc08"
LIC_FILES_CHKSUM = "file://LICENSE.md;md5=a8fa504109e4cd7ea575bc49ea4be560"
SRC_URI += "file://0001-build-make-cmake-add-Werror-based-on-CFG_WERROR.patch"
# Include ffa_spmc test group if the SPMC test is enabled.
# Supported after op-tee v3.20