From 8b57723038c83211dae55b32e5603efb287bd144 Mon Sep 17 00:00:00 2001 From: vkensou Date: Fri, 29 Aug 2025 10:51:33 +0800 Subject: [PATCH 1/3] Fix compilation error when MSVC is not set to C11 standard --- core/shared/platform/include/platform_wasi_types.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/shared/platform/include/platform_wasi_types.h b/core/shared/platform/include/platform_wasi_types.h index 56ea7514ed..d8835a8ed6 100644 --- a/core/shared/platform/include/platform_wasi_types.h +++ b/core/shared/platform/include/platform_wasi_types.h @@ -29,6 +29,9 @@ #endif /* _Alignof */ extern "C" { +#elif defined(_MSC_VER) && !_CRT_HAS_C11 +#define _Static_assert static_assert +#define _Alignof __alignof #endif /* There is no need to check the WASI layout if we're using uvwasi or libc-wasi From bd1511672ee81f89460bc912ac0a59d031a6f5d2 Mon Sep 17 00:00:00 2001 From: vkensou Date: Mon, 1 Sep 2025 20:40:46 +0800 Subject: [PATCH 2/3] optimize --- core/shared/platform/include/platform_wasi_types.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/core/shared/platform/include/platform_wasi_types.h b/core/shared/platform/include/platform_wasi_types.h index d8835a8ed6..f6571d0025 100644 --- a/core/shared/platform/include/platform_wasi_types.h +++ b/core/shared/platform/include/platform_wasi_types.h @@ -20,19 +20,20 @@ /* clang-format off */ #ifdef __cplusplus +extern "C" { +#endif + #ifndef _Static_assert #define _Static_assert static_assert #endif /* _Static_assert */ #ifndef _Alignof -#define _Alignof alignof -#endif /* _Alignof */ - -extern "C" { -#elif defined(_MSC_VER) && !_CRT_HAS_C11 -#define _Static_assert static_assert +#if defined(_MSC_VER) && !_CRT_HAS_C11 #define _Alignof __alignof +#else +#define _Alignof alignof #endif +#endif /* _Alignof */ /* There is no need to check the WASI layout if we're using uvwasi or libc-wasi * is not enabled at all. */ From c4374f3dd0b1a735bd10032cfbcd9578824351e1 Mon Sep 17 00:00:00 2001 From: vkensou Date: Tue, 2 Sep 2025 11:21:02 +0800 Subject: [PATCH 3/3] Revert "optimize" This reverts commit bd1511672ee81f89460bc912ac0a59d031a6f5d2. --- core/shared/platform/include/platform_wasi_types.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/core/shared/platform/include/platform_wasi_types.h b/core/shared/platform/include/platform_wasi_types.h index f6571d0025..d8835a8ed6 100644 --- a/core/shared/platform/include/platform_wasi_types.h +++ b/core/shared/platform/include/platform_wasi_types.h @@ -20,21 +20,20 @@ /* clang-format off */ #ifdef __cplusplus -extern "C" { -#endif - #ifndef _Static_assert #define _Static_assert static_assert #endif /* _Static_assert */ #ifndef _Alignof -#if defined(_MSC_VER) && !_CRT_HAS_C11 -#define _Alignof __alignof -#else #define _Alignof alignof -#endif #endif /* _Alignof */ +extern "C" { +#elif defined(_MSC_VER) && !_CRT_HAS_C11 +#define _Static_assert static_assert +#define _Alignof __alignof +#endif + /* There is no need to check the WASI layout if we're using uvwasi or libc-wasi * is not enabled at all. */ #if WASM_ENABLE_UVWASI != 0 || WASM_ENABLE_LIBC_WASI == 0