[Spice-devel] [spice-gtk v1 1/2] tests: fix some compiler warnings
Victor Toso
lists at victortoso.com
Mon Oct 3 13:15:51 UTC 2016
Hi,
On Mon, Oct 03, 2016 at 09:29:34AM +0200, Pavel Grunt wrote:
> Hi,
>
> I get few more under tests directory, mostly -Wunused-parameter:
> https://paste.fedoraproject.org/442506/
Right! I build with -Wall by default but to catch those it is necessary
to include -Wextra as well! I'll send a fixup patch.
Cheers,
toso
>
> On Fri, 2016-09-30 at 17:11 +0200, victortoso at redhat.com wrote:
> > From: Victor Toso <me at victortoso.com>
> >
> > file-transfer.c: In function
> > ‘transfer_on_init_async_cb_agent_cancel’:
> > file-transfer.c:316:19: warning: unused variable ‘cancellable’ [-
> > Wunused-variable]
> > GCancellable *cancellable;
> > ^~~~~~~~~~~
> > pipe.c: In function ‘test_pipe_readblock’:
> > pipe.c:91:12: warning: variable ‘size’ set but not used [-Wunused-
> > but-set-variable]
> > gssize size;
> > ^~~~
> > pipe.c: In function ‘test_pipe_writeblock’:
> > pipe.c:105:12: warning: variable ‘size’ set but not used [-Wunused-
> > but-set-variable]
> > gssize size;
> > ^~~~
> > pipe.c: In function ‘readclose_cb’:
> > pipe.c:205:12: warning: variable ‘nbytes’ set but not used [-
> > Wunused-but-set-variable]
> > gssize nbytes;
> > ^~~~~~
> > pipe.c: In function ‘readcancel_cb’:
> > pipe.c:244:12: warning: variable ‘nbytes’ set but not used [-
> > Wunused-but-set-variable]
> > gssize nbytes;
> > ^~~~~~
> > pipe.c: In function ‘test_pipe_zombie_sources’:
> > pipe.c:457:10: warning: unused variable ‘i’ [-Wunused-variable]
> > gint i;
> > ^
> > mock-acl-helper.c:26:13: warning: ‘path’ defined but not used [-
> > Wunused-variable]
> > static char path[PATH_MAX];
> > ^~~~
> > mock-acl-helper.c:25:20: warning: ‘devnum’ defined but not used [-
> > Wunused-variable]
> > static int busnum, devnum;
> > ^~~~~~
> > mock-acl-helper.c:25:12: warning: ‘busnum’ defined but not used [-
> > Wunused-variable]
> > static int busnum, devnum;
> > ^~~~~~
> > ---
> > tests/file-transfer.c | 1 -
> > tests/mock-acl-helper.c | 2 --
> > tests/pipe.c | 5 ++++-
> > 3 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/tests/file-transfer.c b/tests/file-transfer.c
> > index a27b9cf..13bd352 100644
> > --- a/tests/file-transfer.c
> > +++ b/tests/file-transfer.c
> > @@ -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);
> > diff --git a/tests/mock-acl-helper.c b/tests/mock-acl-helper.c
> > index 782ebaf..58d2211 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;
> >
> > diff --git a/tests/pipe.c b/tests/pipe.c
> > index 01629da..a8c45f5 100644
> > --- a/tests/pipe.c
> > +++ b/tests/pipe.c
> > @@ -93,6 +93,7 @@ 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);
> > @@ -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);
> > @@ -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);
> >
> > @@ -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);
> >
> > @@ -454,7 +458,6 @@ read_chunk_cb_and_do_zombie(GObject *source,
> > GAsyncResult *result, gpointer user
> > static void
> > test_pipe_zombie_sources(Fixture *f, gconstpointer user_data)
> > {
> > - gint i;
> > f->data_len = 64;
> > f->data = get_test_data(f->data_len);
> > f->read_size = 16;
> >
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20161003/6603af1b/attachment-0001.sig>
More information about the Spice-devel
mailing list