From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLKbE-0002qV-9e for qemu-devel@nongnu.org; Wed, 05 Mar 2014 17:47:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLKb4-0006Nd-9W for qemu-devel@nongnu.org; Wed, 05 Mar 2014 17:47:40 -0500 Received: from mail-ea0-x231.google.com ([2a00:1450:4013:c01::231]:49089) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLKb4-0006NV-2C for qemu-devel@nongnu.org; Wed, 05 Mar 2014 17:47:30 -0500 Received: by mail-ea0-f177.google.com with SMTP id h10so1344651eak.36 for ; Wed, 05 Mar 2014 14:47:29 -0800 (PST) Sender: Paolo Bonzini Message-ID: <5317A97B.4070108@redhat.com> Date: Wed, 05 Mar 2014 23:47:23 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1394053327-27964-1-git-send-email-sw@weilnetz.de> <531792E8.5080901@redhat.com> In-Reply-To: <531792E8.5080901@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] qjson.h: Remove GCC_FMT_ATTR markup from qobject_from_jsonv() declaration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , Stefan Weil , qemu-devel@nongnu.org, Peter Maydell Cc: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= Il 05/03/2014 22:11, Eric Blake ha scritto: > On 03/05/2014 02:02 PM, Stefan Weil wrote: >> Commit aa830cdc28edb69c1fe81c8fd9471ab288ad0926 removed that attribute >> from qobject_from_json. Now gcc suggests to add it again when compiler >> flag -Wmissing-format-attribute is used: >> >> qobject/qjson.c: In function ‘qobject_from_json’: >> qobject/qjson.c:53:5: error: >> function might be possible candidate for ‘gnu_printf’ format attribute >> [-Werror=suggest-attribute=format] >> >> Fix this by removing the flag from qobject_from_jsonv, too. > > NAK. > > qobject_from_jsonv needs the attribute. > > Maybe this is a better approach (untested): > > diff --git i/qobject/qjson.c w/qobject/qjson.c > index 6cf2511..f9616f8 100644 > --- i/qobject/qjson.c > +++ w/qobject/qjson.c > @@ -50,7 +50,7 @@ QObject *qobject_from_jsonv(const char *string, > va_list *ap) > > QObject *qobject_from_json(const char *string) > { > - return qobject_from_jsonv(string, NULL); > + return qobject_from_jsonf("%s", string); > } > > /* > No, this returns string converted to a QString. It doesn't return the result of parsing string as JSON. If you want you can "fix" it by inlining qobject_from_jsonv into qobject_from_json. Paolo