On Thu, Dec 22, 2022 at 01:08:09PM +0100, Markus Armbruster wrote: > 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 series fixes a number of rule violations.
I had to drop this for now due to failures on bsd in particular. See Peter's answer to my pull. Markus when you merge this feel free to use: Reviewed-by: Michael S. Tsirkin <m...@redhat.com> > It is based on > > [PATCH v2 0/4] hw/ppc: Clean up includes > [PATCH v2 0/7] include/hw/pci include/hw/cxl: Clean up includes > [PATCH v2 0/3] block: Clean up includes > [PATCH v3 0/5] coroutine: Clean up includes > > With all of these applied, just three inclusion loops remain reachable > from include/: > > target/microblaze/cpu.h target/microblaze/mmu.h > > target/nios2/cpu.h target/nios2/mmu.h > > target/riscv/cpu.h target/riscv/pmp.h > > Breaking them would be nice, but I'm out of steam. > > v2: > * Rebased > * PATCH 3: v1 posted separately > * PATCH 4: New > > [1] Message-ID: <87h9g8j57d....@blackfin.pond.sub.org> > https://lists.nongnu.org/archive/html/qemu-devel/2016-03/msg03345.html > > Based-on: <20221222104628.659681-1-arm...@redhat.com> > > Markus Armbruster (4): > include/hw/virtio: Break inclusion loop > include: Include headers where needed > include: Don't include qemu/osdep.h > docs/devel: Rules on #include in headers > > docs/devel/style.rst | 7 +++++++ > bsd-user/qemu.h | 1 - > crypto/block-luks-priv.h | 1 - > include/exec/plugin-gen.h | 1 + > include/hw/acpi/erst.h | 3 +++ > include/hw/char/cmsdk-apb-uart.h | 1 + > include/hw/char/goldfish_tty.h | 1 + > include/hw/char/xilinx_uartlite.h | 1 + > include/hw/cris/etraxfs.h | 1 + > include/hw/cxl/cxl_host.h | 1 - > include/hw/display/macfb.h | 3 ++- > include/hw/dma/sifive_pdma.h | 2 ++ > include/hw/i386/ioapic_internal.h | 1 + > include/hw/i386/sgx-epc.h | 1 + > include/hw/input/pl050.h | 1 - > include/hw/intc/goldfish_pic.h | 2 ++ > include/hw/intc/loongarch_pch_msi.h | 2 ++ > include/hw/intc/loongarch_pch_pic.h | 2 ++ > include/hw/intc/nios2_vic.h | 2 ++ > include/hw/misc/mchp_pfsoc_dmc.h | 2 ++ > include/hw/misc/mchp_pfsoc_ioscb.h | 2 ++ > include/hw/misc/mchp_pfsoc_sysreg.h | 2 ++ > include/hw/misc/pvpanic.h | 1 + > include/hw/misc/sifive_e_prci.h | 3 ++- > include/hw/misc/sifive_u_otp.h | 3 ++- > include/hw/misc/sifive_u_prci.h | 3 ++- > include/hw/misc/virt_ctrl.h | 2 ++ > include/hw/misc/xlnx-versal-pmc-iou-slcr.h | 1 + > include/hw/net/lasi_82596.h | 2 +- > include/hw/net/xlnx-zynqmp-can.h | 1 + > include/hw/ppc/pnv_psi.h | 2 +- > include/hw/riscv/boot_opensbi.h | 2 ++ > include/hw/riscv/microchip_pfsoc.h | 3 +++ > include/hw/riscv/numa.h | 1 + > include/hw/riscv/sifive_u.h | 2 ++ > include/hw/riscv/spike.h | 2 +- > include/hw/riscv/virt.h | 2 +- > include/hw/ssi/sifive_spi.h | 3 +++ > include/hw/timer/sse-timer.h | 1 + > include/hw/tricore/triboard.h | 1 - > include/hw/usb/hcd-dwc3.h | 1 + > include/hw/usb/hcd-musb.h | 2 ++ > include/hw/usb/xlnx-usb-subsystem.h | 2 ++ > include/hw/usb/xlnx-versal-usb2-ctrl-regs.h | 3 +++ > include/hw/virtio/virtio-mmio.h | 2 +- > include/hw/virtio/virtio.h | 1 - > include/qemu/plugin-memory.h | 3 +++ > include/qemu/userfaultfd.h | 1 - > include/sysemu/dirtyrate.h | 2 ++ > include/sysemu/dump.h | 1 + > include/user/syscall-trace.h | 1 + > net/vmnet_int.h | 1 - > qga/cutils.h | 1 - > target/hexagon/hex_arch_types.h | 1 - > target/hexagon/mmvec/macros.h | 1 - > target/riscv/pmu.h | 1 - > hw/virtio/virtio-qmp.c | 1 + > hw/virtio/virtio.c | 1 + > qga/cutils.c | 3 ++- > 59 files changed, 82 insertions(+), 22 deletions(-) > > -- > 2.38.1