From 19a48c295bb2e0cb546a4cd9ad8582c4ab26c7d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Mon, 1 Sep 2014 13:24:55 +0200 Subject: [PATCH] Fix -Wunused-parameter (cherry picked from commit 5ea7de3bccafa21963548abcb5b7061de4c59910) --- server/tests/test_display_base.c | 37 +++++++++++++++++--------- server/tests/test_display_base.h | 1 + server/tests/test_display_no_ssl.c | 2 +- server/tests/test_display_resolution_changes.c | 3 ++- server/tests/test_display_width_stride.c | 9 ++++--- server/tests/test_empty_success.c | 24 +++++++++++------ server/tests/test_playback.c | 2 +- server/tests/test_vdagent.c | 13 ++++++--- 8 files changed, 60 insertions(+), 31 deletions(-) diff --git a/server/tests/test_display_base.c b/server/tests/test_display_base.c index 20c0e47..602691b 100644 --- a/server/tests/test_display_base.c +++ b/server/tests/test_display_base.c @@ -64,7 +64,7 @@ static int rects = 16; //number of rects that will be draw static int has_automated_tests = 0; //automated test flag __attribute__((noreturn)) -static void sigchld_handler(int signal_num) // wait for the child process and exit +static void sigchld_handler(SPICE_GNUC_UNUSED int signal_num) // wait for the child process and exit { int status; wait(&status); @@ -412,19 +412,22 @@ static void attache_worker(QXLInstance *qin, QXLWorker *_qxl_worker) test->qxl_worker->start(test->qxl_worker); } -static void set_compression_level(QXLInstance *qin, int level) +static void set_compression_level(SPICE_GNUC_UNUSED QXLInstance *qin, + SPICE_GNUC_UNUSED int level) { printf("%s\n", __func__); } -static void set_mm_time(QXLInstance *qin, uint32_t mm_time) +static void set_mm_time(SPICE_GNUC_UNUSED QXLInstance *qin, + SPICE_GNUC_UNUSED uint32_t mm_time) { } // we now have a secondary surface #define MAX_SURFACE_NUM 2 -static void get_init_info(QXLInstance *qin, QXLDevInitInfo *info) +static void get_init_info(SPICE_GNUC_UNUSED QXLInstance *qin, + QXLDevInitInfo *info) { memset(info, 0, sizeof(*info)); info->num_memslots = 1; @@ -467,7 +470,8 @@ static int get_num_commands(void) } // called from spice_server thread (i.e. red_worker thread) -static int get_command(QXLInstance *qin, struct QXLCommandExt *ext) +static int get_command(SPICE_GNUC_UNUSED QXLInstance *qin, + struct QXLCommandExt *ext) { if (get_num_commands() == 0) { return FALSE; @@ -617,7 +621,8 @@ static void do_wakeup(void *opaque) test->qxl_worker->wakeup(test->qxl_worker); } -static void release_resource(QXLInstance *qin, struct QXLReleaseInfoExt release_info) +static void release_resource(SPICE_GNUC_UNUSED QXLInstance *qin, + struct QXLReleaseInfoExt release_info) { QXLCommandExt *ext = (QXLCommandExt*)(unsigned long)release_info.info->id; //printf("%s\n", __func__); @@ -713,24 +718,25 @@ static int get_cursor_command(QXLInstance *qin, struct QXLCommandExt *ext) return TRUE; } -static int req_cursor_notification(QXLInstance *qin) +static int req_cursor_notification(SPICE_GNUC_UNUSED QXLInstance *qin) { printf("%s\n", __func__); return TRUE; } -static void notify_update(QXLInstance *qin, uint32_t update_id) +static void notify_update(SPICE_GNUC_UNUSED QXLInstance *qin, + SPICE_GNUC_UNUSED uint32_t update_id) { printf("%s\n", __func__); } -static int flush_resources(QXLInstance *qin) +static int flush_resources(SPICE_GNUC_UNUSED QXLInstance *qin) { printf("%s\n", __func__); return TRUE; } -static int client_monitors_config(QXLInstance *qin, +static int client_monitors_config(SPICE_GNUC_UNUSED QXLInstance *qin, VDAgentMonitorsConfig *monitors_config) { if (!monitors_config) { @@ -786,19 +792,24 @@ void test_add_display_interface(Test* test) spice_server_add_interface(test->server, &test->qxl_instance.base); } -static int vmc_write(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len) +static int vmc_write(SPICE_GNUC_UNUSED SpiceCharDeviceInstance *sin, + SPICE_GNUC_UNUSED const uint8_t *buf, + int len) { printf("%s: %d\n", __func__, len); return len; } -static int vmc_read(SpiceCharDeviceInstance *sin, uint8_t *buf, int len) +static int vmc_read(SPICE_GNUC_UNUSED SpiceCharDeviceInstance *sin, + SPICE_GNUC_UNUSED uint8_t *buf, + int len) { printf("%s: %d\n", __func__, len); return 0; } -static void vmc_state(SpiceCharDeviceInstance *sin, int connected) +static void vmc_state(SPICE_GNUC_UNUSED SpiceCharDeviceInstance *sin, + int connected) { printf("%s: %d\n", __func__, connected); } diff --git a/server/tests/test_display_base.h b/server/tests/test_display_base.h index d2823a7..0a58186 100644 --- a/server/tests/test_display_base.h +++ b/server/tests/test_display_base.h @@ -2,6 +2,7 @@ #define __TEST_DISPLAY_BASE_H__ #include +#include #include "basic_event_loop.h" #define COUNT(x) ((sizeof(x)/sizeof(x[0]))) diff --git a/server/tests/test_display_no_ssl.c b/server/tests/test_display_no_ssl.c index 83ab3dc..89b4796 100644 --- a/server/tests/test_display_no_ssl.c +++ b/server/tests/test_display_no_ssl.c @@ -17,7 +17,7 @@ void show_channels(SpiceServer *server); int ping_ms = 100; -void pinger(void *opaque) +void pinger(SPICE_GNUC_UNUSED void *opaque) { // show_channels is not thread safe - fails if disconnections / connections occur //show_channels(server); diff --git a/server/tests/test_display_resolution_changes.c b/server/tests/test_display_resolution_changes.c index 4767ea9..c492653 100644 --- a/server/tests/test_display_resolution_changes.c +++ b/server/tests/test_display_resolution_changes.c @@ -22,7 +22,8 @@ void pinger(void *opaque) test->core->timer_start(ping_timer, ping_ms); } -void set_primary_params(Test *test, Command *command) +void set_primary_params(SPICE_GNUC_UNUSED Test *test, + Command *command) { #if 0 static int toggle = 0; diff --git a/server/tests/test_display_width_stride.c b/server/tests/test_display_width_stride.c index f938373..a071e74 100644 --- a/server/tests/test_display_width_stride.c +++ b/server/tests/test_display_width_stride.c @@ -25,7 +25,8 @@ void pinger(void *opaque) static int g_surface_id = 1; static uint8_t *g_surface_data; -void set_draw_parameters(Test *test, Command *command) +void set_draw_parameters(SPICE_GNUC_UNUSED Test *test, + Command *command) { static int count = 17; CommandDrawSolid *solid = &command->solid; @@ -38,7 +39,8 @@ void set_draw_parameters(Test *test, Command *command) count++; } -void set_surface_params(Test *test, Command *command) +void set_surface_params(SPICE_GNUC_UNUSED Test *test, + Command *command) { CommandCreateSurface *create = &command->create_surface; @@ -54,7 +56,8 @@ void set_surface_params(Test *test, Command *command) create->data = g_surface_data; } -void set_destroy_parameters(Test *test, Command *command) +void set_destroy_parameters(SPICE_GNUC_UNUSED Test *test, + SPICE_GNUC_UNUSED Command *command) { if (g_surface_data) { free(g_surface_data); diff --git a/server/tests/test_empty_success.c b/server/tests/test_empty_success.c index 0176a52..6a3bb55 100644 --- a/server/tests/test_empty_success.c +++ b/server/tests/test_empty_success.c @@ -3,44 +3,52 @@ #include #include +#include struct SpiceTimer { int a,b; }; -SpiceTimer* timer_add(SpiceTimerFunc func, void *opaque) +SpiceTimer* timer_add(SPICE_GNUC_UNUSED SpiceTimerFunc func, + SPICE_GNUC_UNUSED void *opaque) { static struct SpiceTimer t = {0,}; return &t; } -void timer_start(SpiceTimer *timer, uint32_t ms) +void timer_start(SPICE_GNUC_UNUSED SpiceTimer *timer, + SPICE_GNUC_UNUSED uint32_t ms) { } -void timer_cancel(SpiceTimer *timer) +void timer_cancel(SPICE_GNUC_UNUSED SpiceTimer *timer) { } -void timer_remove(SpiceTimer *timer) +void timer_remove(SPICE_GNUC_UNUSED SpiceTimer *timer) { } -SpiceWatch *watch_add(int fd, int event_mask, SpiceWatchFunc func, void *opaque) +SpiceWatch *watch_add(SPICE_GNUC_UNUSED int fd, + SPICE_GNUC_UNUSED int event_mask, + SPICE_GNUC_UNUSED SpiceWatchFunc func, + SPICE_GNUC_UNUSED void *opaque) { return NULL; } -void watch_update_mask(SpiceWatch *watch, int event_mask) +void watch_update_mask(SPICE_GNUC_UNUSED SpiceWatch *watch, + SPICE_GNUC_UNUSED int event_mask) { } -void watch_remove(SpiceWatch *watch) +void watch_remove(SPICE_GNUC_UNUSED SpiceWatch *watch) { } -void channel_event(int event, SpiceChannelEventInfo *info) +void channel_event(SPICE_GNUC_UNUSED int event, + SPICE_GNUC_UNUSED SpiceChannelEventInfo *info) { } diff --git a/server/tests/test_playback.c b/server/tests/test_playback.c index ed1b766..1e82c43 100644 --- a/server/tests/test_playback.c +++ b/server/tests/test_playback.c @@ -45,7 +45,7 @@ static void get_frame(void) : 100; } -void playback_timer_cb(void *opaque) +void playback_timer_cb(SPICE_GNUC_UNUSED void *opaque) { static int t = 0; static uint64_t last_sent_usec = 0; diff --git a/server/tests/test_vdagent.c b/server/tests/test_vdagent.c index af33145..7a56c2a 100644 --- a/server/tests/test_vdagent.c +++ b/server/tests/test_vdagent.c @@ -20,7 +20,7 @@ int ping_ms = 100; #define MIN(a, b) ((a) > (b) ? (b) : (a)) #endif -void pinger(void *opaque) +void pinger(SPICE_GNUC_UNUSED void *opaque) { // show_channels is not thread safe - fails if disconnections / connections occur //show_channels(server); @@ -29,12 +29,16 @@ void pinger(void *opaque) } -static int vmc_write(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len) +static int vmc_write(SPICE_GNUC_UNUSED SpiceCharDeviceInstance *sin, + SPICE_GNUC_UNUSED const uint8_t *buf, + int len) { return len; } -static int vmc_read(SpiceCharDeviceInstance *sin, uint8_t *buf, int len) +static int vmc_read(SPICE_GNUC_UNUSED SpiceCharDeviceInstance *sin, + uint8_t *buf, + int len) { static uint8_t c = 0; static uint8_t message[2048]; @@ -70,7 +74,8 @@ static int vmc_read(SpiceCharDeviceInstance *sin, uint8_t *buf, int len) return ret; } -static void vmc_state(SpiceCharDeviceInstance *sin, int connected) +static void vmc_state(SPICE_GNUC_UNUSED SpiceCharDeviceInstance *sin, + SPICE_GNUC_UNUSED int connected) { }