[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v9 15/37] qom: Swap 'name' next to visitor in Ob
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v9 15/37] qom: Swap 'name' next to visitor in ObjectPropertyAccessor |
Date: |
Wed, 20 Jan 2016 19:49:31 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Eric Blake <address@hidden> writes:
> Similar to the previous patch, it's nice to have all functions
> in the tree that involve a visitor and a name for conversion to
> or from QAPI to consistently stick the 'name' parameter next
> to the Visitor parameter.
>
> Done by manually changing include/qom/object.h and qom/object.c,
> then running this Coccinelle script and touching up the fallout
> (Coccinelle insisted on adding some trailing whitespace).
>
> @ rule1 @
> identifier fn;
> type Object, Visitor, Error;
> identifier obj, v, opaque, name, errp;
> @@
> void fn
> - (Object *obj, Visitor *v, void *opaque, const char *name,
> + (Object *obj, Visitor *v, const char *name, void *opaque,
> Error **errp) { ... }
I think we want to match void functions with exactly these parameter
types. The parameter names don't matter.
However, the actual match is looser! For instance, it also matches
void foo(int *pi, unsigned *pu, void *vp, const char *cp, double **dpp)
{
}
This could mess up unrelated function. I could double-check it doesn't,
but I'd rather have a narrower match instead. Can't give one offhand,
though. Ideas?
>
> @@
> identifier rule1.fn;
> expression obj, v, opaque, name, errp;
> @@
> fn(obj, v,
> - opaque, name,
> + name, opaque,
> errp)
The rule1.fn restricts the match to functions changed by the previous
rule. Good.
>
> Signed-off-by: Eric Blake <address@hidden>
> Reviewed-by: Marc-André Lureau <address@hidden>
- Re: [Qemu-devel] [PATCH v9 33/37] qapi: Split visit_end_struct() into pieces, (continued)
[Qemu-devel] [PATCH v9 14/37] qapi: Swap visit_* arguments for consistent 'name' placement, Eric Blake, 2016/01/19
Re: [Qemu-devel] [PATCH v9 00/37] qapi visitor cleanups (post-introspection cleanups subset E), Markus Armbruster, 2016/01/28