[Spice-devel] [[spice] 2/9] Fix -Wunused-parameter

Fabiano Fidêncio fidencio at redhat.com
Mon Sep 1 06:45:35 PDT 2014


---
 server/tests/test_display_base.c               | 37 +++++++++++++++++---------
 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              | 23 ++++++++++------
 server/tests/test_playback.c                   |  2 +-
 server/tests/test_vdagent.c                    | 13 ++++++---
 7 files changed, 58 insertions(+), 31 deletions(-)

diff --git a/server/tests/test_display_base.c b/server/tests/test_display_base.c
index 03798ac..9bb29b7 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);
@@ -411,19 +411,22 @@ static void attache_worker(QXLInstance *qin, QXLWorker *_qxl_worker)
     spice_server_vm_start(test->server);
 }
 
-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;
@@ -466,7 +469,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;
@@ -616,7 +620,8 @@ static void do_wakeup(void *opaque)
     spice_qxl_wakeup(&test->qxl_instance);
 }
 
-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__);
@@ -711,24 +716,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) {
@@ -784,19 +790,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_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..82436dc 100644
--- a/server/tests/test_empty_success.c
+++ b/server/tests/test_empty_success.c
@@ -8,39 +8,46 @@ 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 cc7b120..2941d4b 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)
 {
 }
 
-- 
1.9.3



More information about the Spice-devel mailing list