From 717c6a1b21a498b97e81ef15f7ff720a25824676 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 26 Jul 2024 05:43:16 +0000 Subject: [PATCH] Add explicit void type parameter to C functions without parameters C functions with `()` as parameter list can take any number of parameters. But WebAssembly requires static signature information for every function call, so we need to explicitly specify `(void)` to indicate that the function takes no parameters. --- .../_FoundationCShims/include/platform_shims.h | 12 ++++++------ Sources/_FoundationCShims/platform_shims.c | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Sources/_FoundationCShims/include/platform_shims.h b/Sources/_FoundationCShims/include/platform_shims.h index 911fc9e7a..f8048e678 100644 --- a/Sources/_FoundationCShims/include/platform_shims.h +++ b/Sources/_FoundationCShims/include/platform_shims.h @@ -31,19 +31,19 @@ #include #endif -INTERNAL char * _Nullable * _Nullable _platform_shims_get_environ(); +INTERNAL char * _Nullable * _Nullable _platform_shims_get_environ(void); -INTERNAL void _platform_shims_lock_environ(); -INTERNAL void _platform_shims_unlock_environ(); +INTERNAL void _platform_shims_lock_environ(void); +INTERNAL void _platform_shims_unlock_environ(void); #if __has_include() #include -INTERNAL vm_size_t _platform_shims_vm_size(); +INTERNAL vm_size_t _platform_shims_vm_size(void); #endif #if __has_include() #include -INTERNAL mach_port_t _platform_mach_task_self(); +INTERNAL mach_port_t _platform_mach_task_self(void); #endif #if __has_include() @@ -65,7 +65,7 @@ typedef enum { } _platform_shims_OSThermalPressureLevel; -INTERNAL const char * _Nonnull _platform_shims_kOSThermalNotificationPressureLevelName(); +INTERNAL const char * _Nonnull _platform_shims_kOSThermalNotificationPressureLevelName(void); #endif #endif /* CSHIMS_PLATFORM_SHIMS */ diff --git a/Sources/_FoundationCShims/platform_shims.c b/Sources/_FoundationCShims/platform_shims.c index 5a400a468..dcc7045e9 100644 --- a/Sources/_FoundationCShims/platform_shims.c +++ b/Sources/_FoundationCShims/platform_shims.c @@ -23,19 +23,19 @@ extern char **environ; #if __has_include() #import -void _platform_shims_lock_environ() { +void _platform_shims_lock_environ(void) { environ_lock_np(); } -void _platform_shims_unlock_environ() { +void _platform_shims_unlock_environ(void) { environ_unlock_np(); } #else -void _platform_shims_lock_environ() { /* noop */ } -void _platform_shims_unlock_environ() { /* noop */ } +void _platform_shims_lock_environ(void) { /* noop */ } +void _platform_shims_unlock_environ(void) { /* noop */ } #endif -char ** _platform_shims_get_environ() { +char ** _platform_shims_get_environ(void) { #if __has_include() return *_NSGetEnviron(); #elif defined(_WIN32) @@ -48,20 +48,20 @@ char ** _platform_shims_get_environ() { } #if __has_include() -const char * _platform_shims_kOSThermalNotificationPressureLevelName() { +const char * _platform_shims_kOSThermalNotificationPressureLevelName(void) { return kOSThermalNotificationPressureLevelName; } #endif #if __has_include() -vm_size_t _platform_shims_vm_size() { +vm_size_t _platform_shims_vm_size(void) { // This shim exists because vm_page_size is not marked const, and therefore looks like global mutable state to Swift. return vm_page_size; } #endif #if __has_include() -mach_port_t _platform_mach_task_self() { +mach_port_t _platform_mach_task_self(void) { // This shim exists because mach_task_self_ is not marked const, and therefore looks like global mutable state to Swift. return mach_task_self(); }