qjson.h: Remove GCC_FMT_ATTR markup from qobject_from_jsonv() declaration
PATCH 1/1 qjson.h: Remove GCC_FMT_ATTR markup from qobject_from_jsonv() declaration
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.
---
Maybe the last remaining GCC_FMT_ATTR should be removed, too. Please review.
Regards,
Stefan Weil
include/qapi/qmp/qjson.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/qapi/qmp/qjson.h +1 -1
@@ -21,7 +21,7 @@QObject *qobject_from_json (const char *string);QObject *qobject_from_jsonf (const char *string, ...)GCC_FMT_ATTR (1 ,2 ); -QObject *qobject_from_jsonv (const char *string,va_list *ap)GCC_FMT_ATTR (1 ,0 ); +QObject *qobject_from_jsonv (const char *string,va_list *ap);QString *qobject_to_json (const QObject *obj);QString *qobject_to_json_pretty (const QObject *obj);
Signature · 1 line
1.7.10.4
Eric Blake
NAKQuoted 10 lines · Stefan Weil
Commit
aa830cdc28edb69c1fe81c8fd9471ab288ad0926removed that attribute fromqobject_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):
qobject/qjson.c +0 -0
@@ -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);
}
/*
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Il 05/03/2014 22:11, Eric Blake ha scritto:
Quoted 31 lines · Stefan Weil
Quoted 10 lines
Commit
aa830cdc28edb69c1fe81c8fd9471ab288ad0926removed that attribute fromqobject_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_jsonvneeds the attribute.Maybe this is a better approach (untested):
qobject/qjson.c +1
-1@@ -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); }
Quoted 2 lines
/*
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