This website requires JavaScript.
Explore
Help
Sign In
mirrors
/
qemu
Watch
1
Star
0
Fork
0
You've already forked qemu
Code
Issues
Pull Requests
Packages
Projects
Releases
Wiki
Activity
26b3256392
qemu
/
tests
/
qapi-schema
/
enum-bad-name.json
3 lines
89 B
JSON
Raw
Normal View
History
Unescape
Escape
qapi: Require valid names 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 <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-05-04 18:05:22 +03:00
#
w
e
e
n
s
u
r
e
a
l
l
e
n
u
m
n
a
m
e
s
c
a
n
m
a
p
t
o
C
qapi: Add some enum tests Demonstrate that the qapi generator doesn't deal well with enums that aren't up to par. Later patches will update the expected results as the generator is made stricter. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-05-04 18:05:03 +03:00
{
'
e
n
u
m
'
:
'
M
y
E
n
u
m
'
,
'
d
a
t
a
'
:
[
'
n
o
t
^
p
o
s
s
i
b
l
e
'
]
}
Reference in New Issue
Copy Permalink