[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v7 25/39] qapi: Require valid names

From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v7 25/39] qapi: Require valid names
Date: Sat, 02 May 2015 14:51:28 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

On 04/29/2015 07:06 AM, Eric Blake wrote:
> Previous commits demonstrated that the generator overlooked various
> bad naming situations:
> - types, commands, and events need a valid name
> - enum members must be valid names, when combined with prefix
> - union and alternate branches cannot be marked optional

> regex, this patch just uses a broader combination that allows both
> upstream and downstream names, as well as a small hack that
> realizes that any enum name is merely a suffix to an already valid
> name prefix (that is, any enum name is valid if prepending _ fits
> the normal rules).

> +    # Enum members can start with a digit, because the generated C
> +    # code always prefixes it with the enum name
> +    if enum_member:
> +        membername = "_%s" %membername
> +    if not valid_name.match(membername):
> +        raise QAPIExprError(expr_info,

Python question: Would it be any simpler to write:

membername = '_' + membername

and if so, do I need to squash anything in?

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]