On 8/6/19 5:14 PM, Markus Armbruster wrote: > In my "build everything" tree, changing sysemu/sysemu.h triggers a > recompile of some 5400 out of 6600 objects (not counting tests and > objects that don't depend on qemu/osdep.h). > > hw/qdev-core.h includes sysemu/sysemu.h since recent commit e965ffa70a > "qdev: add qdev_add_vm_change_state_handler()". This is a bad idea: > hw/qdev-core.h is widely included. > > Move the declaration of qdev_add_vm_change_state_handler() to > sysemu/sysemu.h, and drop the problematic include from hw/qdev-core.h. > > Touching sysemu/sysemu.h now recompiles some 1800 objects. > qemu/uuid.h also drops from 5400 to 1800. A few more headers show > smaller improvement: qemu/notify.h drops from 5600 to 5200, > qemu/timer.h from 5600 to 4500, and qapi/qapi-types-run-state.h from > 5500 to 5000. > > Cc: Stefan Hajnoczi <stefa...@redhat.com> > Signed-off-by: Markus Armbruster <arm...@redhat.com> > --- > accel/kvm/kvm-all.c | 1 + > backends/hostmem.c | 1 + > cpus.c | 1 + > hw/arm/allwinner-a10.c | 1 + > hw/arm/aspeed_soc.c | 1 + > hw/arm/kzm.c | 1 + > hw/arm/msf2-soc.c | 1 + > hw/arm/stm32f205_soc.c | 1 + > hw/char/serial-isa.c | 1 + > hw/char/xen_console.c | 1 + > hw/core/numa.c | 1 + > hw/core/vm-change-state-handler.c | 1 + > hw/display/qxl-render.c | 1 + > hw/i386/xen/xen-hvm.c | 1 + > hw/i386/xen/xen-mapcache.c | 1 + > hw/intc/ioapic.c | 1 + > hw/pci/pci.c | 1 + > hw/riscv/sifive_e.c | 1 + > hw/riscv/sifive_u.c | 1 + > hw/riscv/spike.c | 1 + > hw/riscv/virt.c | 1 + > hw/sparc64/niagara.c | 2 +- > hw/usb/hcd-ehci.h | 1 + > hw/xen/xen-common.c | 1 + > hw/xen/xen_devconfig.c | 1 + > hw/xenpv/xen_machine_pv.c | 1 + > include/hw/qdev-core.h | 5 ----- > include/sysemu/sysemu.h | 3 +++ > migration/global_state.c | 1 + > migration/migration.c | 1 + > migration/savevm.c | 1 + > 31 files changed, 32 insertions(+), 6 deletions(-) > [...] > diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h > index e5b62dd2fc..de70b7a19a 100644 > --- a/include/hw/qdev-core.h > +++ b/include/hw/qdev-core.h > @@ -5,7 +5,6 @@ > #include "qemu/bitmap.h" > #include "qom/object.h" > #include "hw/hotplug.h" > -#include "sysemu/sysemu.h"
Another build errors on OSX: ui/cocoa.m:445:10: error: use of undeclared identifier 'cursor_hide' if (!cursor_hide) { ^ ui/cocoa.m:453:10: error: use of undeclared identifier 'cursor_hide' if (!cursor_hide) { ^ ui/cocoa.m:596:13: error: use of undeclared identifier 'qemu_name' if (qemu_name) ^ warning: format specifies type 'char *' but the argument has type '<dependent type>' [-Wformat] ui/cocoa.m:597:75: error: use of undeclared identifier 'qemu_name' [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s", qemu_name]]; ^ ui/cocoa.m:995:13: error: use of undeclared identifier 'qemu_name' if (qemu_name) ^ warning: format specifies type 'char *' but the argument has type '<dependent type>' [-Wformat] ui/cocoa.m:996:117: error: use of undeclared identifier 'qemu_name' [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - (Press ctrl + alt + g to release Mouse)", qemu_name]]; ^ ui/cocoa.m:1013:13: error: use of undeclared identifier 'qemu_name' if (qemu_name) ^ warning: format specifies type 'char *' but the argument has type '<dependent type>' [-Wformat] ui/cocoa.m:1014:75: error: use of undeclared identifier 'qemu_name' [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s", qemu_name]]; ^ ui/cocoa.m:1164:5: warning: implicit declaration of function 'qemu_system_shutdown_request' is invalid in C99 [-Wimplicit-function-declaration] qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI); ^ ui/cocoa.m:1164:5: warning: this function declaration is not a prototype [-Wstrict-prototypes] make: *** [ui/cocoa.o] Error 1 > > enum { > DEV_NVECTORS_UNSPECIFIED = -1, > @@ -451,8 +450,4 @@ static inline bool qbus_is_hotpluggable(BusState *bus) > void device_listener_register(DeviceListener *listener); > void device_listener_unregister(DeviceListener *listener); > > -VMChangeStateEntry *qdev_add_vm_change_state_handler(DeviceState *dev, > - VMChangeStateHandler > *cb, > - void *opaque); > - > #endif > diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h > index 227202999d..908f158677 100644 > --- a/include/sysemu/sysemu.h > +++ b/include/sysemu/sysemu.h > @@ -29,6 +29,9 @@ VMChangeStateEntry > *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb, > void *opaque); > VMChangeStateEntry *qemu_add_vm_change_state_handler_prio( > VMChangeStateHandler *cb, void *opaque, int priority); > +VMChangeStateEntry *qdev_add_vm_change_state_handler(DeviceState *dev, > + VMChangeStateHandler > *cb, > + void *opaque); > void qemu_del_vm_change_state_handler(VMChangeStateEntry *e); > void vm_state_notify(int running, RunState state);