From c585df49966048275cb5245b84f46ecc7f75d509 Mon Sep 17 00:00:00 2001 From: Yuval Peress Date: Mon, 21 Nov 2022 09:42:14 -0700 Subject: [PATCH] unittest: add C++ support Some of the struct in the unit test's cpu.h header were empty which isn't allowed in C++. Signed-off-by: Yuval Peress --- subsys/testsuite/ztest/include/zephyr/arch/cpu.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/subsys/testsuite/ztest/include/zephyr/arch/cpu.h b/subsys/testsuite/ztest/include/zephyr/arch/cpu.h index db794cbda70..3f49c4a25b8 100644 --- a/subsys/testsuite/ztest/include/zephyr/arch/cpu.h +++ b/subsys/testsuite/ztest/include/zephyr/arch/cpu.h @@ -6,17 +6,27 @@ /* This file exists as a hack around Zephyr's dependencies */ +#include + #ifdef __cplusplus extern "C" { #endif /* Architecture thread structure */ struct _callee_saved { +#ifdef CONFIG_CPLUSPLUS + /* C++ does not allow empty structs, add an extra 1 byte */ + uint8_t c; +#endif }; typedef struct _callee_saved _callee_saved_t; struct _thread_arch { +#ifdef CONFIG_CPLUSPLUS + /* C++ does not allow empty structs, add an extra 1 byte */ + uint8_t c; +#endif }; typedef struct _thread_arch _thread_arch_t;