From 97a2f3075727cf8bd4f13b7b804bf2de982bc831 Mon Sep 17 00:00:00 2001 From: Stephanos Ioannidis Date: Tue, 15 Oct 2024 23:46:19 +0900 Subject: [PATCH] thrift: Define module-wide _POSIX_C_SOURCE feature test macro The Thrift library makes use of POSIX C functions such as ctime_r(), which are not part of the ISO C standard. This commit adds a Thrift module-wide `_POSIX_C_SOURCE` feature test macro definition in order to ensure that the required POSIX C functions are available when compiling the Thrift library. Note that this was not caught earlier because Newlib and older versions of Picolibc did not properly fence off some POSIX functions behind the feature test macros. Signed-off-by: Stephanos Ioannidis --- modules/thrift/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/thrift/CMakeLists.txt b/modules/thrift/CMakeLists.txt index 02c22f2369f..9e8408cb646 100644 --- a/modules/thrift/CMakeLists.txt +++ b/modules/thrift/CMakeLists.txt @@ -39,4 +39,7 @@ zephyr_library_sources_ifdef(CONFIG_THRIFT_SSL_SOCKET # needed because std::iterator was deprecated with -std=c++17 zephyr_library_compile_options(-Wno-deprecated-declarations) +# needed for ctime_r +zephyr_library_compile_definitions(_POSIX_C_SOURCE=200809L) + endif(CONFIG_THRIFT)