zephyr/arch
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
..
arc ARC: fault: Fix uninitialized memory access 2024-04-29 17:39:57 +01:00
arm arch: arm: cortex_m: enable interrupts before entering application’s main 2024-04-25 07:54:47 -04:00
arm64 kernel: rename Z_KERNEL_STACK_BUFFER to K_KERNEL_STACK_BUFFER 2024-03-27 19:27:10 -04:00
common hwmv2: Introduce Hardware model version 2 and convert devices 2024-03-02 16:56:33 -05:00
mips arch: mips: use LOG_ERR to print exceptions 2023-12-14 09:32:27 +01:00
nios2 arch: guard more code with CONFIG_EXCEPTION_DEBUG 2023-12-14 09:32:27 +01:00
posix arch: posix: Undefine operating system specific macros for native_sim 2024-04-30 14:30:30 -04:00
riscv arch: riscv: irq_manage: support ISR_OFFSET in dynamic IRQs 2024-04-25 15:03:23 +02:00
sparc arch: guard more code with CONFIG_EXCEPTION_DEBUG 2023-12-14 09:32:27 +01:00
x86 coding guidelines: comply with MISRA Rule 15.6 2024-04-30 16:20:38 +02:00
xtensa xtensa: mmu: Avoid unnecessary mapping 2024-04-27 11:05:45 +03:00
archs.yml hwmv2: Introduce Hardware model version 2 and convert devices 2024-03-02 16:56:33 -05:00
CMakeLists.txt cmake: enable -Wshadow partially for in-tree code 2023-08-22 11:39:58 +02:00
Kconfig arch: posix: Select at least C11 standard 2024-04-25 09:54:39 +00:00
Kconfig.v1 hwmv2: Introduce Hardware model version 2 and convert devices 2024-03-02 16:56:33 -05:00
Kconfig.v2 hwmv2: Introduce Hardware model version 2 and convert devices 2024-03-02 16:56:33 -05:00