xtest: fix build with GP_PACKAGE and GCC 14
Fix the following build error (QEMU build in this instance):
$ export GP=TEE_Initial_Configuration-Test_Suite_v2_0_0_2-2017_06_09.7z
$ make -j$(nproc) GDBSERVER=y \
GP_PACKAGE=/home/builder/optee/$GP
[...]
/home/builder/optee/out-br/build/optee_test_ext-1.0/host/xtest/gp_10000.c: In function 'gp_test_teec_10086':
/home/builder/optee/out-br/build/optee_test_ext-1.0/host/xtest/gp/include/xml_client_api.h:162:18: error: allocation of insufficient size '0' for type 'uint8_t' {aka 'unsigned char'} with size '1' [-Werror=alloc-size]
162 | temp_mem = malloc(size)
| ^
/home/builder/optee/out-br/build/optee_test_ext-1.0/host/xtest/gp_10000.c:1757:5: note: in expansion of macro 'AllocateTempMemory'
1757 | AllocateTempMemory(TEMP_MEM01, ZERO);
| ^~~~~~~~~~~~~~~~~~
The root cause is, when GDBSERVER=y the cross compiler is built by
Buildroot and is GCC 14, while the default one is GCC 11.3. GCC 14
reports the additional wrning/error which therefore needs to be
disabled explicitly (we don't want to change the GP test).
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
diff --git a/Android.mk b/Android.mk
index 556b945..c6ef29f 100644
--- a/Android.mk
+++ b/Android.mk
@@ -122,7 +122,7 @@
LOCAL_CFLAGS += -pthread
LOCAL_CFLAGS += -g3
LOCAL_CFLAGS += -Wno-missing-field-initializers -Wno-format-zero-length
-LOCAL_CFLAGS += -Wno-unused-parameter
+LOCAL_CFLAGS += -Wno-unused-parameter -Wno-alloc-size
ifneq ($(TA_DIR),)
LOCAL_CFLAGS += -DTA_DIR=\"$(TA_DIR)\"
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0f338b7..fb22014 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,7 +22,7 @@
-Wswitch-default -Wunsafe-loop-optimizations
-Wwrite-strings -fPIC
-Wno-missing-field-initializers
- -Wno-unused-parameter
+ -Wno-unused-parameter -Wno-alloc-size
)
if(CFG_WERROR)
add_compile_options(-Werror)
diff --git a/host/xtest/Makefile b/host/xtest/Makefile
index 37f1d32..18ffb7b 100644
--- a/host/xtest/Makefile
+++ b/host/xtest/Makefile
@@ -148,7 +148,8 @@
-Wshadow -Wstrict-prototypes -Wswitch-default \
-Wwrite-strings -Wno-unused-parameter \
-Wno-declaration-after-statement \
- -Wno-missing-field-initializers -Wno-format-zero-length
+ -Wno-missing-field-initializers -Wno-format-zero-length \
+ -Wno-alloc-size
ifeq ($(CFG_WERROR),y)
CFLAGS += -Werror