* [Qemu-devel] [PATCH] qjson.h: Remove GCC_FMT_ATTR markup from qobject_from_jsonv() declaration
@ 2014-03-05 21:02 Stefan Weil
2014-03-05 21:11 ` Eric Blake
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Weil @ 2014-03-05 21:02 UTC (permalink / raw)
To: qemu-devel, Peter Maydell; +Cc: Stefan Weil, Andreas Färber
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.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
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(-)
diff --git a/include/qapi/qmp/qjson.h b/include/qapi/qmp/qjson.h
index ee4d31a..e122380 100644
--- a/include/qapi/qmp/qjson.h
+++ b/include/qapi/qmp/qjson.h
@@ -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);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] qjson.h: Remove GCC_FMT_ATTR markup from qobject_from_jsonv() declaration
2014-03-05 21:02 [Qemu-devel] [PATCH] qjson.h: Remove GCC_FMT_ATTR markup from qobject_from_jsonv() declaration Stefan Weil
@ 2014-03-05 21:11 ` Eric Blake
2014-03-05 22:47 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Eric Blake @ 2014-03-05 21:11 UTC (permalink / raw)
To: Stefan Weil, qemu-devel, Peter Maydell; +Cc: Andreas Färber
[-- Attachment #1: Type: text/plain, Size: 1091 bytes --]
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);
}
/*
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] qjson.h: Remove GCC_FMT_ATTR markup from qobject_from_jsonv() declaration
2014-03-05 21:11 ` Eric Blake
@ 2014-03-05 22:47 ` Paolo Bonzini
0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2014-03-05 22:47 UTC (permalink / raw)
To: Eric Blake, Stefan Weil, qemu-devel, Peter Maydell; +Cc: Andreas Färber
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-05 22:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-05 21:02 [Qemu-devel] [PATCH] qjson.h: Remove GCC_FMT_ATTR markup from qobject_from_jsonv() declaration Stefan Weil
2014-03-05 21:11 ` Eric Blake
2014-03-05 22:47 ` Paolo Bonzini
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).