From 82e3efdfc6ffe311965b8f8612e2d2e521898e15 Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Thu, 6 Nov 2025 10:53:01 -0500 Subject: [PATCH 1/2] Remove non-functional `swt_getWASIVersion()`. A while back I implemented `swt_getWASIVersion()` to speculatively return the value of `WASI_SDK_VERSION` as defined by WASI, but that never landed and the [GitHub issue](https://github.com/WebAssembly/wasi-libc/issues/490) for it was closed. Remove the inoperative helper function here. --- Sources/Testing/Support/Versions.swift | 4 +--- Sources/_TestingInternals/include/Versions.h | 18 ------------------ 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/Sources/Testing/Support/Versions.swift b/Sources/Testing/Support/Versions.swift index b671b302b..1d65c923d 100644 --- a/Sources/Testing/Support/Versions.swift +++ b/Sources/Testing/Support/Versions.swift @@ -89,9 +89,7 @@ let operatingSystemVersion: String = { } } #elseif os(WASI) - if let version = swt_getWASIVersion().flatMap(String.init(validatingCString:)) { - return version - } + // WASI does not have an API to get the current WASI or Wasm version. #else #warning("Platform-specific implementation missing: OS version unavailable") #endif diff --git a/Sources/_TestingInternals/include/Versions.h b/Sources/_TestingInternals/include/Versions.h index b188a4d66..65fc4170e 100644 --- a/Sources/_TestingInternals/include/Versions.h +++ b/Sources/_TestingInternals/include/Versions.h @@ -53,24 +53,6 @@ SWT_EXTERN void swt_getTestingLibraryCommit(const char *_Nullable *_Nonnull outH /// testing library, or `nullptr` if that information is not available. SWT_EXTERN const char *_Nullable swt_getTargetTriple(void); -#if defined(__wasi__) -/// Get the version of the C standard library and runtime used by WASI, if -/// available. -/// -/// This function is provided because `WASI_SDK_VERSION` may or may not be -/// defined and may or may not be a complex macro. -/// -/// For more information about the `WASI_SDK_VERSION` macro, see -/// [wasi-libc-#490](https://github.com/WebAssembly/wasi-libc/issues/490). -static const char *_Nullable swt_getWASIVersion(void) { -#if defined(WASI_SDK_VERSION) - return WASI_SDK_VERSION; -#else - return 0; -#endif -} -#endif - SWT_ASSUME_NONNULL_END #endif From 7557e873b31aa37cd014101214117cbb76b4f773 Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Thu, 6 Nov 2025 11:09:48 -0500 Subject: [PATCH 2/2] Add moar comment --- Sources/Testing/Support/Versions.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/Testing/Support/Versions.swift b/Sources/Testing/Support/Versions.swift index 1d65c923d..85d55429d 100644 --- a/Sources/Testing/Support/Versions.swift +++ b/Sources/Testing/Support/Versions.swift @@ -90,6 +90,7 @@ let operatingSystemVersion: String = { } #elseif os(WASI) // WASI does not have an API to get the current WASI or Wasm version. + // wasi-libc does have uname(3), but it's stubbed out. #else #warning("Platform-specific implementation missing: OS version unavailable") #endif