cbor: add a workaround for -ffreestanding being passed to clang

Toolchain CMake files for clang currently pass -ffreestanding option
to prevent clang from picking the wrong copy of stdint.h. This is a
temporary hack until we fix clang distributions to not include the
GCC version of stdint.h. This hack, however, results in setting
__STDC_HOSTED__=0, which is being checked by cbor header files,
making some required functions unavailable as a result.
Undefine __STDC_HOSTED__ as a workaround. This flag is only passed
when compiling cbor itself.
pull/7764/head
Ivan Grokhotkov 2021-09-10 18:56:25 +02:00
rodzic 81b97b9a6b
commit 1e2b1238c6
1 zmienionych plików z 5 dodań i 0 usunięć

Wyświetl plik

@ -13,3 +13,8 @@ idf_component_register(SRCS "tinycbor/src/cborencoder_close_container_checked.c"
# for open_memstream.c
set_source_files_properties(tinycbor/src/open_memstream.c PROPERTIES COMPILE_DEFINITIONS "__linux__")
# workaround for the fact that we are passing -ffreestanding to Clang
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
target_compile_options(${COMPONENT_LIB} PRIVATE "-U __STDC_HOSTED__")
endif()