zephyr/lib/libc
Stephanos Ioannidis 82a902e5ea lib: newlib: Define _ANSI_SOURCE
This commit updates the Newlib integration to define `_ANSI_SOURCE`
in order to prevent Newlib from defining POSIX primitives in its
headers when GNU dialect is used (`-std=gnu*`).

Newlib `features.h` defines `_DEFAULT_SOURCE` when `__STRICT_ANSI__`
is not defined by GCC (i.e. when `-std=gnu*`), which results in the
Newlib headers defining POSIX primitives that are in conflict with the
POSIX primitives defined by Zephyr.

Newlib must not define POSIX primitives unless the feature test macros
such as `_POSIX_SOURCE`, `_GNU_SOURCE` and `_DEFAULT_SOURCE` are
explicitly defined.

Note that `-std=gnu` does not imply `_GNU_SOURCE` or `_DEFAULT_SOURCE`
because it is only supposed to instruct the compiler to use the GNU C
language dialect (i.e. GNU C language extensions).

Refer to the GitHub issue #52739 for more details.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
2022-12-05 11:02:36 +01:00
..
arcmwdt lib: migrate includes to <zephyr/...> 2022-05-06 19:58:09 +02:00
armstdc lib: migrate includes to <zephyr/...> 2022-05-06 19:58:09 +02:00
minimal libc: minimal: Add C11 aligned_alloc 2022-10-03 10:13:25 +02:00
newlib lib: newlib: Define _ANSI_SOURCE 2022-12-05 11:02:36 +01:00
picolibc libc/picolibc: Remove unused POSIX-ish hooks 2022-11-02 06:49:32 -04:00
CMakeLists.txt lib/libc: Add picolibc support (aarch32, aarch64 and RISC-V) [v21] 2022-06-22 13:15:55 +02:00
Kconfig lib: libc: newlib: Make newlib nano variant optional 2022-10-19 16:02:51 +02:00