From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 08/18] qdict qlist: Make most helper macros functions
Date: Tue, 30 Jan 2018 11:02:24 -0600 [thread overview]
Message-ID: <6bffa91e-e573-3777-c7a9-86b72d548247@redhat.com> (raw)
In-Reply-To: <20180130102202.28519-9-armbru@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1769 bytes --]
On 01/30/2018 04:21 AM, Markus Armbruster wrote:
> The macro expansions of qdict_put_TYPE() and qlist_append_TYPE() need
> qbool.h, qnull.h, qnum.h and qstring.h to compile. We include qnull.h
> and qnum.h in the headers, but not qbool.h and qstring.h. Works,
> because we include those wherever the macros get used.
>
> Open-coding these helpers is of dubious value. Turn them into
> functions and drop the includes from the headers.
>
> This cleanup makes the number of objects depending on qapi/qmp/qnum.h
> from 4548 (out of 4739) to 46 in my "build everything" tree. For
> qapi/qmp/qnull.h, the number drops from 4549 to 21.
Impressive!
> +++ b/qobject/qdict.c
> @@ -14,6 +14,7 @@
> #include "qapi/qmp/qnum.h"
> #include "qapi/qmp/qdict.h"
> #include "qapi/qmp/qbool.h"
> +#include "qapi/qmp/qnull.h"
> #include "qapi/qmp/qstring.h"
> #include "qapi/qmp/qobject.h"
> #include "qapi/error.h"
> @@ -143,6 +144,26 @@ void qdict_put_obj(QDict *qdict, const char *key, QObject *value)
> }
> }
>
> +void qdict_put_int(QDict *qdict, const char *key, int64_t value)
> +{
> + qdict_put(qdict, key, qnum_from_int(value));
> +}
If I'm not mistaken (although I didn't actually test), this triggers a
false positive in scripts/coccinelle/qobject.cocci, no? Is there a
convenient way to tell coccinelle that a rewrite pattern applies
everywhere except for where the pattern itself is implemented? But even
if not, we can always use manual inspection when rerunning Coccinelle to
make sure we don't turn these into infinite loops.
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]
next prev parent reply other threads:[~2018-01-30 17:03 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-30 10:21 [Qemu-devel] [PATCH 00/18] Clean up includes to reduce compile time Markus Armbruster
2018-01-30 10:21 ` [Qemu-devel] [PATCH 01/18] Clean up includes Markus Armbruster
2018-01-30 13:22 ` BALATON Zoltan
2018-01-31 7:48 ` Markus Armbruster
2018-01-30 15:23 ` Eric Blake
2018-01-30 10:21 ` [Qemu-devel] [PATCH 02/18] Drop superfluous includes of qapi-types.h Markus Armbruster
2018-01-30 15:46 ` Eric Blake
2018-01-31 7:49 ` Markus Armbruster
2018-01-30 10:21 ` [Qemu-devel] [PATCH 03/18] Include qapi/error.h exactly where needed Markus Armbruster
2018-01-30 16:14 ` Eric Blake
2018-01-31 7:58 ` Markus Armbruster
2018-01-30 10:21 ` [Qemu-devel] [PATCH 04/18] Drop superfluous includes of qapi/qmp/qerror.h Markus Armbruster
2018-01-30 16:20 ` Eric Blake
2018-01-30 10:21 ` [Qemu-devel] [PATCH 05/18] Include qmp-commands.h exactly where needed Markus Armbruster
2018-01-30 16:43 ` Eric Blake
2018-01-30 10:21 ` [Qemu-devel] [PATCH 06/18] Typedef the subtypes of QObject in qemu/typedefs.h, too Markus Armbruster
2018-01-30 16:50 ` Eric Blake
2018-01-30 10:21 ` [Qemu-devel] [PATCH 07/18] Eliminate qapi/qmp/types.h Markus Armbruster
2018-01-30 16:56 ` Eric Blake
2018-01-30 10:21 ` [Qemu-devel] [PATCH 08/18] qdict qlist: Make most helper macros functions Markus Armbruster
2018-01-30 17:02 ` Eric Blake [this message]
2018-01-31 8:11 ` Markus Armbruster
2018-01-30 10:21 ` [Qemu-devel] [PATCH 09/18] Include qapi/qmp/qobject.h exactly where needed Markus Armbruster
2018-01-30 17:03 ` Eric Blake
2018-01-30 10:21 ` [Qemu-devel] [PATCH 10/18] Include qapi/qmp/qlist.h " Markus Armbruster
2018-01-30 17:47 ` Eric Blake
2018-01-30 10:21 ` [Qemu-devel] [PATCH 11/18] Include qapi/qmp/qdict.h " Markus Armbruster
2018-01-30 17:51 ` Eric Blake
2018-01-30 10:21 ` [Qemu-devel] [PATCH 12/18] Include qapi/qmp/qstring.h " Markus Armbruster
2018-01-30 17:55 ` Eric Blake
2018-01-30 10:21 ` [Qemu-devel] [PATCH 13/18] Include qapi/qmp/qbool.h " Markus Armbruster
2018-01-30 17:57 ` Eric Blake
2018-01-30 10:21 ` [Qemu-devel] [PATCH 14/18] Include qapi/qmp/qnum.h " Markus Armbruster
2018-01-30 17:58 ` Eric Blake
2018-01-30 10:21 ` [Qemu-devel] [PATCH 15/18] Include qapi/qmp/qnull.h " Markus Armbruster
2018-01-30 17:59 ` Eric Blake
2018-01-30 10:22 ` [Qemu-devel] [PATCH 16/18] Drop superfluous includes of qapi/qmp/dispatch.h Markus Armbruster
2018-01-30 18:00 ` Eric Blake
2018-01-30 10:22 ` [Qemu-devel] [PATCH 17/18] Drop superfluous includes of qapi/qmp/qjson.h Markus Armbruster
2018-01-30 18:01 ` Eric Blake
2018-01-30 10:22 ` [Qemu-devel] [PATCH 18/18] Move include qemu/option.h from qemu-common.h to actual users Markus Armbruster
2018-01-30 18:08 ` Eric Blake
2018-01-31 8:14 ` Markus Armbruster
2018-01-30 13:39 ` [Qemu-devel] [PATCH 00/18] Clean up includes to reduce compile time no-reply
2018-01-30 18:36 ` Philippe Mathieu-Daudé
2018-01-31 8:31 ` Markus Armbruster
2018-01-31 0:12 ` no-reply
2018-01-31 7:10 ` Thomas Huth
2018-01-31 14:00 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6bffa91e-e573-3777-c7a9-86b72d548247@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).