From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44332) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VodIQ-0000wF-Sa for qemu-devel@nongnu.org; Thu, 05 Dec 2013 13:05:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VodIK-0008Dx-Ci for qemu-devel@nongnu.org; Thu, 05 Dec 2013 13:05:06 -0500 Received: from fldsmtpe02.verizon.com ([140.108.26.141]:51084) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VodIK-0008Dd-8v for qemu-devel@nongnu.org; Thu, 05 Dec 2013 13:05:00 -0500 From: Don Slutz Message-ID: <52A0BFFC.3030808@terremark.com> Date: Thu, 5 Dec 2013 13:03:40 -0500 MIME-Version: 1.0 References: <1386264247-25867-1-git-send-email-sw@weilnetz.de> In-Reply-To: <1386264247-25867-1-git-send-email-sw@weilnetz.de> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] libcacard: Fix compilation for older versions of glib (bug #1258168) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil , Anthony Liguori Cc: Laurent Desnogues , =?ISO-8859-1?Q?Marc-Andr=E9_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 > Reported-by: Don Slutz > Signed-off-by: Stefan Weil > --- > 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;