• Markus Armbruster's avatar
    qapi: Generate separate .h, .c for each module · 252dc310
    Markus Armbruster authored
    Our qapi-schema.json is composed of modules connected by include
    directives, but the generated code is monolithic all the same: one
    qapi-types.h with all the types, one qapi-visit.h with all the
    visitors, and so forth.  These monolithic headers get included all
    over the place.  In my "build everything" tree, adding a QAPI type
    recompiles about 4800 out of 5100 objects.
    
    We wouldn't write such monolithic headers by hand.  It stands to
    reason that we shouldn't generate them, either.
    
    Split up generated qapi-types.h to mirror the schema's modular
    structure: one header per module.  Name the main module's header
    qapi-types.h, and sub-module D/B.json's header D/qapi-types-B.h.
    
    Mirror the schema's includes in the headers, so that qapi-types.h gets
    you everything exactly as before.  If you need less, you can include
    one or more of the sub-module headers.  To be exploited shortly.
    
    Split up qapi-types.c, qapi-visit.h, qapi-visit.c, qmp-commands.h,
    qmp-commands.c, qapi-event.h, qapi-event.c the same way.
    qmp-introspect.h, qmp-introspect.c and qapi.texi remain monolithic.
    
    The split of qmp-commands.c duplicates static helper function
    qmp_marshal_output_str() in qapi-commands-char.c and
    qapi-commands-misc.c.  This happens when commands returning the same
    type occur in multiple modules.  Not worth avoiding.
    
    Since I'm going to rename qapi-event.[ch] to qapi-events.[ch], and
    qmp-commands.[ch] to qapi-commands.[ch], name the shards that way
    already, to reduce churn.  This requires temporary hacks in
    commands.py and events.py.  Similarly, c_name() must temporarily
    be taught to munge '/' in common.py.  They'll go away with the rename.
    Signed-off-by: 's avatarMarkus Armbruster <armbru@redhat.com>
    Message-Id: <20180211093607.27351-23-armbru@redhat.com>
    Reviewed-by: 's avatarEric Blake <eblake@redhat.com>
    [eblake: declare a dummy variable in each .c file, to shut up OSX
    toolchain warnings about empty .o files, including hacking c_name()]
    Signed-off-by: 's avatarEric Blake <eblake@redhat.com>
    252dc310
Name
Last commit
Last update
accel Loading commit data...
audio Loading commit data...
backends Loading commit data...
block Loading commit data...
bsd-user Loading commit data...
capstone @ 22ead3e0 Loading commit data...
chardev Loading commit data...
contrib Loading commit data...
crypto Loading commit data...
default-configs Loading commit data...
disas Loading commit data...
docs Loading commit data...
dtc @ e5438801 Loading commit data...
fpu Loading commit data...
fsdev Loading commit data...
gdb-xml Loading commit data...
hw Loading commit data...
include Loading commit data...
io Loading commit data...
libdecnumber Loading commit data...
linux-headers Loading commit data...
linux-user Loading commit data...
migration Loading commit data...
nbd Loading commit data...
net Loading commit data...
pc-bios Loading commit data...
po Loading commit data...
qapi Loading commit data...
qga Loading commit data...
qobject Loading commit data...
qom Loading commit data...
replay Loading commit data...
roms Loading commit data...
scripts Loading commit data...
scsi Loading commit data...
slirp Loading commit data...
stubs Loading commit data...
target Loading commit data...
tcg Loading commit data...
tests Loading commit data...
trace Loading commit data...
ui Loading commit data...
util Loading commit data...
.dir-locals.el Loading commit data...
.editorconfig Loading commit data...
.exrc Loading commit data...
.gdbinit Loading commit data...
.gitignore Loading commit data...
.gitmodules Loading commit data...
.mailmap Loading commit data...
.shippable.yml Loading commit data...
.travis.yml Loading commit data...
CODING_STYLE Loading commit data...
COPYING Loading commit data...
COPYING.LIB Loading commit data...
COPYING.PYTHON Loading commit data...
Changelog Loading commit data...
HACKING Loading commit data...
LICENSE Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
Makefile.objs Loading commit data...
Makefile.target Loading commit data...
README Loading commit data...
VERSION Loading commit data...
arch_init.c Loading commit data...
balloon.c Loading commit data...
block.c Loading commit data...
blockdev-nbd.c Loading commit data...
blockdev.c Loading commit data...
blockjob.c Loading commit data...
bootdevice.c Loading commit data...
bt-host.c Loading commit data...
bt-vhci.c Loading commit data...
configure Loading commit data...
cpus-common.c Loading commit data...
cpus.c Loading commit data...
device-hotplug.c Loading commit data...
device_tree.c Loading commit data...
disas.c Loading commit data...
dma-helpers.c Loading commit data...
dump.c Loading commit data...
exec.c Loading commit data...
gdbstub.c Loading commit data...
hmp-commands-info.hx Loading commit data...
hmp-commands.hx Loading commit data...
hmp.c Loading commit data...
hmp.h Loading commit data...
ioport.c Loading commit data...
iothread.c Loading commit data...
memory.c Loading commit data...
memory_ldst.inc.c Loading commit data...
memory_mapping.c Loading commit data...
module-common.c Loading commit data...
monitor.c Loading commit data...
numa.c Loading commit data...
os-posix.c Loading commit data...
os-win32.c Loading commit data...
qapi-schema.json Loading commit data...
qdev-monitor.c Loading commit data...
qdict-test-data.txt Loading commit data...
qemu-bridge-helper.c Loading commit data...
qemu-doc.texi Loading commit data...
qemu-ga.texi Loading commit data...
qemu-img-cmds.hx Loading commit data...
qemu-img.c Loading commit data...
qemu-img.texi Loading commit data...
qemu-io-cmds.c Loading commit data...
qemu-io.c Loading commit data...
qemu-keymap.c Loading commit data...
qemu-nbd.c Loading commit data...
qemu-nbd.texi Loading commit data...
qemu-option-trace.texi Loading commit data...
qemu-options-wrapper.h Loading commit data...
qemu-options.h Loading commit data...
qemu-options.hx Loading commit data...
qemu-seccomp.c Loading commit data...
qemu-tech.texi Loading commit data...
qemu.nsi Loading commit data...
qemu.sasl Loading commit data...
qmp.c Loading commit data...
qtest.c Loading commit data...
replication.c Loading commit data...
replication.h Loading commit data...
rules.mak Loading commit data...
thunk.c Loading commit data...
tpm.c Loading commit data...
trace-events Loading commit data...
version.rc Loading commit data...
vl.c Loading commit data...