zephyr/arch/posix/include
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
..
asm_inline.h arch: migrate includes to <zephyr/...> 2022-05-06 19:57:22 +02:00
asm_inline_gcc.h everywhere: fix typos 2022-03-14 20:22:24 -04:00
kernel_arch_data.h kernel: add Z_STACK_PTR_ALIGN ARCH_STACK_PTR_ALIGN 2020-04-21 18:45:45 -04:00
kernel_arch_func.h kernel: update arch_switch_to_main_thread() 2020-07-30 21:11:14 -04:00
offsets_short_arch.h arch: posix: Remove unused offset symbols 2023-02-23 16:44:07 +01:00
posix_arch_internal.h include: add more missing zephyr/ prefixes 2022-05-27 15:20:27 -07:00
posix_cheats.h arch posix: Clarify some references to native_posix 2024-03-20 15:43:05 +01:00
posix_core.h arch POSIX: Refactor into a top and bottom 2023-06-23 12:16:26 +02:00
undef_system_defines.h arch: posix: Undefine operating system specific macros for native_sim 2024-04-30 14:30:30 -04:00