From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: kwolf@redhat.com, akong@redhat.com, berto@igalia.com,
qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH v2 3/4] qapi: Correctly handle downstream extensions in more locations
Date: Wed, 29 Apr 2015 09:30:10 -0600 [thread overview]
Message-ID: <5540F902.3090200@redhat.com> (raw)
In-Reply-To: <87y4lb6uls.fsf@blackfin.pond.sub.org>
[-- Attachment #1: Type: text/plain, Size: 3200 bytes --]
On 04/29/2015 05:29 AM, Markus Armbruster wrote:
> Eric Blake <eblake@redhat.com> writes:
>
>> Now that c_var() handles '.' in downstream extension names, fix
>> the generator to support such names as additional types, enums,
>> members within an enum, branches of a union or alternate, and
>> in arrays.
>>
>> - qtype = qtype,
>> - abbrev = de_camel_case(name).upper(),
>> - enum = c_var(de_camel_case(key),False).upper())
>> + qtype = qtype,
>> + value = generate_enum_full_value("%sKind" %c_var(name),
>> + key))
>>
>> ret += mcgen('''
>> };
>
> I fixed this one in my "[PATCH RFC 06/19] qapi: Use c_enum_const() in
> generate_alternate_qtypes()".
>
> You picked just my "[PATCH RFC 02/19] qapi: Fix C identifiers generated
> for names containing '.'" into your series. Would you mind picking all
> the related patches, i.e PATCH 02-07?
>
> qapi: Fix C identifiers generated for names containing '.'
> qapi: Rename _generate_enum_string() to camel_to_upper()
> qapi: Rename generate_enum_full_value() to c_enum_const()
> qapi: Simplify c_enum_const()
> qapi: Use c_enum_const() in generate_alternate_qtypes()
> qapi: Move camel_to_upper(), c_enum_const() to closely related code
Sure, I can pull in more of your patches in my v3.
>> +++ b/scripts/qapi-visit.py
>> @@ -44,12 +44,13 @@ static void visit_type_implicit_%(c_type)s(Visitor *m, %(c_type)s **obj, Error *
>> c_type=type_name(type))
>>
>> def generate_visit_struct_fields(name, field_prefix, fn_prefix, members, base = None):
>> + assert field_prefix == ""
>
> Makes me wonder why we have a field_prefix parameter.
>
> fn_prefix is also always ""...
Hmm - looks like I was debugging whether the code was dead (by whether I
could trigger the assertion) and forgot to clean it up. I'll split that
into a separate patch (I've already done another related cleanup that I
found while reviewing this code, in commit 6540e9f).
>> -def generate_visit_list(name, members):
>> +def generate_visit_list(name, members, builtin=False):
>> + if not builtin:
>> + name = c_var(name)
>
> Fun.
>
> c_var() does two things:
>
> (a) it protects certain words if protect=True
>
> (b) it maps funny characters to '_'.
>
> When builtin, (a) is unwanted, and (b) does nothing. That's why we need
> the conditional.
>
> A possible alternative could be c_var(name, not builtin). Matter of
> taste.
>
> Hmm, just saw what type_name() does. Why not just
>
> name = type_name(name)
>
> ?
Probably because I was just hacking until tests passed, rather than
trying to go for optimal code (after all, that's what the review process
is for, to find better ways to do things). Sounds like a good cleanup
for v3.
> If it was my patch, I'd be tempted to split it up some. Matter of
> taste, feel free to keep it a single patch.
I'll try and split it some for the next round.
--
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 --]
next prev parent reply other threads:[~2015-04-29 15:30 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-11 18:09 [Qemu-devel] [PATCH v2 0/4] Fix C identifiers generated for names containing '.' Eric Blake
2015-04-11 18:09 ` [Qemu-devel] [PATCH v2 1/4] qapi: " Eric Blake
2015-04-15 8:01 ` Alberto Garcia
2015-04-11 18:09 ` [Qemu-devel] [PATCH v2 2/4] qapi: Drop duplicate c_fun() in favor of c_var() Eric Blake
2015-04-15 8:03 ` Alberto Garcia
2015-04-29 11:04 ` Markus Armbruster
2015-05-01 17:00 ` Eric Blake
2015-04-11 18:09 ` [Qemu-devel] [PATCH v2 3/4] qapi: Correctly handle downstream extensions in more locations Eric Blake
2015-04-29 11:29 ` Markus Armbruster
2015-04-29 15:30 ` Eric Blake [this message]
2015-04-30 22:30 ` Eric Blake
2015-05-05 12:33 ` Eric Blake
2015-04-11 18:09 ` [Qemu-devel] [PATCH v2 4/4] qapi: Test name mangling of downstream extensions Eric Blake
2015-04-29 11:32 ` Markus Armbruster
2015-04-29 15:45 ` Eric Blake
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=5540F902.3090200@redhat.com \
--to=eblake@redhat.com \
--cc=akong@redhat.com \
--cc=armbru@redhat.com \
--cc=berto@igalia.com \
--cc=kwolf@redhat.com \
--cc=mdroth@linux.vnet.ibm.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).