modules/zcbor: Fix implicit function declaration warning

Both zcbor_encode.c & zcbor_decode.c use strnlen()
In general these 2 functions are only exposed by the C library
if _POSIX_C_SOURCE is set 200809L.
But neither of these files (or their build scripts), are setting
this macro, causing build warnings
 Implicit declaration of function ‘strnlen’
which turn into failures in CI with some libCs.
Let's set this macro to avoid this issue.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
Alberto Escolar Piedras 2024-01-25 17:42:45 +01:00 committed by Anas Nashif
parent ca68ef7e5a
commit 1b90d29c89

View file

@ -10,6 +10,8 @@ if(CONFIG_ZCBOR)
${ZEPHYR_ZCBOR_MODULE_DIR}/src/zcbor_encode.c
)
zephyr_library_compile_definitions(_POSIX_C_SOURCE=200809L)
zephyr_compile_definitions_ifdef(CONFIG_ZCBOR_CANONICAL ZCBOR_CANONICAL)
zephyr_compile_definitions_ifdef(CONFIG_ZCBOR_STOP_ON_ERROR ZCBOR_STOP_ON_ERROR)
zephyr_compile_definitions_ifdef(CONFIG_ZCBOR_VERBOSE ZCBOR_VERBOSE)