Re: [spice-gtk v2] tests: fix -Wall -Wextra compiler warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2016-10-03 at 15:23 +0200, Victor Toso wrote:
> From: Victor Toso <me@xxxxxxxxxxxxxx>
> 
> With -Wall a few -Wunused-variable and -Wunused-but-set-variable;
> With -Wextra lots of -Wunused-parameter and a few -Wsign-compare.
> 
> Signed-off-by: Victor Toso <victortoso@xxxxxxxxxx>
Acked-by: Pavel Grunt <pgrunt@xxxxxxxxxx>
> ---
>  tests/coroutine.c       |  2 +-
>  tests/file-transfer.c   | 27 +++++++++++++--------------
>  tests/mock-acl-helper.c |  4 +---
>  tests/pipe.c            | 33 ++++++++++++++++++---------------
>  tests/session.c         |  2 +-
>  tests/usb-acl-helper.c  | 18 +++++++++---------
>  6 files changed, 43 insertions(+), 43 deletions(-)
> 
> diff --git a/tests/coroutine.c b/tests/coroutine.c
> index bded593..7701277 100644
> --- a/tests/coroutine.c
> +++ b/tests/coroutine.c
> @@ -44,7 +44,7 @@ static void test_coroutine_simple(void)
>      g_assert(coroutine_self_is_main());
>  }
>  
> -static gpointer co_entry_two(gpointer data)
> +static gpointer co_entry_two(gpointer data G_GNUC_UNUSED)
>  {
>      struct coroutine *self = coroutine_self();
>      struct coroutine co = {
> diff --git a/tests/file-transfer.c b/tests/file-transfer.c
> index a27b9cf..0cfe9ff 100644
> --- a/tests/file-transfer.c
> +++ b/tests/file-transfer.c
> @@ -26,7 +26,7 @@ const gchar content[] = "0123456789_spice-file-
> transfer-task";
>  static void
>  f_setup(Fixture *f, gconstpointer user_data)
>  {
> -    gint i;
> +    guint i;
>      GError *err = NULL;
>  
>      f->loop = g_main_loop_new(NULL, FALSE);
> @@ -51,9 +51,9 @@ f_setup(Fixture *f, gconstpointer user_data)
>  }
>  
>  static void
> -f_teardown(Fixture *f, gconstpointer user_data)
> +f_teardown(Fixture *f, gconstpointer user_data G_GNUC_UNUSED)
>  {
> -    gint i;
> +    guint i;
>      GError *err = NULL;
>  
>      g_main_loop_unref(f->loop);
> @@ -72,8 +72,8 @@ f_teardown(Fixture *f, gconstpointer user_data)
>   * TEST SIMPLE TRANSFER
>  
> ********************************************************************
> **********/
>  static void
> -transfer_xfer_task_on_finished(SpiceFileTransferTask *xfer_task,
> -                               GError *error,
> +transfer_xfer_task_on_finished(SpiceFileTransferTask *xfer_task
> G_GNUC_UNUSED,
> +                               GError *error G_GNUC_UNUSED,
>                                 gpointer user_data)
>  {
>      Fixture *f = user_data;
> @@ -86,7 +86,7 @@
> transfer_xfer_task_on_finished(SpiceFileTransferTask *xfer_task,
>  static void
>  transfer_read_async_cb(GObject *source_object,
>                         GAsyncResult *res,
> -                       gpointer user_data)
> +                       gpointer user_data G_GNUC_UNUSED)
>  {
>      SpiceFileTransferTask *xfer_task;
>      gssize count;
> @@ -106,7 +106,7 @@ transfer_read_async_cb(GObject *source_object,
>  }
>  
>  static void
> -transfer_init_async_cb(GObject *obj, GAsyncResult *res, gpointer
> data)
> +transfer_init_async_cb(GObject *obj, GAsyncResult *res, gpointer
> data G_GNUC_UNUSED)
>  {
>      GFileInfo *info;
>      SpiceFileTransferTask *xfer_task;
> @@ -123,7 +123,7 @@ transfer_init_async_cb(GObject *obj,
> GAsyncResult *res, gpointer data)
>  }
>  
>  static void
> -test_simple_transfer(Fixture *f, gconstpointer user_data)
> +test_simple_transfer(Fixture *f, gconstpointer user_data
> G_GNUC_UNUSED)
>  {
>      GHashTableIter iter;
>      gpointer key, value;
> @@ -158,7 +158,7 @@ transfer_cancelled_on_init_async_cb(GObject
> *obj, GAsyncResult *res, gpointer da
>  }
>  
>  static void
> -test_cancel_before_task_init(Fixture *f, gconstpointer user_data)
> +test_cancel_before_task_init(Fixture *f, gconstpointer user_data
> G_GNUC_UNUSED)
>  {
>      GHashTableIter iter;
>      gpointer key, value;
> @@ -175,7 +175,7 @@ test_cancel_before_task_init(Fixture *f,
> gconstpointer user_data)
>  }
>  
>  static void
> -test_cancel_after_task_init(Fixture *f, gconstpointer user_data)
> +test_cancel_after_task_init(Fixture *f, gconstpointer user_data
> G_GNUC_UNUSED)
>  {
>      GHashTableIter iter;
>      gpointer key, value;
> @@ -253,7 +253,7 @@
> transfer_on_init_async_cb_after_read_cancel(GObject *obj,
> GAsyncResult *res, gpo
>  }
>  
>  static void
> -test_cancel_before_read_async(Fixture *f, gconstpointer user_data)
> +test_cancel_before_read_async(Fixture *f, gconstpointer user_data
> G_GNUC_UNUSED)
>  {
>      GHashTableIter iter;
>      gpointer key, value;
> @@ -269,7 +269,7 @@ test_cancel_before_read_async(Fixture *f,
> gconstpointer user_data)
>  }
>  
>  static void
> -test_cancel_after_read_async(Fixture *f, gconstpointer user_data)
> +test_cancel_after_read_async(Fixture *f, gconstpointer user_data
> G_GNUC_UNUSED)
>  {
>      GHashTableIter iter;
>      gpointer key, value;
> @@ -313,7 +313,6 @@ transfer_on_init_async_cb_agent_cancel(GObject
> *obj, GAsyncResult *res, gpointer
>      GFileInfo *info;
>      SpiceFileTransferTask *xfer_task;
>      GError *error = NULL;
> -    GCancellable *cancellable;
>  
>      xfer_task = SPICE_FILE_TRANSFER_TASK(obj);
>      info = spice_file_transfer_task_init_task_finish(xfer_task,
> res, &error);
> @@ -329,7 +328,7 @@ transfer_on_init_async_cb_agent_cancel(GObject
> *obj, GAsyncResult *res, gpointer
>  }
>  
>  static void
> -test_agent_cancel_on_read(Fixture *f, gconstpointer user_data)
> +test_agent_cancel_on_read(Fixture *f, gconstpointer user_data
> G_GNUC_UNUSED)
>  {
>      GHashTableIter iter;
>      gpointer key, value;
> diff --git a/tests/mock-acl-helper.c b/tests/mock-acl-helper.c
> index 782ebaf..76175dc 100644
> --- a/tests/mock-acl-helper.c
> +++ b/tests/mock-acl-helper.c
> @@ -22,8 +22,6 @@
>  #include <gio/gunixinputstream.h>
>  
>  static int exit_status;
> -static int busnum, devnum;
> -static char path[PATH_MAX];
>  static GMainLoop *loop;
>  static GDataInputStream *stdin_stream;
>  
> @@ -34,7 +32,7 @@ static void cleanup(void)
>  }
>  
>  
> -static void stdin_read_complete(GObject *src, GAsyncResult *res,
> gpointer data)
> +static void stdin_read_complete(GObject *src, GAsyncResult *res,
> gpointer data G_GNUC_UNUSED)
>  {
>      char *s = NULL;
>      const char *response = NULL;
> diff --git a/tests/pipe.c b/tests/pipe.c
> index 01629da..7a0dafd 100644
> --- a/tests/pipe.c
> +++ b/tests/pipe.c
> @@ -41,9 +41,9 @@ stop_loop (gpointer data)
>  
>  static void
>  fixture_set_up(Fixture *fixture,
> -               gconstpointer user_data)
> +               gconstpointer user_data G_GNUC_UNUSED)
>  {
> -    int i;
> +    unsigned int i;
>  
>      spice_make_pipe(&fixture->p1, &fixture->p2);
>      g_assert_true(G_IS_IO_STREAM(fixture->p1));
> @@ -70,7 +70,7 @@ fixture_set_up(Fixture *fixture,
>  
>  static void
>  fixture_tear_down(Fixture *fixture,
> -                  gconstpointer user_data)
> +                  gconstpointer user_data G_GNUC_UNUSED)
>  {
>      g_clear_object(&fixture->p1);
>      g_clear_object(&fixture->p2);
> @@ -85,7 +85,7 @@ fixture_tear_down(Fixture *fixture,
>  }
>  
>  static void
> -test_pipe_readblock(Fixture *f, gconstpointer user_data)
> +test_pipe_readblock(Fixture *f, gconstpointer user_data
> G_GNUC_UNUSED)
>  {
>      GError *error = NULL;
>      gssize size;
> @@ -93,13 +93,14 @@ test_pipe_readblock(Fixture *f, gconstpointer
> user_data)
>      size = g_input_stream_read(f->ip2, f->buf, 1,
>                                 f->cancellable, &error);
>  
> +    g_assert_cmpint(size, ==, -1);
>      g_assert_error(error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK);
>  
>      g_clear_error(&error);
>  }
>  
>  static void
> -test_pipe_writeblock(Fixture *f, gconstpointer user_data)
> +test_pipe_writeblock(Fixture *f, gconstpointer user_data
> G_GNUC_UNUSED)
>  {
>      GError *error = NULL;
>      gssize size;
> @@ -107,6 +108,7 @@ test_pipe_writeblock(Fixture *f, gconstpointer
> user_data)
>      size = g_output_stream_write(f->op1, "", 1,
>                                   f->cancellable, &error);
>  
> +    g_assert_cmpint(size, ==, -1);
>      g_assert_error(error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK);
>  
>      g_clear_error(&error);
> @@ -142,7 +144,7 @@ read_cb(GObject *source, GAsyncResult *result,
> gpointer user_data)
>  }
>  
>  static void
> -test_pipe_writeread(Fixture *f, gconstpointer user_data)
> +test_pipe_writeread(Fixture *f, gconstpointer user_data
> G_GNUC_UNUSED)
>  {
>      g_output_stream_write_async(f->op1, "", 1, G_PRIORITY_DEFAULT,
>                                  f->cancellable, write_cb, f->loop);
> @@ -160,7 +162,7 @@ test_pipe_writeread(Fixture *f, gconstpointer
> user_data)
>  }
>  
>  static void
> -test_pipe_readwrite(Fixture *f, gconstpointer user_data)
> +test_pipe_readwrite(Fixture *f, gconstpointer user_data
> G_GNUC_UNUSED)
>  {
>      g_input_stream_read_async(f->ip2, f->buf, 1,
> G_PRIORITY_DEFAULT,
>                                f->cancellable, read_cb,
> GINT_TO_POINTER(1));
> @@ -207,6 +209,7 @@ readclose_cb(GObject *source, GAsyncResult
> *result, gpointer user_data)
>  
>      nbytes = g_input_stream_read_finish(G_INPUT_STREAM(source),
> result, &error);
>  
> +    g_assert_cmpint(nbytes, ==, -1);
>      g_assert_error(error, G_IO_ERROR, G_IO_ERROR_CLOSED);
>      g_clear_error(&error);
>  
> @@ -214,7 +217,7 @@ readclose_cb(GObject *source, GAsyncResult
> *result, gpointer user_data)
>  }
>  
>  static void
> -test_pipe_readclosestream(Fixture *f, gconstpointer user_data)
> +test_pipe_readclosestream(Fixture *f, gconstpointer user_data
> G_GNUC_UNUSED)
>  {
>      GError *error = NULL;
>  
> @@ -226,7 +229,7 @@ test_pipe_readclosestream(Fixture *f,
> gconstpointer user_data)
>  }
>  
>  static void
> -test_pipe_readclose(Fixture *f, gconstpointer user_data)
> +test_pipe_readclose(Fixture *f, gconstpointer user_data
> G_GNUC_UNUSED)
>  {
>      GError *error = NULL;
>  
> @@ -246,6 +249,7 @@ readcancel_cb(GObject *source, GAsyncResult
> *result, gpointer user_data)
>  
>      nbytes = g_input_stream_read_finish(G_INPUT_STREAM(source),
> result, &error);
>  
> +    g_assert_cmpint(nbytes, ==, -1);
>      g_assert_error(error, G_IO_ERROR, G_IO_ERROR_CLOSED);
>      g_clear_error(&error);
>  
> @@ -253,7 +257,7 @@ readcancel_cb(GObject *source, GAsyncResult
> *result, gpointer user_data)
>  }
>  
>  static void
> -test_pipe_readcancel(Fixture *f, gconstpointer user_data)
> +test_pipe_readcancel(Fixture *f, gconstpointer user_data
> G_GNUC_UNUSED)
>  {
>      GError *error = NULL;
>  
> @@ -316,7 +320,7 @@ read_chunk_cb(GObject *source, GAsyncResult
> *result, gpointer user_data)
>  }
>  
>  static void
> -test_pipe_write_all_64_read_chunks_16(Fixture *f, gconstpointer
> user_data)
> +test_pipe_write_all_64_read_chunks_16(Fixture *f, gconstpointer
> user_data G_GNUC_UNUSED)
>  {
>      f->data_len = 64;
>      f->data = get_test_data(f->data_len);
> @@ -357,7 +361,7 @@ read_chunk_cb_and_try_write(GObject *source,
> GAsyncResult *result, gpointer user
>  }
>  
>  static void
> -test_pipe_concurrent_write(Fixture *f, gconstpointer user_data)
> +test_pipe_concurrent_write(Fixture *f, gconstpointer user_data
> G_GNUC_UNUSED)
>  {
>      f->data_len = 64;
>      f->data = get_test_data(f->data_len);
> @@ -393,7 +397,7 @@ write_all_cb_zombie_check(GObject *source,
> GAsyncResult *result, gpointer user_d
>  }
>  
>  static gboolean
> -source_cb (gpointer user_data)
> +source_cb (gpointer user_data G_GNUC_UNUSED)
>  {
>      return G_SOURCE_REMOVE;
>  }
> @@ -452,9 +456,8 @@ read_chunk_cb_and_do_zombie(GObject *source,
> GAsyncResult *result, gpointer user
>  }
>  
>  static void
> -test_pipe_zombie_sources(Fixture *f, gconstpointer user_data)
> +test_pipe_zombie_sources(Fixture *f, gconstpointer user_data
> G_GNUC_UNUSED)
>  {
> -    gint i;
>      f->data_len = 64;
>      f->data = get_test_data(f->data_len);
>      f->read_size = 16;
> diff --git a/tests/session.c b/tests/session.c
> index d065b60..00076f2 100644
> --- a/tests/session.c
> +++ b/tests/session.c
> @@ -3,7 +3,7 @@
>  static void test_session_uri(void)
>  {
>      SpiceSession *s;
> -    gint i;
> +    guint i;
>  
>      struct {
>          gchar *port;
> diff --git a/tests/usb-acl-helper.c b/tests/usb-acl-helper.c
> index 6cbc548..06f8036 100644
> --- a/tests/usb-acl-helper.c
> +++ b/tests/usb-acl-helper.c
> @@ -40,7 +40,7 @@ gboolean cancel_test(gpointer user_data)
>      return G_SOURCE_REMOVE;
>  }
>  
> -static void data_setup(Fixture *fixture, gconstpointer user_data)
> +static void data_setup(Fixture *fixture, gconstpointer user_data
> G_GNUC_UNUSED)
>  {
>      g_setenv("SPICE_USB_ACL_BINARY", TESTDIR"/test-mock-acl-
> helper", TRUE);
>      fixture->cancellable = g_cancellable_new();
> @@ -50,7 +50,7 @@ static void data_setup(Fixture *fixture,
> gconstpointer user_data)
>      fixture->timeout_source = g_timeout_add_seconds(2, abort_test,
> fixture);
>  }
>  
> -static void data_teardown(Fixture *fixture, gconstpointer
> user_data)
> +static void data_teardown(Fixture *fixture, gconstpointer user_data
> G_GNUC_UNUSED)
>  {
>      if (fixture->timeout_source)
>          g_source_remove(fixture->timeout_source);
> @@ -70,7 +70,7 @@ static void success_cb(GObject *source,
> GAsyncResult *result, gpointer user_data
>      g_main_loop_quit(f->loop);
>  }
>  
> -static void test_acl_helper_success(Fixture *fixture, gconstpointer
> user_data)
> +static void test_acl_helper_success(Fixture *fixture, gconstpointer
> user_data G_GNUC_UNUSED)
>  {
>      spice_usb_acl_helper_open_acl_async(fixture->acl_helper, 1, 1,
>                                          fixture->cancellable,
> success_cb, fixture);
> @@ -88,7 +88,7 @@ static void spawn_fail_cb(GObject *source,
> GAsyncResult *result, gpointer user_d
>      g_main_loop_quit(f->loop);
>  }
>  
> -static void test_acl_helper_spawn_fail(Fixture *fixture,
> gconstpointer user_data)
> +static void test_acl_helper_spawn_fail(Fixture *fixture,
> gconstpointer user_data G_GNUC_UNUSED)
>  {
>      g_setenv("SPICE_USB_ACL_BINARY", "does-not-exist", TRUE);
>      spice_usb_acl_helper_open_acl_async(fixture->acl_helper, 1, 1,
> @@ -110,7 +110,7 @@ static void early_eof_cb(GObject *source,
> GAsyncResult *result, gpointer user_da
>  }
>  
>  /* helper sends EOF before sending a response */
> -static void test_acl_helper_early_eof(Fixture *fixture,
> gconstpointer user_data)
> +static void test_acl_helper_early_eof(Fixture *fixture,
> gconstpointer user_data G_GNUC_UNUSED)
>  {
>      g_setenv("TEST_EOF", "1", TRUE);
>      spice_usb_acl_helper_open_acl_async(fixture->acl_helper, 1, 1,
> @@ -131,7 +131,7 @@ static void helper_canceled_cb(GObject *source,
> GAsyncResult *result, gpointer u
>      g_main_loop_quit(f->loop);
>  }
>  
> -static void test_acl_helper_helper_canceled(Fixture *fixture,
> gconstpointer user_data)
> +static void test_acl_helper_helper_canceled(Fixture *fixture,
> gconstpointer user_data G_GNUC_UNUSED)
>  {
>      g_setenv("TEST_RESPONSE", "CANCELED", TRUE);
>      spice_usb_acl_helper_open_acl_async(fixture->acl_helper, 1, 1,
> @@ -152,7 +152,7 @@ static void helper_error_response_cb(GObject
> *source, GAsyncResult *result, gpoi
>      g_main_loop_quit(f->loop);
>  }
>  
> -static void test_acl_helper_error_response(Fixture *fixture,
> gconstpointer user_data)
> +static void test_acl_helper_error_response(Fixture *fixture,
> gconstpointer user_data G_GNUC_UNUSED)
>  {
>      g_setenv("TEST_RESPONSE", "Not authorized", TRUE);
>      spice_usb_acl_helper_open_acl_async(fixture->acl_helper, 1, 1,
> @@ -173,7 +173,7 @@ static void client_canceled_cb(GObject *source,
> GAsyncResult *result, gpointer u
>      g_main_loop_quit(f->loop);
>  }
>  
> -static void test_acl_helper_client_canceled(Fixture *fixture,
> gconstpointer user_data)
> +static void test_acl_helper_client_canceled(Fixture *fixture,
> gconstpointer user_data G_GNUC_UNUSED)
>  {
>      /* ensure that the acl-helper does not have respond, so we can
> cancel the
>       * task before we get a response from the helper binary */
> @@ -185,7 +185,7 @@ static void
> test_acl_helper_client_canceled(Fixture *fixture, gconstpointer user
>      g_unsetenv("TEST_NORESPONSE");
>  }
>  
> -static void test_acl_helper_no_response(Fixture *fixture,
> gconstpointer user_data)
> +static void test_acl_helper_no_response(Fixture *fixture,
> gconstpointer user_data G_GNUC_UNUSED)
>  {
>      /* ensure that the acl-helper does not have respond, so we can
> cancel the
>       * task before we get a response from the helper binary */
> 
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]