qemu/scripts
Eric Blake 9fb081e0b9 qapi: Reserve 'q_*' and 'has_*' member names
c_name() produces names starting with 'q_' when protecting a
dictionary member name that would fail to directly compile, but
in doing so can cause clashes with any member name already
beginning with 'q-' or 'q_'.  Likewise, we create a C name 'has_'
for any optional member that can clash with any member name
beginning with 'has-' or 'has_'.

Technically, rather than blindly reserving the namespace,
we could try to complain about user names only when an actual
collision occurs, or even teach c_name() how to munge names
to avoid collisions.  But it is not trivial, especially when
collisions can occur across multiple types (such as via
inheritance or flat unions).  Besides, no existing .json
files are trying to use these names.  So it's easier to just
outright forbid the potential for collision.  We can always
relax things in the future if a real need arises for QMP to
express member names that have been forbidden here.

'has_' only has to be reserved for struct/union member names,
while 'q_' is reserved everywhere (matching the fact that
only members can be optional, while we use c_name() for munging
both members and entities).  Note that we could relax 'q_'
restrictions on entities independently from member names; for
example, c_name('qmp_' + 'unix') would result in a different
function name than our current 'qmp_' + c_name('unix').

Update and add tests to cover the new error messages.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1445898903-12082-6-git-send-email-eblake@redhat.com>
[Consistently pass protect=False to c_name(); commit message tweaked
slightly]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-11-02 08:30:26 +01:00
..
kvm
qemu-guest-agent
qemugdb gdb command: qemu handlers 2015-10-29 17:59:27 +00:00
qmp qmp-shell: add documentation 2015-09-04 13:18:04 +02:00
tracetool
acpi_extract.py
acpi_extract_preprocess.py
analyse-9p-simpletrace.py
analyze-migration.py Teach analyze-migration.py about section footers 2015-06-12 06:54:01 +02:00
check-qerror.sh
checkpatch.pl checkpatch: port fix from kernel "## is not a valid modifier" 2015-10-12 18:29:26 +02:00
cleanup-trace-events.pl
cocci-macro-file.h add macro file for coccinelle 2015-09-09 15:34:55 +02:00
coverity-model.c coverity: fix address_space_rw model 2015-05-05 10:42:11 +02:00
create_config
disas-objdump.pl
dump-guest-memory.py scripts/dump-guest-memory.py: fix after RAMBlock change 2015-09-09 15:34:55 +02:00
extract-vsssdk-headers
feature_to_c.sh
get_maintainer.pl get_maintainer.pl: \C is deprecated 2015-09-25 12:04:41 +02:00
gtester-cat
hxtool
make-release
make_device_config.sh build: pass .d file name to scripts/make_device_config.sh, fix makefile target 2015-03-18 12:07:25 +01:00
ordereddict.py qapi: Clean up qapi.py per pep8 2015-10-12 18:44:54 +02:00
qapi-commands.py qapi: More robust conditions for when labels are needed 2015-11-02 08:30:26 +01:00
qapi-event.py qapi: Share gen_visit_fields() 2015-10-12 18:46:50 +02:00
qapi-introspect.py qapi: Use predicate callback to determine visit filtering 2015-10-15 08:39:07 +02:00
qapi-types.py qapi: Don't use info as witness of implicit object type 2015-10-15 08:39:08 +02:00
qapi-visit.py qapi: More robust conditions for when labels are needed 2015-11-02 08:30:26 +01:00
qapi.py qapi: Reserve 'q_*' and 'has_*' member names 2015-11-02 08:30:26 +01:00
qemu-binfmt-conf.sh
qemu-gdb.py gdb command: qemu handlers 2015-10-29 17:59:27 +00:00
qtest.py
refresh-pxe-roms.sh
shaderinclude.pl opengl: add shader build infrastructure 2015-05-05 09:03:32 +02:00
signrom.py
simpletrace.py
switch-timer-api
texi2pod.pl
tracetool.py
update-acpi.sh
update-linux-headers.sh linux-headers: add unistd.h 2015-10-22 14:34:48 +03:00
vmstate-static-checker.py