zephyr/arch/posix
Patryk Duda 4fe5ac9248 arch: posix: Undefine operating system specific macros for native_sim
Compilers predefine system-specific macros which carry information about
compiler, target architecture and operating system. It provides basic
compiler-dependent information like size of types, their maximal and
minimal values, etc. It allows to write common libc headers for multiple
architectures and operating systems.

These macros allow code to always determine what is the target operating
system. This is a problem when compiling code of modules that supports
multiple operating systems (e.g. cryptography libraries).

To avoid confusion we shouldn't leak host operating system macros (e.g.
__linux__, __linux, linux, etc.) when compiling for native_sim board.

Unfortunately, there is no single universal switch that disables all
operating system macros:
- '-undef' removes also architecture-related macros
- '--target' is only available for Clang compiler

This patch uses '-include' option to include file that undefines all
well-known operating system macros.

Run 'gcc -dM -E - < /dev/null | sort' to get full list of predefined
macros.

Signed-off-by: Patryk Duda <patrykd@google.com>
2024-04-30 14:30:30 -04:00
..
core posix: tracing for custom thread abort func 2024-03-19 13:37:41 -05:00
include arch: posix: Undefine operating system specific macros for native_sim 2024-04-30 14:30:30 -04:00
CMakeLists.txt arch: posix: Undefine operating system specific macros for native_sim 2024-04-30 14:30:30 -04:00
Kconfig docs/Kconfig help: Replace native_[posix,sim]_64 2024-03-15 16:13:12 +01:00
Linux.aarch64.cmake arch/posix cmake: Replace native_posix w native_sim and use hwmv2 names 2024-03-15 16:13:12 +01:00