qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] Clean up includes
@ 2022-12-22 12:08 Markus Armbruster
  2022-12-22 12:08 ` [PATCH v2 1/4] include/hw/virtio: Break inclusion loop Markus Armbruster
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Markus Armbruster @ 2022-12-22 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: mst, imammedo, ani, peter.maydell, laurent, edgar.iglesias,
	Alistair.Francis, bin.meng, palmer, marcel.apfelbaum,
	yangxiaojuan, gaosong, richard.henderson, deller, jasowang,
	vikram.garhwal, francisco.iglesias, clg, kraxel, marcandre.lureau,
	riku.voipio, qemu-arm, qemu-riscv, qemu-ppc, crwulff, marex

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.

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.fsf@blackfin.pond.sub.org>
    https://lists.nongnu.org/archive/html/qemu-devel/2016-03/msg03345.html

Based-on: <20221222104628.659681-1-armbru@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



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-01-09 12:26 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-22 12:08 [PATCH v2 0/4] Clean up includes Markus Armbruster
2022-12-22 12:08 ` [PATCH v2 1/4] include/hw/virtio: Break inclusion loop Markus Armbruster
2022-12-23  2:58   ` Jason Wang
2022-12-23  3:31     ` Edgar E. Iglesias
2022-12-22 12:08 ` [PATCH v2 2/4] include: Include headers where needed Markus Armbruster
2022-12-22 12:08 ` [PATCH v2 3/4] include: Don't include qemu/osdep.h Markus Armbruster
2023-01-08  6:51   ` Michael S. Tsirkin
2022-12-22 12:08 ` [PATCH v2 4/4] docs/devel: Rules on #include in headers Markus Armbruster
2022-12-23 10:47   ` Bernhard Beschow
2023-01-09 12:01     ` Markus Armbruster
2022-12-23 23:41   ` Alex Bennée
2022-12-22 12:10 ` [PATCH v2 0/4] Clean up includes Markus Armbruster
2023-01-05  1:50 ` Michael S. Tsirkin
2023-01-08  6:49 ` Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).