From a0fd59d869465b63a981ff377a2ded5bb9b9dbd8 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Tue, 14 Jul 2026 11:05:17 +0800 Subject: [PATCH] DisplayServer (Linux): don't try to inline functions with variable arguments --- .../linux/wayland/global-output.c | 24 +++---- .../displayserver/linux/wayland/kde-output.c | 64 +++++++++---------- .../displayserver/linux/wayland/wayland.c | 6 +- .../displayserver/linux/wayland/wayland.h | 4 +- 4 files changed, 50 insertions(+), 48 deletions(-) diff --git a/src/detection/displayserver/linux/wayland/global-output.c b/src/detection/displayserver/linux/wayland/global-output.c index d92d055d7..26553a2dd 100644 --- a/src/detection/displayserver/linux/wayland/global-output.c +++ b/src/detection/displayserver/linux/wayland/global-output.c @@ -64,9 +64,9 @@ static struct wl_output_listener outputListener = { }; static struct zxdg_output_v1_listener zxdgOutputListener = { - .logical_position = (void*) stubListener, + .logical_position = (void*) ffWaylandStubListener, .logical_size = handleXdgLogicalSize, - .done = (void*) stubListener, + .done = (void*) ffWaylandStubListener, .name = (void*) ffWaylandOutputNameListener, .description = (void*) ffWaylandOutputDescriptionListener, }; @@ -84,17 +84,17 @@ static void handleWpTfNamed(void *data, [[maybe_unused]] struct wp_image_descrip } static const struct wp_image_description_info_v1_listener wpImageDescInfoListener = { - .done = (void*) stubListener, - .icc_file = (void*) stubListener, - .primaries = (void*) stubListener, - .primaries_named = (void*) stubListener, - .tf_power = (void*) stubListener, + .done = (void*) ffWaylandStubListener, + .icc_file = (void*) ffWaylandStubListener, + .primaries = (void*) ffWaylandStubListener, + .primaries_named = (void*) ffWaylandStubListener, + .tf_power = (void*) ffWaylandStubListener, .tf_named = (void*) handleWpTfNamed, - .luminances = (void*) stubListener, - .target_primaries = (void*) stubListener, - .target_luminance = (void*) stubListener, - .target_max_cll = (void*) stubListener, - .target_max_fall = (void*) stubListener, + .luminances = (void*) ffWaylandStubListener, + .target_primaries = (void*) ffWaylandStubListener, + .target_luminance = (void*) ffWaylandStubListener, + .target_max_cll = (void*) ffWaylandStubListener, + .target_max_fall = (void*) ffWaylandStubListener, }; const char* ffWaylandHandleGlobalOutput(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version) { diff --git a/src/detection/displayserver/linux/wayland/kde-output.c b/src/detection/displayserver/linux/wayland/kde-output.c index 0464ab437..602827d30 100644 --- a/src/detection/displayserver/linux/wayland/kde-output.c +++ b/src/detection/displayserver/linux/wayland/kde-output.c @@ -33,8 +33,8 @@ static const struct kde_output_device_mode_v2_listener modeListener = { .size = waylandKdeModeSizeListener, .refresh = waylandKdeModeRefreshListener, .preferred = waylandKdeModePreferredListener, - .removed = (void*) stubListener, - .flags = (void*) stubListener, + .removed = (void*) ffWaylandStubListener, + .flags = (void*) ffWaylandStubListener, }; static void waylandKdeModeListener(void* data, [[maybe_unused]] struct kde_output_device_v2* _, struct kde_output_device_mode_v2* mode) { @@ -160,39 +160,39 @@ static struct kde_output_device_v2_listener outputListener = { .scale = waylandKdeScaleListener, .edid = waylandKdeEdidListener, .enabled = waylandKdeEnabledListener, - .uuid = (void*) stubListener, - .serial_number = (void*) stubListener, - .eisa_id = (void*) stubListener, - .capabilities = (void*) stubListener, - .overscan = (void*) stubListener, - .vrr_policy = (void*) stubListener, - .rgb_range = (void*) stubListener, + .uuid = (void*) ffWaylandStubListener, + .serial_number = (void*) ffWaylandStubListener, + .eisa_id = (void*) ffWaylandStubListener, + .capabilities = (void*) ffWaylandStubListener, + .overscan = (void*) ffWaylandStubListener, + .vrr_policy = (void*) ffWaylandStubListener, + .rgb_range = (void*) ffWaylandStubListener, .name = waylandKdeNameListener, .high_dynamic_range = waylandKdeHdrListener, - .sdr_brightness = (void*) stubListener, - .wide_color_gamut = (void*) stubListener, - .auto_rotate_policy = (void*) stubListener, - .icc_profile_path = (void*) stubListener, - .brightness_metadata = (void*) stubListener, - .brightness_overrides = (void*) stubListener, - .sdr_gamut_wideness = (void*) stubListener, - .color_profile_source = (void*) stubListener, - .brightness = (void*) stubListener, - .color_power_tradeoff = (void*) stubListener, - .dimming = (void*) stubListener, - .replication_source = (void*) stubListener, - .ddc_ci_allowed = (void*) stubListener, + .sdr_brightness = (void*) ffWaylandStubListener, + .wide_color_gamut = (void*) ffWaylandStubListener, + .auto_rotate_policy = (void*) ffWaylandStubListener, + .icc_profile_path = (void*) ffWaylandStubListener, + .brightness_metadata = (void*) ffWaylandStubListener, + .brightness_overrides = (void*) ffWaylandStubListener, + .sdr_gamut_wideness = (void*) ffWaylandStubListener, + .color_profile_source = (void*) ffWaylandStubListener, + .brightness = (void*) ffWaylandStubListener, + .color_power_tradeoff = (void*) ffWaylandStubListener, + .dimming = (void*) ffWaylandStubListener, + .replication_source = (void*) ffWaylandStubListener, + .ddc_ci_allowed = (void*) ffWaylandStubListener, .max_bits_per_color = (void*) waylandKdeMaxBitsPerColorListener, - .max_bits_per_color_range = (void*) stubListener, - .automatic_max_bits_per_color_limit = (void*) stubListener, - .edr_policy = (void*) stubListener, - .sharpness = (void*) stubListener, + .max_bits_per_color_range = (void*) ffWaylandStubListener, + .automatic_max_bits_per_color_limit = (void*) ffWaylandStubListener, + .edr_policy = (void*) ffWaylandStubListener, + .sharpness = (void*) ffWaylandStubListener, .priority = waylandKdePriorityListener, - .auto_brightness = (void*) stubListener, - .removed = (void*) stubListener, - .hdr_icc_profile_path = (void*) stubListener, - .hdr_color_profile_source = (void*) stubListener, - .abm_level = (void*) stubListener, + .auto_brightness = (void*) ffWaylandStubListener, + .removed = (void*) ffWaylandStubListener, + .hdr_icc_profile_path = (void*) ffWaylandStubListener, + .hdr_color_profile_source = (void*) ffWaylandStubListener, + .abm_level = (void*) ffWaylandStubListener, }; static const char* waylandKdeHandleOutput(WaylandData* wldata, struct wl_proxy* output) { @@ -300,7 +300,7 @@ static void waylandKdeOutputListener(void* data, [[maybe_unused]] struct kde_out static struct kde_output_device_registry_v2_listener registryListener = { .output = waylandKdeOutputListener, - .finished = (void*) stubListener, + .finished = (void*) ffWaylandStubListener, }; const char* ffWaylandHandleKdeOutputRegistry(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version) { diff --git a/src/detection/displayserver/linux/wayland/wayland.c b/src/detection/displayserver/linux/wayland/wayland.c index 6b9c41b69..c1beb6911 100644 --- a/src/detection/displayserver/linux/wayland/wayland.c +++ b/src/detection/displayserver/linux/wayland/wayland.c @@ -292,7 +292,7 @@ const char* ffdsConnectWayland(FFDisplayServerResult* result) { struct wl_registry_listener registry_listener = { .global = waylandGlobalAddListener, - .global_remove = (void*) stubListener + .global_remove = (void*) ffWaylandStubListener }; data.ffwl_proxy_add_listener(registry, (void (**)(void)) ®istry_listener, &data); @@ -378,6 +378,10 @@ const char* ffdsConnectWayland(FFDisplayServerResult* result) { return nullptr; } +void ffWaylandStubListener(...) { + // no-op +} + #else const char* ffdsConnectWayland([[maybe_unused]] FFDisplayServerResult* result) { diff --git a/src/detection/displayserver/linux/wayland/wayland.h b/src/detection/displayserver/linux/wayland/wayland.h index 257498c0f..b7d486cce 100644 --- a/src/detection/displayserver/linux/wayland/wayland.h +++ b/src/detection/displayserver/linux/wayland/wayland.h @@ -68,9 +68,7 @@ typedef struct WaylandDisplay { bool done; } WaylandDisplay; -inline static void stubListener(void* data, ...) { - (void) data; -} +void ffWaylandStubListener(...); inline static uint64_t ffWaylandGenerateIdFromName(const char* name) { uint64_t id = 0;