mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-09-04 09:21:56 +00:00
The solution from #14312 of using -isystem to prioritize the position of the libc directory bypasses the effect of -ffreestanding with respect to libc symbols expected to be present in a non-hosted environment. Further, it breaks C++ with the ARM Embedded toolchain as the system fails to find the right file with #include_next. Use a more fine-grained solution that explicitly includes the underlying newlib header required for <inttypes.h> support before moving on to include the next available one, whether system or non-system. Closes #17564 Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
31 lines
799 B
C
31 lines
799 B
C
/*
|
|
* Copyright (c) 2019 Nordic Semiconductor ASA
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#ifndef ZEPHYR_LIB_LIBC_NEWLIB_INCLUDE_STDINT_H_
|
|
#define ZEPHYR_LIB_LIBC_NEWLIB_INCLUDE_STDINT_H_
|
|
|
|
/* Work around -ffreestanding absence of defines required to support
|
|
* PRI.64 macros in <inttypes.h> by including the newlib header that
|
|
* provides the flag macros.
|
|
*/
|
|
|
|
#include <newlib.h>
|
|
|
|
#ifdef __NEWLIB__
|
|
/* Has this header. Older versions do it in <stdint.h>. */
|
|
#include <sys/_stdint.h>
|
|
#endif /* __NEWLIB__ */
|
|
|
|
/* This should work on GCC and clang.
|
|
*
|
|
* If we need to support a toolchain without #include_next the CMake
|
|
* infrastructure should be used to identify it and provide an
|
|
* alternative solution.
|
|
*/
|
|
#include_next <stdint.h>
|
|
|
|
#endif /* ZEPHYR_LIB_LIBC_NEWLIB_INCLUDE_STDINT_H_ */
|