include: Make headers more self-contained
authorMarkus Armbruster <armbru@redhat.com>
Mon, 12 Aug 2019 05:23:31 +0000 (07:23 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Fri, 16 Aug 2019 11:31:51 +0000 (13:31 +0200)
commitec150c7e09071bcf51bfaa8071fe23efb6df69f7
tree1226162aa31d0fc73ee0ed389fe3719d79ff7201
parentf8f2eac4e5de8ce8ef17591ee1b84904437be25b
include: Make headers more self-contained

Back in 2016, we discussed[1] rules for headers, and these were
generally liked:

1. Have a carefully curated header that's included everywhere first.  We
   got that already thanks to Peter: osdep.h.

2. Headers should normally include everything they need beyond osdep.h.
   If exceptions are needed for some reason, they must be documented in
   the header.  If all that's needed from a header is typedefs, put
   those into qemu/typedefs.h instead of including the header.

3. Cyclic inclusion is forbidden.

This patch gets include/ closer to obeying 2.

It's actually extracted from my "[RFC] Baby steps towards saner
headers" series[2], which demonstrates a possible path towards
checking 2 automatically.  It passes the RFC test there.

[1] Message-ID: <87h9g8j57d.fsf@blackfin.pond.sub.org>
    https://lists.nongnu.org/archive/html/qemu-devel/2016-03/msg03345.html
[2] Message-Id: <20190711122827.18970-1-armbru@redhat.com>
    https://lists.nongnu.org/archive/html/qemu-devel/2019-07/msg02715.html

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20190812052359.30071-2-armbru@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
106 files changed:
include/block/raw-aio.h
include/block/write-threshold.h
include/disas/disas.h
include/exec/cputlb.h
include/exec/exec-all.h
include/exec/ioport.h
include/exec/memory-internal.h
include/exec/ram_addr.h
include/exec/softmmu-semi.h
include/exec/tb-hash.h
include/exec/user/thunk.h
include/fpu/softfloat-macros.h
include/hw/acpi/pci.h
include/hw/acpi/tco.h
include/hw/adc/stm32f2xx_adc.h
include/hw/arm/allwinner-a10.h
include/hw/arm/aspeed_soc.h
include/hw/arm/bcm2836.h
include/hw/arm/exynos4210.h
include/hw/arm/fsl-imx25.h
include/hw/arm/fsl-imx31.h
include/hw/arm/sharpsl.h
include/hw/arm/xlnx-zynqmp.h
include/hw/block/fdc.h
include/hw/block/flash.h
include/hw/char/escc.h
include/hw/char/xilinx_uartlite.h
include/hw/core/generic-loader.h
include/hw/cris/etraxfs.h
include/hw/cris/etraxfs_dma.h
include/hw/display/i2c-ddc.h
include/hw/empty_slot.h
include/hw/gpio/bcm2835_gpio.h
include/hw/i2c/aspeed_i2c.h
include/hw/i386/apic_internal.h
include/hw/i386/ioapic_internal.h
include/hw/intc/allwinner-a10-pic.h
include/hw/intc/heathrow_pic.h
include/hw/intc/mips_gic.h
include/hw/isa/vt82c686.h
include/hw/mips/cps.h
include/hw/misc/macio/cuda.h
include/hw/misc/macio/gpio.h
include/hw/misc/macio/macio.h
include/hw/misc/macio/pmu.h
include/hw/misc/mips_cmgcr.h
include/hw/misc/mips_cpc.h
include/hw/misc/pvpanic.h
include/hw/net/allwinner_emac.h
include/hw/net/lance.h
include/hw/nvram/chrp_nvram.h
include/hw/pci-host/sabre.h
include/hw/pci-host/uninorth.h
include/hw/pci/pcie_aer.h
include/hw/ppc/pnv_core.h
include/hw/ppc/ppc4xx.h
include/hw/ppc/spapr_irq.h
include/hw/ppc/spapr_vio.h
include/hw/ppc/spapr_xive.h
include/hw/ppc/xive_regs.h
include/hw/riscv/boot.h
include/hw/riscv/riscv_hart.h
include/hw/riscv/sifive_clint.h
include/hw/riscv/sifive_e.h
include/hw/riscv/sifive_plic.h
include/hw/riscv/sifive_prci.h
include/hw/riscv/sifive_test.h
include/hw/riscv/sifive_u.h
include/hw/riscv/sifive_uart.h
include/hw/riscv/spike.h
include/hw/riscv/virt.h
include/hw/s390x/ap-device.h
include/hw/s390x/css-bridge.h
include/hw/s390x/css.h
include/hw/s390x/tod.h
include/hw/semihosting/console.h
include/hw/sh4/sh_intc.h
include/hw/sparc/sparc64.h
include/hw/ssi/aspeed_smc.h
include/hw/ssi/xilinx_spips.h
include/hw/timer/allwinner-a10-pit.h
include/hw/timer/i8254_internal.h
include/hw/timer/m48t59.h
include/hw/timer/mc146818rtc_regs.h
include/hw/timer/xlnx-zynqmp-rtc.h
include/hw/virtio/virtio-access.h
include/hw/virtio/virtio-gpu-bswap.h
include/hw/virtio/virtio-rng.h
include/hw/watchdog/wdt_aspeed.h
include/libdecnumber/decNumberLocal.h
include/migration/cpu.h
include/monitor/hmp-target.h
include/qemu/atomic128.h
include/qemu/ratelimit.h
include/qemu/thread-win32.h
include/sysemu/balloon.h
include/sysemu/cryptodev-vhost-user.h
include/sysemu/hvf.h
include/sysemu/iothread.h
include/sysemu/kvm_int.h
include/sysemu/memory_mapping.h
include/sysemu/xen-mapcache.h
include/ui/egl-helpers.h
include/ui/input.h
include/ui/spice-display.h
target/hppa/cpu.h