qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] qjson.h: Remove GCC_FMT_ATTR markup from qobjec


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] qjson.h: Remove GCC_FMT_ATTR markup from qobject_from_jsonv() declaration
Date: Wed, 05 Mar 2014 23:47:23 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]