unicorn/qemu/scripts
Eric Blake bacaf613b1
qapi: Fix c_name() munging
The method c_name() is supposed to do two different actions: munge
'-' into '_', and add a 'q_' prefix to ticklish names. But it did
these steps out of order, making it possible to submit input that
is not ticklish until after munging, where the output then lacked
the desired prefix.

The failure is exposed easily if you have a compiler that recognizes
C11 keywords, and try to name a member '_Thread-local', as it would
result in trying to compile the declaration 'uint64_t _Thread_local;'
which is not valid. However, this name violates our conventions
(ultimately, want to enforce that no qapi names start with single
underscore), so the test is slightly weaker by instead testing
'wchar-t'; the declaration 'uint64_t wchar_t;' is valid in C (where
wchar_t is only a typedef) but would fail with a C++ compiler (where
it is a keyword).

Fix things by reversing the order of actions within c_name().

Backports commit c43567c12042cf401b039bfc94a5f85e1cc1e796 from qemu
2018-02-19 20:31:08 -05:00
..
create_config more cleanup qemu/configure 2017-01-19 14:11:54 +08:00
make_device_config.sh fix file perms 2015-08-28 21:05:38 -07:00
ordereddict.py import 2015-08-21 15:04:50 +08:00
qapi-event.py qapi: Share gen_visit_fields() 2018-02-19 18:41:41 -05:00
qapi-types.py qapi-types: Simplify gen_struct_field[s] 2018-02-19 20:06:38 -05:00
qapi-visit.py qapi: Track simple union tag in object.local_members 2018-02-19 20:02:03 -05:00
qapi.py qapi: Fix c_name() munging 2018-02-19 20:31:08 -05:00