[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v8 25/40] qapi: Require valid names
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v8 25/40] qapi: Require valid names |
Date: |
Mon, 04 May 2015 19:43:41 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Eric Blake <address@hidden> writes:
> 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
>
> Valid upstream names match [a-zA-Z][a-zA-Z0-9_-]*; valid downstream
> names match __[a-zA-Z][a-zA-Z0-9._-]*. Enumerations match the
> weaker [a-zA-Z0-9._-]+ (in part thanks to QKeyCode picking an enum
> that starts with a digit, which we can't change now due to
> backwards compatibility). Rather than call out three separate
> 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).
>
> We could reject new enumeration names beginning with a digit by
> whitelisting existing exceptions. We could also be stricter
> about the distinction between upstream names (no leading
> underscore, no use of dot) and downstream (mandatory leading
> double underscore), but it is probably not worth the bother.
>
> Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
- [Qemu-devel] [PATCH v8 18/40] qapi: Better error messages for bad expressions, (continued)
- [Qemu-devel] [PATCH v8 18/40] qapi: Better error messages for bad expressions, Eric Blake, 2015/05/04
- [Qemu-devel] [PATCH v8 11/40] qapi: Tighten checking of unions, Eric Blake, 2015/05/04
- [Qemu-devel] [PATCH v8 22/40] qapi: Unify type bypass and add tests, Eric Blake, 2015/05/04
- [Qemu-devel] [PATCH v8 31/40] qapi: Forbid 'type' in schema, Eric Blake, 2015/05/04
- [Qemu-devel] [PATCH v8 27/40] qapi: More rigorous checking for type safety bypass, Eric Blake, 2015/05/04
- [Qemu-devel] [PATCH v8 29/40] qapi: Document 'struct' metatype, Eric Blake, 2015/05/04
- [Qemu-devel] [PATCH v8 21/40] qapi: Allow true, false and null in schema json, Eric Blake, 2015/05/04
- [Qemu-devel] [PATCH v8 23/40] qapi: Add some type check tests, Eric Blake, 2015/05/04
- [Qemu-devel] [PATCH v8 25/40] qapi: Require valid names, Eric Blake, 2015/05/04
- Re: [Qemu-devel] [PATCH v8 25/40] qapi: Require valid names,
Markus Armbruster <=
- [Qemu-devel] [PATCH v8 26/40] qapi: Whitelist commands that don't return dictionary, Eric Blake, 2015/05/04
- [Qemu-devel] [PATCH v8 28/40] qapi: Prefer 'struct' over 'type' in generator, Eric Blake, 2015/05/04
- [Qemu-devel] [PATCH v8 36/40] qapi: Drop support for inline nested types, Eric Blake, 2015/05/04
- [Qemu-devel] [PATCH v8 34/40] qapi: Drop inline nested struct in query-version, Eric Blake, 2015/05/04
- [Qemu-devel] [PATCH v8 32/40] qapi: Merge UserDefTwo and UserDefNested in tests, Eric Blake, 2015/05/04
- [Qemu-devel] [PATCH v8 24/40] qapi: More rigourous checking of types, Eric Blake, 2015/05/04
- [Qemu-devel] [PATCH v8 37/40] qapi: Drop dead visitor code related to nested structs, Eric Blake, 2015/05/04
- [Qemu-devel] [PATCH v8 35/40] qapi: Drop inline nested structs in query-pci, Eric Blake, 2015/05/04