* [Qemu-devel] [PATCH] libcacard: Fix compilation for older versions of glib (bug #1258168)
@ 2013-12-05 17:24 Stefan Weil
2013-12-05 17:27 ` Stefan Weil
2013-12-05 18:03 ` Don Slutz
0 siblings, 2 replies; 4+ messages in thread
From: Stefan Weil @ 2013-12-05 17:24 UTC (permalink / raw)
To: Anthony Liguori
Cc: Stefan Weil, qemu-devel, Don Slutz, Marc-André Lureau,
Laurent Desnogues, Alon Levy
See https://bugs.launchpad.net/bugs/1258168
libcacard/vscclient.c: In function 'do_socket_read':
libcacard/vscclient.c:410: warning: implicit declaration of function 'g_warn_if_reached'
libcacard/vscclient.c:410: warning: nested extern declaration of 'g_warn_if_reached'
libcacard/vscclient.c: In function 'main':
libcacard/vscclient.c:763: warning: implicit declaration of function 'g_byte_array_unref'
libcacard/vscclient.c:763: warning: nested extern declaration of 'g_byte_array_unref'
...
libcacard/vscclient.o: In function `do_socket_read':
libcacard/vscclient.c:410: undefined reference to `g_warn_if_reached'
libcacard/vscclient.o: In function `main':
libcacard/vscclient.c:763: undefined reference to `g_byte_array_unref'
g_warn_if_reached was added in glib 2.16, and g_byte_array_unref is
supported since glib 2.22. QEMU requires glib 2.16, so both names must
not be used.
Instead of showing a warning for code which should not be reached, QEMU
better stops running, so g_warn_if_reached is not useful for QEMU.
In libcacard/vsclient.c, g_byte_array_unref can be replaced by
g_byte_array_free. This is not generally true, so adding a compatibility
layer in include/glib-compat.h is no option here.
Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Reported-by: Don Slutz <dslutz@verizon.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
libcacard/vscclient.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libcacard/vscclient.c b/libcacard/vscclient.c
index a3cb776..138b9e5 100644
--- a/libcacard/vscclient.c
+++ b/libcacard/vscclient.c
@@ -407,7 +407,7 @@ do_socket_read(GIOChannel *source,
}
break;
default:
- g_warn_if_reached();
+ g_assert_not_reached();
return FALSE;
}
@@ -760,7 +760,7 @@ main(
g_io_channel_unref(channel_stdin);
g_io_channel_unref(channel_socket);
- g_byte_array_unref(socket_to_send);
+ g_byte_array_free(socket_to_send);
closesocket(sock);
return 0;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] libcacard: Fix compilation for older versions of glib (bug #1258168)
2013-12-05 17:24 [Qemu-devel] [PATCH] libcacard: Fix compilation for older versions of glib (bug #1258168) Stefan Weil
@ 2013-12-05 17:27 ` Stefan Weil
2013-12-05 18:03 ` Don Slutz
1 sibling, 0 replies; 4+ messages in thread
From: Stefan Weil @ 2013-12-05 17:27 UTC (permalink / raw)
To: Anthony Liguori
Cc: Stefan Weil, qemu-devel, Don Slutz, Marc-André Lureau,
Laurent Desnogues, Alon Levy
Am 05.12.2013 18:24, schrieb Stefan Weil:
> See https://bugs.launchpad.net/bugs/1258168
>
> libcacard/vscclient.c: In function 'do_socket_read':
> libcacard/vscclient.c:410: warning: implicit declaration of function 'g_warn_if_reached'
> libcacard/vscclient.c:410: warning: nested extern declaration of 'g_warn_if_reached'
> libcacard/vscclient.c: In function 'main':
> libcacard/vscclient.c:763: warning: implicit declaration of function 'g_byte_array_unref'
> libcacard/vscclient.c:763: warning: nested extern declaration of 'g_byte_array_unref'
> ...
> libcacard/vscclient.o: In function `do_socket_read':
> libcacard/vscclient.c:410: undefined reference to `g_warn_if_reached'
> libcacard/vscclient.o: In function `main':
> libcacard/vscclient.c:763: undefined reference to `g_byte_array_unref'
>
> g_warn_if_reached was added in glib 2.16, and g_byte_array_unref is
> supported since glib 2.22. QEMU requires glib 2.16, so both names must
Please fix before committing: QEMU requires glib 2.12, ...
Thank you,
Stefan
> not be used.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] libcacard: Fix compilation for older versions of glib (bug #1258168)
2013-12-05 17:24 [Qemu-devel] [PATCH] libcacard: Fix compilation for older versions of glib (bug #1258168) Stefan Weil
2013-12-05 17:27 ` Stefan Weil
@ 2013-12-05 18:03 ` Don Slutz
2013-12-05 18:45 ` Stefan Weil
1 sibling, 1 reply; 4+ messages in thread
From: Don Slutz @ 2013-12-05 18:03 UTC (permalink / raw)
To: Stefan Weil, Anthony Liguori
Cc: Laurent Desnogues, Marc-André Lureau, Alon Levy, qemu-devel,
Don Slutz
On 12/05/13 12:24, Stefan Weil wrote:
> See https://bugs.launchpad.net/bugs/1258168
>
> libcacard/vscclient.c: In function 'do_socket_read':
> libcacard/vscclient.c:410: warning: implicit declaration of function 'g_warn_if_reached'
> libcacard/vscclient.c:410: warning: nested extern declaration of 'g_warn_if_reached'
> libcacard/vscclient.c: In function 'main':
> libcacard/vscclient.c:763: warning: implicit declaration of function 'g_byte_array_unref'
> libcacard/vscclient.c:763: warning: nested extern declaration of 'g_byte_array_unref'
> ...
> libcacard/vscclient.o: In function `do_socket_read':
> libcacard/vscclient.c:410: undefined reference to `g_warn_if_reached'
> libcacard/vscclient.o: In function `main':
> libcacard/vscclient.c:763: undefined reference to `g_byte_array_unref'
>
> g_warn_if_reached was added in glib 2.16, and g_byte_array_unref is
> supported since glib 2.22. QEMU requires glib 2.16, so both names must
> not be used.
>
> Instead of showing a warning for code which should not be reached, QEMU
> better stops running, so g_warn_if_reached is not useful for QEMU.
>
> In libcacard/vsclient.c, g_byte_array_unref can be replaced by
> g_byte_array_free. This is not generally true, so adding a compatibility
> layer in include/glib-compat.h is no option here.
>
> Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
> Reported-by: Don Slutz <dslutz@verizon.com>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
> libcacard/vscclient.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libcacard/vscclient.c b/libcacard/vscclient.c
> index a3cb776..138b9e5 100644
> --- a/libcacard/vscclient.c
> +++ b/libcacard/vscclient.c
> @@ -407,7 +407,7 @@ do_socket_read(GIOChannel *source,
> }
> break;
> default:
> - g_warn_if_reached();
> + g_assert_not_reached();
> return FALSE;
> }
>
> @@ -760,7 +760,7 @@ main(
>
> g_io_channel_unref(channel_stdin);
> g_io_channel_unref(channel_socket);
> - g_byte_array_unref(socket_to_send);
> + g_byte_array_free(socket_to_send);
>
This fails with:
/home/don/qemu/libcacard/vscclient.c: In function 'main':
/home/don/qemu/libcacard/vscclient.c:763: error: too few arguments to function 'g_byte_array_free'
make: *** [libcacard/vscclient.o] Error 1
The bug included ", TRUE"...
-Don Slutz
> closesocket(sock);
> return 0;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] libcacard: Fix compilation for older versions of glib (bug #1258168)
2013-12-05 18:03 ` Don Slutz
@ 2013-12-05 18:45 ` Stefan Weil
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Weil @ 2013-12-05 18:45 UTC (permalink / raw)
To: Don Slutz, Anthony Liguori
Cc: Laurent Desnogues, Marc-André Lureau, Alon Levy, qemu-devel
Am 05.12.2013 19:03, schrieb Don Slutz:
> On 12/05/13 12:24, Stefan Weil wrote:
[...]
>> @@ -760,7 +760,7 @@ main(
>> g_io_channel_unref(channel_stdin);
>> g_io_channel_unref(channel_socket);
>> - g_byte_array_unref(socket_to_send);
>> + g_byte_array_free(socket_to_send);
>>
> This fails with:
>
> /home/don/qemu/libcacard/vscclient.c: In function 'main':
> /home/don/qemu/libcacard/vscclient.c:763: error: too few arguments to
> function 'g_byte_array_free'
> make: *** [libcacard/vscclient.o] Error 1
>
> The bug included ", TRUE"...
> -Don Slutz
>> closesocket(sock);
>> return 0;
>
Sorry, I should have waited until the compile test was finished before
sending this patch.
v2 with fixed commit message and fixed call of g_byte_array was sent a
minute ago.
Stefan Weil
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-12-05 18:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-05 17:24 [Qemu-devel] [PATCH] libcacard: Fix compilation for older versions of glib (bug #1258168) Stefan Weil
2013-12-05 17:27 ` Stefan Weil
2013-12-05 18:03 ` Don Slutz
2013-12-05 18:45 ` Stefan Weil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).