From 2299439873e72e5a24f10285d100fc15d81eaf69 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 | 26 ++++---- .../displayserver/linux/wayland/kde-output.c | 66 +++++++++---------- .../displayserver/linux/wayland/wayland.c | 6 +- .../displayserver/linux/wayland/wayland.h | 4 +- 4 files changed, 52 insertions(+), 50 deletions(-) diff --git a/src/detection/displayserver/linux/wayland/global-output.c b/src/detection/displayserver/linux/wayland/global-output.c index e15199218..b2621fd62 100644 --- a/src/detection/displayserver/linux/wayland/global-output.c +++ b/src/detection/displayserver/linux/wayland/global-output.c @@ -54,7 +54,7 @@ static void handleXdgLogicalSize(void* data, FF_A_UNUSED struct zxdg_output_v1* static void* outputListener[] = { waylandOutputGeometryListener, // geometry waylandOutputModeListener, // mode - stubListener, // done + ffWaylandStubListener, // done waylandOutputScaleListener, // scale ffWaylandOutputNameListener, // name ffWaylandOutputDescriptionListener, // description @@ -64,9 +64,9 @@ static_assert( "sizeof(outputListener) is too small. Please report it to fastfetch github issue"); 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, FF_A_UNUSED struct wp_image_description_ } 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 73f9ac5af..353dca813 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, FF_A_UNUSED struct kde_output_device_v2* _, struct kde_output_device_mode_v2* mode) { @@ -151,43 +151,43 @@ static struct kde_output_device_v2_listener outputListener = { .geometry = waylandKdeGeometryListener, .current_mode = waylandKdeCurrentModeListener, .mode = waylandKdeModeListener, - .done = (void*) stubListener, + .done = (void*) ffWaylandStubListener, .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) { @@ -288,7 +288,7 @@ static void waylandKdeOutputListener(void* data, FF_A_UNUSED struct kde_output_d 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 647aa067f..1d4183e82 100644 --- a/src/detection/displayserver/linux/wayland/wayland.c +++ b/src/detection/displayserver/linux/wayland/wayland.c @@ -253,7 +253,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); @@ -339,6 +339,10 @@ const char* ffdsConnectWayland(FFDisplayServerResult* result) { return NULL; } +void ffWaylandStubListener(void* data, ...) { + FF_UNUSED(data); +} + #else const char* ffdsConnectWayland(FF_A_UNUSED FFDisplayServerResult* result) { diff --git a/src/detection/displayserver/linux/wayland/wayland.h b/src/detection/displayserver/linux/wayland/wayland.h index e9d4fede8..d6f98e3cc 100644 --- a/src/detection/displayserver/linux/wayland/wayland.h +++ b/src/detection/displayserver/linux/wayland/wayland.h @@ -60,9 +60,7 @@ typedef struct WaylandDisplay { bool primary; } WaylandDisplay; -inline static void stubListener(void* data, ...) { - (void) data; -} +void ffWaylandStubListener(void* data, ...); inline static uint64_t ffWaylandGenerateIdFromName(const char* name) { uint64_t id = 0;