ztest: define _POSIX_C_SOURCE macro

Add declaration of the _POSIX_C_SOURCE < 200809L for ztest library for
declaration of strtok_r and strdup functions.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
This commit is contained in:
Dawid Niedzwiecki 2024-03-18 10:34:59 +01:00 committed by Fabio Baltieri
parent 4045975c80
commit f36570a357
2 changed files with 4 additions and 3 deletions

View file

@ -15,6 +15,10 @@ if(DEFINED TC_RUNID)
endif()
zephyr_library()
# For strtok_r() and strdup()
zephyr_library_compile_options(-D_POSIX_C_SOURCE=200809L)
zephyr_library_sources(
src/ztest.c
src/ztest_error_hook.c

View file

@ -4,9 +4,6 @@
* SPDX-License-Identifier: Apache-2.0
*/
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200809L
#include <stdio.h>
#include <stdlib.h>
#include "cmdline.h" /* native_sim command line options header */