nvtt: posh.h — switch EMSCRIPTEN macro to __EMSCRIPTEN__ (#126)

emsdk >= 5.0 no longer predefines the legacy `EMSCRIPTEN` macro,
only `__EMSCRIPTEN__` (see emscripten-core/emscripten#21899). Switch
posh's OS+CPU detection to the modern spelling so vendored nvtt builds
under current emsdk.

Without this, posh falls through to "unknown OS", defsgnuclinux.h is
never included, `#define restrict __restrict__` never runs, and
nvcore/utils.h ships bare `restrict` into clang which rejects it
("expected ')'"). POSH_CPU detection then also fails with "POSH cannot
determine target CPU".

Suggested by @bkaradzic — drop the legacy spelling rather than add
`__EMSCRIPTEN__` alongside it.
This commit is contained in:
ShuangLiu1992
2026-05-28 18:05:22 +01:00
committed by GitHub
parent a4fc744770
commit 4e00d20f52

View File

@@ -298,8 +298,8 @@ LLVM:
** Determine target operating system
** ----------------------------------------------------------------------------
*/
#if defined linux || defined __linux__ || defined EMSCRIPTEN
# define POSH_OS_LINUX 1
#if defined linux || defined __linux__ || defined __EMSCRIPTEN__
# define POSH_OS_LINUX 1
# define POSH_OS_STRING "Linux"
#endif
@@ -548,7 +548,7 @@ LLVM:
# define POSH_CPU_STRING "PA-RISC"
#endif
#if defined EMSCRIPTEN
#if defined __EMSCRIPTEN__
# define POSH_CPU_EMSCRIPTEN 1
# define POSH_CPU_STRING "EMSCRIPTEN"
#endif