Headers without multiple inclusion guards
We have a bunch of headers without multiple inclusion guards. Some are clearly intentional, some look accidental. Too many for me to find out by examining each of them, so I'm asking their maintainers.
Why do I ask? I'd like to mark the intentional ones and fix the accidental ones, so they don't flunk "make check-headers" from "[RFC v4 0/7] Baby steps towards saner headers" just because they lack multiple inclusion guards.
Just in case: what's a multiple inclusion guard? It's
#ifndef UNIQUE_GUARD_SYMBOL_H
#define UNIQUE_GUARD_SYMBOL_H
...
#endifwith nothing but comments outside the conditional, so that the header can safely be included more than once.
I append the alphabetical list of headers without multiple inclusion guards (as reported by scripts/clean-header-guards -nv), followed by the same list sorted into maintainer buckets. If you're cc'ed, please find your bucket(s), and tell me which headers intentionally lack guards.
= Headers without inclusion guards =
accel/tcg/atomic_template.haccel/tcg/tcg-runtime.haudio/audio_template.haudio/dsound_template.haudio/mixeng_template.haudio/rate_template.hbsd-user/bsd-mman.hbsd-user/errno_defs.hbsd-user/freebsd/syscall_nr.h bsd-user/netbsd/syscall_nr.h bsd-user/openbsd/syscall_nr.hbsd-user/syscall_defs.hcrypto/ivgen-essiv.hcrypto/ivgen-plain.hcrypto/ivgen-plain64.hfpu/softfloat-specialize.hhw/9pfs/xen-9pfs.hhw/audio/hda-codec-common.hhw/display/cirrus_vga_rop.hhw/display/cirrus_vga_rop2.h hw/display/milkymist-vgafb_template.h hw/display/omap_lcd_template.h hw/display/pl110_template.hhw/display/pxa2xx_template.hhw/display/sm501_template.h hw/display/tc6393xb_template.hhw/display/vga-helpers.hhw/hppa/hppa_hardware.hhw/input/adb-internal.hhw/net/e1000e_core.hhw/net/e1000x_common.hhw/net/vmxnet3_defs.hhw/usb/hcd-xhci.hhw/usb/quirks-ftdi-ids.hhw/usb/quirks-pl2303-ids.hhw/usb/quirks.hinclude/exec/cpu_ldst_template.h include/exec/cpu_ldst_useronly_template.h include/exec/memory_ldst.inc.h include/exec/memory_ldst_cached.inc.h include/exec/memory_ldst_phys.inc.h include/fpu/softfloat-macros.h include/hw/arm/allwinner-a10.hinclude/hw/arm/omap.hinclude/hw/arm/raspi_platform.h include/hw/arm/xlnx-zynqmp.h include/hw/char/cadence_uart.h include/hw/display/xlnx_dp.h include/hw/dma/xlnx-zynq-devcfg.hinclude/hw/elf_ops.hinclude/hw/kvm/clock.hinclude/hw/m68k/mcf_fec.hinclude/hw/mips/bios.hinclude/hw/net/cadence_gem.h include/hw/pci-bridge/simba.hinclude/hw/pci/pci_regs.hinclude/hw/qdev-dma.hinclude/hw/sparc/sparc64.hinclude/hw/timer/sun4v-rtc.h include/hw/timer/xlnx-zynqmp-rtc.h include/hw/xen/io/ring.hinclude/libdecnumber/dconfig.h include/libdecnumber/decDPD.h include/libdecnumber/dpd/decimal128Local.h include/ui/pixel_ops.hinclude/ui/spice-display.hlinux-user/aarch64/sockbits.h linux-user/aarch64/syscall_nr.h linux-user/aarch64/termbits.h linux-user/alpha/syscall_nr.hlinux-user/alpha/termbits.hlinux-user/arm/sockbits.hlinux-user/arm/syscall_nr.hlinux-user/arm/termbits.hlinux-user/cris/sockbits.hlinux-user/cris/syscall_nr.hlinux-user/cris/termbits.hlinux-user/errno_defs.hlinux-user/flat.hlinux-user/hppa/sockbits.hlinux-user/hppa/syscall_nr.hlinux-user/hppa/termbits.hlinux-user/i386/sockbits.hlinux-user/i386/syscall_nr.hlinux-user/i386/termbits.hlinux-user/ioctls.hlinux-user/m68k/sockbits.hlinux-user/m68k/syscall_nr.hlinux-user/m68k/termbits.h linux-user/microblaze/sockbits.h linux-user/microblaze/syscall_nr.h linux-user/microblaze/termbits.h linux-user/mips/syscall_nr.hlinux-user/mips/termbits.hlinux-user/mips64/sockbits.h linux-user/mips64/syscall_nr.h linux-user/mips64/target_cpu.h linux-user/mips64/target_fcntl.h linux-user/mips64/target_structs.h linux-user/mips64/termbits.hlinux-user/nios2/sockbits.hlinux-user/nios2/syscall_nr.hlinux-user/nios2/termbits.h linux-user/openrisc/sockbits.h linux-user/openrisc/syscall_nr.h linux-user/openrisc/termbits.h linux-user/ppc/syscall_nr.hlinux-user/ppc/termbits.hlinux-user/riscv/sockbits.hlinux-user/riscv/syscall_nr.h linux-user/riscv/target_syscall.h linux-user/riscv/termbits.hlinux-user/s390x/sockbits.hlinux-user/s390x/syscall_nr.hlinux-user/s390x/termbits.hlinux-user/sh4/sockbits.hlinux-user/sh4/syscall_nr.hlinux-user/sh4/termbits.hlinux-user/socket.hlinux-user/sparc/syscall_nr.hlinux-user/sparc/termbits.hlinux-user/sparc64/sockbits.h linux-user/sparc64/syscall_nr.h linux-user/sparc64/target_cpu.h linux-user/sparc64/target_fcntl.h linux-user/sparc64/target_signal.h linux-user/sparc64/termbits.hlinux-user/syscall_types.hlinux-user/target_flat.hlinux-user/tilegx/sockbits.hlinux-user/x86_64/sockbits.h linux-user/x86_64/syscall_nr.h linux-user/x86_64/target_cpu.h linux-user/x86_64/termbits.hlinux-user/xtensa/sockbits.h linux-user/xtensa/target_flat.hqemu-options-wrapper.hscripts/cocci-macro-file.htarget/alpha/helper.htarget/arm/helper-a64.htarget/arm/helper-sve.htarget/arm/helper.htarget/arm/op_addsub.htarget/cris/crisv10-decode.htarget/cris/helper.htarget/cris/mmu.htarget/cris/opcode-cris.htarget/hppa/helper.htarget/i386/cc_helper_template.htarget/i386/helper.htarget/i386/ops_sse.htarget/i386/ops_sse_header.h target/i386/shift_helper_template.h target/i386/whp-dispatch.htarget/lm32/helper.htarget/m68k/helper.htarget/microblaze/helper.h target/microblaze/microblaze-decode.h target/microblaze/mmu.htarget/mips/helper.htarget/moxie/helper.htarget/moxie/machine.htarget/moxie/mmu.htarget/nios2/helper.htarget/openrisc/helper.htarget/ppc/helper.htarget/riscv/cpu_bits.htarget/riscv/cpu_user.htarget/riscv/helper.htarget/riscv/instmap.htarget/s390x/helper.htarget/sh4/helper.htarget/sparc/helper.htarget/tilegx/helper.htarget/tilegx/spr_def_64.htarget/tricore/helper.htarget/tricore/tricore-opcodes.h target/unicore32/helper.htarget/xtensa/helper.htarget/xtensa/overlay_tool.htarget/xtensa/xtensa-isa.htcg/aarch64/tcg-target.opc.htcg/i386/tcg-target.opc.htcg/tcg-gvec-desc.htcg/tcg-op-gvec.htcg/tcg-opc.htests/crypto-tls-psk-helpers.h tests/crypto-tls-x509-helpers.h tests/io-channel-helpers.htests/libqos/virtio-9p.htests/libqos/virtio-balloon.htests/libqos/virtio-blk.htests/libqos/virtio-net.htests/libqos/virtio-rng.htests/libqos/virtio-scsi.htests/libqos/virtio-serial.h tests/migration/aarch64/a-b-kernel.h tests/migration/i386/a-b-bootblock.h tests/migration/s390x/a-b-bios.htests/socket-helpers.h tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h ui/vgafont.hui/vnc-enc-hextile-template.hui/vnc_keysym.h
= Sorted into MAINTAINERS buckets =
Guest CPU cores (TCG):
----------------------
Overall
M: Richard Henderson <[email protected]>
R: Paolo Bonzini <[email protected]>accel/tcg/atomic_template.haccel/tcg/tcg-runtime.hinclude/exec/cpu_ldst_template.hinclude/exec/cpu_ldst_useronly_template.h
FPU emulation
M: Aurelien Jarno <[email protected]>
M: Peter Maydell <[email protected]>
M: Alex Bennée <[email protected]>fpu/softfloat-specialize.hinclude/fpu/softfloat-macros.h
Alpha
M: Richard Henderson <[email protected]>
ARM
M: Peter Maydell <[email protected]>target/arm/helper-a64.htarget/arm/helper-sve.htarget/arm/helper.htarget/arm/op_addsub.h
ARM SMMU
M: Eric Auger <[email protected]>
CRIS
M: Edgar E. Iglesias <[email protected]>target/cris/crisv10-decode.htarget/cris/helper.htarget/cris/mmu.htarget/cris/opcode-cris.h
HPPA (PA-RISC)
M: Richard Henderson <[email protected]>target/hppa/helper.h
LM32
M: Michael Walle <[email protected]>hw/display/milkymist-vgafb_template.htarget/lm32/helper.h
M68K
M: Laurent Vivier <[email protected]>target/m68k/helper.h
MicroBlaze
M: Edgar E. Iglesias <[email protected]>target/microblaze/helper.htarget/microblaze/microblaze-decode.htarget/microblaze/mmu.h
MIPS
M: Aurelien Jarno <[email protected]>
M: Aleksandar Markovic <[email protected]>
R: Aleksandar Rikalo <[email protected]>include/hw/mips/bios.htarget/mips/helper.h
Moxie
M: Anthony Green <[email protected]>target/moxie/helper.htarget/moxie/machine.htarget/moxie/mmu.h
NiosII
M: Chris Wulff <[email protected]>
M: Marek Vasut <[email protected]>target/nios2/helper.h
OpenRISC
M: Stafford Horne <[email protected]>target/openrisc/helper.h
PowerPC
M: David Gibson <[email protected]>target/ppc/helper.h
RISC-V
M: Palmer Dabbelt <[email protected]>
M: Alistair Francis <[email protected]>
M: Sagar Karandikar <[email protected]>
M: Bastian Koppelmann <[email protected]> target/riscv/cpu_bits.h target/riscv/cpu_user.htarget/riscv/helper.htarget/riscv/instmap.h
S390
M: Richard Henderson <[email protected]>
M: David Hildenbrand <[email protected]>target/s390x/helper.h
SH4
M: Aurelien Jarno <[email protected]>target/sh4/helper.h
SPARC
M: Mark Cave-Ayland <[email protected]>
M: Artyom Tarasenko <[email protected]> include/hw/sparc/sparc64.h target/sparc/helper.h
UniCore32
M: Guan Xuetao <[email protected]>target/unicore32/helper.h
X86
M: Paolo Bonzini <[email protected]>
M: Richard Henderson <[email protected]>
M: Eduardo Habkost <[email protected]>target/i386/cc_helper_template.htarget/i386/helper.htarget/i386/ops_sse.htarget/i386/ops_sse_header.htarget/i386/shift_helper_template.htarget/i386/whp-dispatch.h
Xtensa
M: Max Filippov <[email protected]>target/xtensa/helper.htarget/xtensa/overlay_tool.htarget/xtensa/xtensa-isa.h
TriCore
M: Bastian Koppelmann <[email protected]> target/tricore/helper.h target/tricore/tricore-opcodes.h
Multiarch Linux User Tests
M: Alex Bennée <[email protected]>
Guest CPU Cores (KVM):
----------------------
Overall
M: Paolo Bonzini <[email protected]>include/hw/kvm/clock.h
ARM
M: Peter Maydell <[email protected]>
MIPS
M: James Hogan <[email protected]>
R: Aleksandar Rikalo <[email protected]>
PPC
M: David Gibson <[email protected]>
S390
M: Halil Pasic <[email protected]>
M: Cornelia Huck <[email protected]>
M: Christian Borntraeger <[email protected]>
X86
M: Paolo Bonzini <[email protected]>
M: Marcelo Tosatti <[email protected]>
Guest CPU Cores (Xen):
----------------------
X86
M: Stefano Stabellini <[email protected]>
M: Anthony Perard <[email protected]>
M: Paul Durrant <[email protected]>include/hw/xen/io/ring.h
ARM Machines
------------
Allwinner-a10
M: Beniamino Galvani <[email protected]>
M: Peter Maydell <[email protected]>include/hw/arm/allwinner-a10.h
ARM PrimeCell and CMSDK devices
M: Peter Maydell <[email protected]>hw/display/pl110_template.h
Raspberry Pi
M: Peter Maydell <[email protected]>
R: Andrew Baumann <[email protected]>
R: Philippe Mathieu-Daudé <[email protected]>include/hw/arm/raspi_platform.h
PXA2XX
M: Andrzej Zaborowski <[email protected]>
M: Peter Maydell <[email protected]>hw/display/pxa2xx_template.h
Xilinx ZynqMP
M: Alistair Francis <[email protected]>
M: Edgar E. Iglesias <[email protected]>
M: Peter Maydell <[email protected]>include/hw/arm/xlnx-zynqmp.hinclude/hw/display/xlnx_dp.hinclude/hw/dma/xlnx-zynq-devcfg.hinclude/hw/timer/xlnx-zynqmp-rtc.h
HP-PARISC Machines
------------------
Dino
M: Richard Henderson <[email protected]>
R: Helge Deller <[email protected]>hw/hppa/hppa_hardware.h
PowerPC Machines
----------------
New World (mac99)
M: Mark Cave-Ayland <[email protected]>
R: David Gibson <[email protected]> hw/input/adb-internal.h
sam460ex
M: BALATON Zoltan <[email protected]>hw/display/sm501_template.h
SPARC Machines
--------------
Sun4u
M: Mark Cave-Ayland <[email protected]> include/hw/pci-bridge/simba.h
Sun4v
M: Artyom Tarasenko <[email protected]>include/hw/timer/sun4v-rtc.h
Devices
-------
OMAP
M: Peter Maydell <[email protected]>hw/display/omap_lcd_template.hinclude/hw/arm/omap.h
PCI
M: Michael S. Tsirkin <[email protected]>
M: Marcel Apfelbaum <[email protected]>include/hw/pci/pci_regs.h
Network devices
M: Jason Wang <[email protected]>hw/net/e1000e_core.hhw/net/e1000x_common.hhw/net/vmxnet3_defs.hinclude/hw/net/cadence_gem.h
USB
M: Gerd Hoffmann <[email protected]>hw/usb/hcd-xhci.hhw/usb/quirks-ftdi-ids.hhw/usb/quirks-pl2303-ids.hhw/usb/quirks.h
virtio-9p
M: Greg Kurz <[email protected]>hw/9pfs/xen-9pfs.h
Vmware
M: Dmitry Fleytman <[email protected]>hw/net/vmxnet3_defs.h
e1000x
M: Dmitry Fleytman <[email protected]>hw/net/e1000x_common.h
e1000e
M: Dmitry Fleytman <[email protected]>hw/net/e1000e_core.h
Cirrus VGA
M: Gerd Hoffmann <[email protected]>hw/display/cirrus_vga_rop.hhw/display/cirrus_vga_rop2.h
Subsystems
----------
Audio
M: Gerd Hoffmann <[email protected]>audio/audio_template.haudio/dsound_template.haudio/mixeng_template.haudio/rate_template.hhw/audio/hda-codec-common.h
SPICE
M: Gerd Hoffmann <[email protected]>include/ui/spice-display.h
Graphics
M: Gerd Hoffmann <[email protected]>include/ui/pixel_ops.hui/vgafont.hui/vnc-enc-hextile-template.hui/vnc_keysym.h
qtest
M: Thomas Huth <[email protected]>
M: Laurent Vivier <[email protected]>
R: Paolo Bonzini <[email protected]>tests/libqos/virtio-9p.htests/libqos/virtio-balloon.htests/libqos/virtio-blk.htests/libqos/virtio-net.htests/libqos/virtio-rng.htests/libqos/virtio-scsi.htests/libqos/virtio-serial.h
Cryptography
M: Daniel P. Berrange <[email protected]>crypto/ivgen-essiv.hcrypto/ivgen-plain.hcrypto/ivgen-plain64.htests/crypto-tls-psk-helpers.htests/crypto-tls-x509-helpers.h
EDK2 Firmware
M: Laszlo Ersek <[email protected]>
M: Philippe Mathieu-Daudé <[email protected]> tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h
Usermode Emulation
------------------
BSD user
S: Orphanbsd-user/bsd-mman.hbsd-user/errno_defs.hbsd-user/freebsd/syscall_nr.hbsd-user/netbsd/syscall_nr.hbsd-user/openbsd/syscall_nr.hbsd-user/syscall_defs.h
Linux user
M: Riku Voipio <[email protected]>
R: Laurent Vivier <[email protected]>linux-user/aarch64/sockbits.hlinux-user/aarch64/syscall_nr.hlinux-user/aarch64/termbits.hlinux-user/alpha/syscall_nr.hlinux-user/alpha/termbits.hlinux-user/arm/sockbits.hlinux-user/arm/syscall_nr.hlinux-user/arm/termbits.hlinux-user/cris/sockbits.hlinux-user/cris/syscall_nr.hlinux-user/cris/termbits.hlinux-user/errno_defs.hlinux-user/flat.hlinux-user/hppa/sockbits.hlinux-user/hppa/syscall_nr.hlinux-user/hppa/termbits.hlinux-user/i386/sockbits.hlinux-user/i386/syscall_nr.hlinux-user/i386/termbits.hlinux-user/ioctls.hlinux-user/m68k/sockbits.hlinux-user/m68k/syscall_nr.hlinux-user/m68k/termbits.hlinux-user/microblaze/sockbits.hlinux-user/microblaze/syscall_nr.hlinux-user/microblaze/termbits.hlinux-user/mips/syscall_nr.hlinux-user/mips/termbits.hlinux-user/mips64/sockbits.hlinux-user/mips64/syscall_nr.hlinux-user/mips64/target_cpu.hlinux-user/mips64/target_fcntl.hlinux-user/mips64/target_structs.hlinux-user/mips64/termbits.hlinux-user/nios2/sockbits.hlinux-user/nios2/syscall_nr.hlinux-user/nios2/termbits.hlinux-user/openrisc/sockbits.hlinux-user/openrisc/syscall_nr.hlinux-user/openrisc/termbits.hlinux-user/ppc/syscall_nr.hlinux-user/ppc/termbits.hlinux-user/riscv/sockbits.hlinux-user/riscv/syscall_nr.hlinux-user/riscv/target_syscall.hlinux-user/riscv/termbits.hlinux-user/s390x/sockbits.hlinux-user/s390x/syscall_nr.hlinux-user/s390x/termbits.hlinux-user/sh4/sockbits.hlinux-user/sh4/syscall_nr.hlinux-user/sh4/termbits.hlinux-user/socket.hlinux-user/sparc/syscall_nr.hlinux-user/sparc/termbits.hlinux-user/sparc64/sockbits.hlinux-user/sparc64/syscall_nr.hlinux-user/sparc64/target_cpu.hlinux-user/sparc64/target_fcntl.hlinux-user/sparc64/target_signal.hlinux-user/sparc64/termbits.hlinux-user/syscall_types.hlinux-user/target_flat.hlinux-user/tilegx/sockbits.hlinux-user/x86_64/sockbits.hlinux-user/x86_64/syscall_nr.hlinux-user/x86_64/target_cpu.hlinux-user/x86_64/termbits.hlinux-user/xtensa/sockbits.hlinux-user/xtensa/target_flat.h
Tiny Code Generator (TCG)
-------------------------
Common code
M: Richard Henderson <[email protected]>tcg/aarch64/tcg-target.opc.htcg/tcg-gvec-desc.htcg/tcg-op-gvec.htcg/tcg-opc.h
AArch64 target
M: Claudio Fontana <[email protected]>
M: Claudio Fontana <[email protected]>tcg/aarch64/tcg-target.opc.h
i386 target
M: Richard Henderson <[email protected]>tcg/i386/tcg-target.opc.h
UNMAINTAINED
------------hw/display/tc6393xb_template.hinclude/exec/memory_ldst.inc.hinclude/exec/memory_ldst_cached.inc.hinclude/exec/memory_ldst_phys.inc.hinclude/hw/char/cadence_uart.hinclude/hw/elf_ops.hinclude/hw/qdev-dma.hinclude/libdecnumber/dconfig.hinclude/libdecnumber/decDPD.hinclude/libdecnumber/dpd/decimal128Local.hqemu-options-wrapper.hscripts/cocci-macro-file.htarget/tilegx/helper.htarget/tilegx/spr_def_64.htests/io-channel-helpers.htests/migration/aarch64/a-b-kernel.htests/migration/i386/a-b-bootblock.htests/migration/s390x/a-b-bios.htests/socket-helpers.h
Quoted 11 lines · Markus Armbruster
I append the alphabetical list of headers without multiple inclusion guards (as reported by
scripts/clean-header-guards-nv), followed by the same list sorted into maintainer buckets. If you're cc'ed, please find your bucket(s), and tell me which headers intentionally lack guards.FPU emulation
M: Aurelien Jarno <[email protected]>
M: Peter Maydell <[email protected]>
M: Alex Bennée <[email protected]>fpu/softfloat-specialize.hinclude/fpu/softfloat-macros.h
I think that include/fpu/softfloat-macros.h should ideally have header guards.
fpu/softfloat-specialize.h is a bit odd as it's intended to be included exactly once, by fpu/softfloat.c. Guards wouldn't hurt, I think, but it might be cleanest to rename it to fpu/softfloat-specialize.inc.c to match our convention for "lump of C which is textually included but isn't a header".
Quoted 6 lines
ARM
M: Peter Maydell <[email protected]>target/arm/helper-a64.htarget/arm/helper-sve.htarget/arm/helper.htarget/arm/op_addsub.h
All intentional -- target/*/helper.h and anything it includes is intended to be included multiple times for different purposes (the includer #defines various macros appropriately to produce different effects).
Quoted 4 lines
Allwinner-a10
M: Beniamino Galvani <[email protected]>
M: Peter Maydell <[email protected]>include/hw/arm/allwinner-a10.h
This appears to me to have an include guard:
perhaps your check doesn't recognize the variant where the #define appears just before the #endif rather than just after the #ifndef ?
Quoted 3 lines
ARM PrimeCell and CMSDK devices
M: Peter Maydell <[email protected]>hw/display/pl110_template.h
Intentional, like all the hw/display/*_template.h headers:
they're included multiple times with various definitions of BITS to generate different functions. (Note that there's an item on the BiteSizedTasks page which suggests that we could clean up all of these because only the 32-bit case is used now that our display surfaces are always 32-bits-per-pixel.)
Quoted 5 lines
Raspberry Pi
M: Peter Maydell <[email protected]>
R: Andrew Baumann <[email protected]>
R: Philippe Mathieu-Daudé <[email protected]>include/hw/arm/raspi_platform.h
Mistake, should have a guard.
Quoted 4 lines
PXA2XX
M: Andrzej Zaborowski <[email protected]>
M: Peter Maydell <[email protected]>hw/display/pxa2xx_template.h
Intentional, see above.
Quoted 7 lines
Xilinx ZynqMP
M: Alistair Francis <[email protected]>
M: Edgar E. Iglesias <[email protected]>
M: Peter Maydell <[email protected]>include/hw/arm/xlnx-zynqmp.hinclude/hw/display/xlnx_dp.hinclude/hw/dma/xlnx-zynq-devcfg.h
These all have guards in non-standard formats.
Quoted 1 line
include/hw/timer/xlnx-zynqmp-rtc.h
Mistake, should have a guard.
Quoted 3 lines
OMAP
M: Peter Maydell <[email protected]>hw/display/omap_lcd_template.h
Intentional, see above.
Quoted 1 line
include/hw/arm/omap.h
Has a guard in a non-standard form.
Quoted 3 lines
UNMAINTAINED
------------hw/display/tc6393xb_template.h
Intentional (see above)
Quoted 1 line
include/hw/char/cadence_uart.h
Another with a guard which isn't of a style your check detects.
thanks
-- PMM
Quoted 13 lines · Peter Maydell
Quoted 11 lines · Markus Armbruster
I append the alphabetical list of headers without multiple inclusion guards (as reported by
scripts/clean-header-guards-nv), followed by the same list sorted into maintainer buckets. If you're cc'ed, please find your bucket(s), and tell me which headers intentionally lack guards.FPU emulation
M: Aurelien Jarno <[email protected]>
M: Peter Maydell <[email protected]>
M: Alex Bennée <[email protected]>fpu/softfloat-specialize.hinclude/fpu/softfloat-macros.h
Quoted 2 lines
I think that
include/fpu/softfloat-macros.hshould ideally have header guards.
I'll add one.
Quoted 5 lines
fpu/softfloat-specialize.his a bit odd as it's intended to be included exactly once, byfpu/softfloat.c. Guards wouldn't hurt, I think, but it might be cleanest to rename it tofpu/softfloat-specialize.inc.cto match our convention for "lump of C which is textually included but isn't a header".
Makes me wonder why we bother with a separate file.
Renaming it to .inc.c gets it out of check-headers' way.
Quoted 11 lines
Quoted 6 lines
ARM
M: Peter Maydell <[email protected]>target/arm/helper-a64.htarget/arm/helper-sve.htarget/arm/helper.htarget/arm/op_addsub.hAll intentional --
target/*/helper.hand anything it includes is intended to be included multiple times for different purposes (the includer #defines various macros appropriately to produce different effects).
We have quite a few special headers of this kind. The ones that require macros to be defined should be excluded from check-headers. The ones that don't could instead skip the "#include a second time works" part of the test. We'll see.
Quoted 9 lines
Quoted 4 lines
Allwinner-a10
M: Beniamino Galvani <[email protected]>
M: Peter Maydell <[email protected]>include/hw/arm/allwinner-a10.hThis appears to me to have an include guard:
perhaps your check doesn't recognize the variant where the #define appears just before the #endif rather than just after the #ifndef ?
You're right, it doesn't.
We got a dozen headers with the #define in unusual places. I'll normalize them.
Quoted 11 lines
Quoted 3 lines
ARM PrimeCell and CMSDK devices
M: Peter Maydell <[email protected]>hw/display/pl110_template.hIntentional, like all the
hw/display/*_template.hheaders:
they're included multiple times with various definitions of BITS to generate different functions. (Note that there's an item on the BiteSizedTasks page which suggests that we could clean up all of these because only the 32-bit case is used now that our display surfaces are always 32-bits-per-pixel.)
Another one for the "special headers" bucket.
Quoted 7 lines
Quoted 5 lines
Raspberry Pi
M: Peter Maydell <[email protected]>
R: Andrew Baumann <[email protected]>
R: Philippe Mathieu-Daudé <[email protected]>include/hw/arm/raspi_platform.hMistake, should have a guard.
I'll add one.
Quoted 6 lines
Quoted 4 lines
PXA2XX
M: Andrzej Zaborowski <[email protected]>
M: Peter Maydell <[email protected]>hw/display/pxa2xx_template.hIntentional, see above.
Another one for the "special headers" bucket.
Quoted 9 lines
Quoted 7 lines
Xilinx ZynqMP
M: Alistair Francis <[email protected]>
M: Edgar E. Iglesias <[email protected]>
M: Peter Maydell <[email protected]>include/hw/arm/xlnx-zynqmp.hinclude/hw/display/xlnx_dp.hinclude/hw/dma/xlnx-zynq-devcfg.hThese all have guards in non-standard formats.
I'll normalize.
Quoted 3 lines
Quoted 1 line
include/hw/timer/xlnx-zynqmp-rtc.hMistake, should have a guard.
I'll add one.
Quoted 5 lines
Quoted 3 lines
OMAP
M: Peter Maydell <[email protected]>hw/display/omap_lcd_template.hIntentional, see above.
Another one for the "special headers" bucket.
Quoted 3 lines
Quoted 1 line
include/hw/arm/omap.hHas a guard in a non-standard form.
I'll normalize.
Quoted 5 lines
Quoted 3 lines
UNMAINTAINED
------------hw/display/tc6393xb_template.hIntentional (see above)
Another one for the "special headers" bucket.
Quoted 4 lines
Quoted 1 line
include/hw/char/cadence_uart.hAnother with a guard which isn't of a style your check detects.
I'll normalize.
Thanks!
Quoted 9 lines · Markus Armbruster
Quoted 5 lines · Peter Maydell
fpu/softfloat-specialize.his a bit odd as it's intended to be included exactly once, byfpu/softfloat.c. Guards wouldn't hurt, I think, but it might be cleanest to rename it tofpu/softfloat-specialize.inc.cto match our convention for "lump of C which is textually included but isn't a header".Makes me wonder why we bother with a separate file.
Partly historical, because all the fpu/ code is originally third-party from the softfloat project. Partly it separates out "code which may need to be adjusted with ifdefs to implement target-specific behaviour" from "code that should be target-agnostic".
thanks
-- PMM
Quoted 24 lines · Markus Armbruster
We have a bunch of headers without multiple inclusion guards. Some are clearly intentional, some look accidental. Too many for me to find out by examining each of them, so I'm asking their maintainers.
Why do I ask? I'd like to mark the intentional ones and fix the accidental ones, so they don't flunk "make check-headers" from "[RFC v4 0/7] Baby steps towards saner headers" just because they lack multiple inclusion guards.
Just in case: what's a multiple inclusion guard? It's
#ifndef UNIQUE_GUARD_SYMBOL_H #define UNIQUE_GUARD_SYMBOL_H ... #endifwith nothing but comments outside the conditional, so that the header can safely be included more than once.
I append the alphabetical list of headers without multiple inclusion guards (as reported by
scripts/clean-header-guards-nv), followed by the same list sorted into maintainer buckets. If you're cc'ed, please find your bucket(s), and tell me which headers intentionally lack guards.
[...]
Quoted 5 lines
X86
M: Paolo Bonzini <[email protected]>
M: Richard Henderson <[email protected]>
M: Eduardo Habkost <[email protected]>target/i386/cc_helper_template.h
Intentional. See usage at target/i386/cc_helper.c.
Quoted 1 line
target/i386/helper.h
I believe helper.h intentionally lack guards on all architectures. See helper-proto.h, helper-tcg.h, helper-gen.h.
Quoted 1 line
target/i386/ops_sse.h
Intentional, see usage at target/i386/fpu_helper.c.
Quoted 1 line
target/i386/ops_sse_header.h
Intentional, see usage at target/i386/helper.h.
Quoted 1 line
target/i386/shift_helper_template.h
Intentional, see usage at target/i386/int_helper.c.
Quoted 1 line
target/i386/whp-dispatch.h
Seems unintentional.
[...]
Quoted 6 lines
Guest CPU Cores (KVM):
----------------------Overall
M: Paolo Bonzini <[email protected]>include/hw/kvm/clock.h
Seems unintentional.
[...]
Quoted 8 lines
Guest CPU Cores (Xen):
----------------------X86
M: Stefano Stabellini <[email protected]>
M: Anthony Perard <[email protected]>
M: Paul Durrant <[email protected]>include/hw/xen/io/ring.h
I see a __XEN_PUBLIC_IO_RING_H__ guard there. Probably clean-header-guards.pl is confused by the comments at the end of the file?
Quoted 1 line
[...]
Signature · 1 line
Eduardo
Quoted 11 lines
[...]
Quoted 8 lines
Guest CPU Cores (Xen):
----------------------X86
M: Stefano Stabellini <[email protected]>
M: Anthony Perard <[email protected]>
M: Paul Durrant <[email protected]>include/hw/xen/io/ring.h
Quoted 4 lines
I see a
__XEN_PUBLIC_IO_RING_H__guard there. Probably clean-header-guards.pl is confused by the comments at the end of the file?
Yes, I see no problem there. The emacs boilerplate is common in Xen headers and persisted when this was imported.
Paul
Quoted 4 lines
Quoted 1 line
[...]
--
Eduardo
Quoted 11 lines · Paul Durrant
Quoted 11 lines
[...]
Quoted 8 lines
Guest CPU Cores (Xen):
----------------------X86
M: Stefano Stabellini <[email protected]>
M: Anthony Perard <[email protected]>
M: Paul Durrant <[email protected]>include/hw/xen/io/ring.h
Quoted 6 lines
Quoted 4 lines
I see a
__XEN_PUBLIC_IO_RING_H__guard there. Probably clean-header-guards.pl is confused by the comments at the end of the file?Yes, I see no problem there. The emacs boilerplate is common in Xen headers and persisted when this was imported.
I fixed scripts/clean-header-guards.pl in my tree to cope with this pattern.
Thanks!
Quoted 1 line · Markus Armbruster
target/xtensa/helper.h
Intentional.
Quoted 1 line
target/xtensa/overlay_tool.h
Unintentional.
Quoted 1 line
target/xtensa/xtensa-isa.h
It's a one-liner that includes another header.
Signature · 2 lines
Thanks. -- Max
Quoted 9 lines · Max Filippov
Quoted 1 line · Markus Armbruster
target/xtensa/helper.hIntentional.
Quoted 1 line
target/xtensa/overlay_tool.hUnintentional.
Quoted 1 line
target/xtensa/xtensa-isa.hIt's a one-liner that includes another header.
Feels like a bad idea, but it doesn't bother me right now.
Thanks!
Quoted 6 lines · Markus Armbruster
Quoted 4 lines · Max Filippov
Quoted 1 line · Markus Armbruster
target/xtensa/helper.hIntentional.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
target/xtensa/overlay_tool.hUnintentional.
Quoted 1 line
target/xtensa/xtensa-isa.hIt's a one-liner that includes another header.
Feels like a bad idea, but it doesn't bother me right now.
I think include/hw/xtensa/xtensa-isa.h is misplaced, it should be in target/xtensa/xtensa-isa.h, but since disas/xtensa.c includes it, it ended in include/.
Quoted 1 line · Markus Armbruster
accel/tcg/atomic_template.h
Intentional; could be renamed atomic_template.inc.c.
Quoted 1 line
accel/tcg/tcg-runtime.h
Intentional.
Quoted 2 lines
tcg/aarch64/tcg-target.opc.htcg/i386/tcg-target.opc.h
Intentional.
Quoted 2 lines
tcg/tcg-gvec-desc.htcg/tcg-op-gvec.h
Not intentional.
Quoted 1 line
tcg/tcg-opc.h
Intentional.
r~
Quoted 3 lines · Markus Armbruster
sam460ex
M: BALATON Zoltan <[email protected]>hw/display/sm501_template.h
This is like other *_template.h files mentioned by Peter in his reply and is intended to be included multiple times.
Regards,
BALATON Zoltan
Quoted 23 lines · Markus Armbruster
We have a bunch of headers without multiple inclusion guards. Some are clearly intentional, some look accidental. Too many for me to find out by examining each of them, so I'm asking their maintainers.
Why do I ask? I'd like to mark the intentional ones and fix the accidental ones, so they don't flunk "make check-headers" from "[RFC v4 0/7] Baby steps towards saner headers" just because they lack multiple inclusion guards.
Just in case: what's a multiple inclusion guard? It's
#ifndef UNIQUE_GUARD_SYMBOL_H #define UNIQUE_GUARD_SYMBOL_H ... #endifwith nothing but comments outside the conditional, so that the header can safely be included more than once.
I append the alphabetical list of headers without multiple inclusion guards (as reported by
scripts/clean-header-guards-nv), followed by the same list sorted into maintainer buckets. If you're cc'ed, please find your bucket(s), and tell me which headers intentionally lack guards.
[snip]
Quoted 3 lines
PowerPC
M: David Gibson <[email protected]>target/ppc/helper.h
Like the equivalent ARM variants, intentional.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
On 28/05/2019 20:12, Markus Armbruster wrote:
...
Quoted 3 lines
Linux user
M: Riku Voipio <[email protected]>
R: Laurent Vivier <[email protected]>
Unintentionnal:
linux-user/errno_defs.hlinux-user/flat.hlinux-user/hppa/sockbits.hlinux-user/socket.hlinux-user/aarch64/syscall_nr.hlinux-user/alpha/syscall_nr.hlinux-user/arm/syscall_nr.hlinux-user/cris/syscall_nr.hlinux-user/hppa/syscall_nr.hlinux-user/i386/syscall_nr.hlinux-user/m68k/syscall_nr.hlinux-user/microblaze/syscall_nr.hlinux-user/mips/syscall_nr.hlinux-user/mips64/syscall_nr.hlinux-user/nios2/syscall_nr.hlinux-user/openrisc/syscall_nr.hlinux-user/ppc/syscall_nr.hlinux-user/riscv/syscall_nr.hlinux-user/s390x/syscall_nr.hlinux-user/sh4/syscall_nr.hlinux-user/sparc/syscall_nr.hlinux-user/sparc64/syscall_nr.hlinux-user/x86_64/syscall_nr.hlinux-user/target_flat.hlinux-user/xtensa/target_flat.hlinux-user/riscv/target_syscall.hlinux-user/aarch64/termbits.hlinux-user/alpha/termbits.hlinux-user/arm/termbits.hlinux-user/cris/termbits.hlinux-user/hppa/termbits.hlinux-user/i386/termbits.hlinux-user/m68k/termbits.hlinux-user/microblaze/termbits.hlinux-user/mips/termbits.hlinux-user/nios2/termbits.hlinux-user/openrisc/termbits.hlinux-user/ppc/termbits.hlinux-user/riscv/termbits.hlinux-user/s390x/termbits.hlinux-user/sh4/termbits.hlinux-user/sparc/termbits.hlinux-user/sparc64/termbits.hlinux-user/x86_64/termbits.h
Intentionnal:
linux-user/ioctls.hlinux-user/aarch64/sockbits.hlinux-user/arm/sockbits.hlinux-user/cris/sockbits.hlinux-user/i386/sockbits.hlinux-user/m68k/sockbits.hlinux-user/microblaze/sockbits.hlinux-user/mips64/sockbits.hlinux-user/nios2/sockbits.hlinux-user/openrisc/sockbits.hlinux-user/riscv/sockbits.hlinux-user/s390x/sockbits.hlinux-user/sh4/sockbits.hlinux-user/sparc64/sockbits.hlinux-user/tilegx/sockbits.hlinux-user/x86_64/sockbits.hlinux-user/xtensa/sockbits.hlinux-user/syscall_types.hlinux-user/mips64/target_cpu.hlinux-user/sparc64/target_cpu.hlinux-user/x86_64/target_cpu.hlinux-user/mips64/target_fcntl.hlinux-user/sparc64/target_fcntl.hlinux-user/sparc64/target_signal.hlinux-user/mips64/target_structs.hlinux-user/mips64/termbits.h
Thanks,
Laurent
Quoted 1 line · Markus Armbruster
target/tricore/tricore-opcodes.h
unintentional.
Cheers,
Bastian
Quoted 23 lines · On Tue, 28 May 2019 20:12:24 +0200 Markus Armbruster <[email protected]> wrote:
We have a bunch of headers without multiple inclusion guards. Some are clearly intentional, some look accidental. Too many for me to find out by examining each of them, so I'm asking their maintainers.
Why do I ask? I'd like to mark the intentional ones and fix the accidental ones, so they don't flunk "make check-headers" from "[RFC v4 0/7] Baby steps towards saner headers" just because they lack multiple inclusion guards.
Just in case: what's a multiple inclusion guard? It's
#ifndef UNIQUE_GUARD_SYMBOL_H #define UNIQUE_GUARD_SYMBOL_H ... #endifwith nothing but comments outside the conditional, so that the header can safely be included more than once.
I append the alphabetical list of headers without multiple inclusion guards (as reported by
scripts/clean-header-guards-nv), followed by the same list sorted into maintainer buckets. If you're cc'ed, please find your bucket(s), and tell me which headers intentionally lack guards.
(...)
Quoted 4 lines
S390
M: Richard Henderson <[email protected]>
M: David Hildenbrand <[email protected]>target/s390x/helper.h
Intentional, as all target/*/helper.h.
(...)
Quoted 2 lines
UNMAINTAINED
------------
(...)
Quoted 1 line
tests/migration/s390x/a-b-bios.h
Autogenerated from a-b-bios.c, not intended to be included except in the migration test.
[Side note: I probably should include tests/migration/s390x/ to the s390 section in MAINTAINERS so it is no longer 'unmaintained'...]
Quoted 24 lines · On Tue, 28 May 2019 20:12:24 +0200 Markus Armbruster <[email protected]> wrote:
We have a bunch of headers without multiple inclusion guards. Some are clearly intentional, some look accidental. Too many for me to find out by examining each of them, so I'm asking their maintainers.
Why do I ask? I'd like to mark the intentional ones and fix the accidental ones, so they don't flunk "make check-headers" from "[RFC v4 0/7] Baby steps towards saner headers" just because they lack multiple inclusion guards.
Just in case: what's a multiple inclusion guard? It's
#ifndef UNIQUE_GUARD_SYMBOL_H #define UNIQUE_GUARD_SYMBOL_H ... #endifwith nothing but comments outside the conditional, so that the header can safely be included more than once.
I append the alphabetical list of headers without multiple inclusion guards (as reported by
scripts/clean-header-guards-nv), followed by the same list sorted into maintainer buckets. If you're cc'ed, please find your bucket(s), and tell me which headers intentionally lack guards.
[...]
Quoted 4 lines
virtio-9p
M: Greg Kurz <[email protected]>hw/9pfs/xen-9pfs.h
It doesn't seem to be intentional, but probably better to ask Stefano Stabellini, Paul Durrant or Anthony Perard since this is a xen-9p header, not virtio-9p.
In the meantime, I'll send a fix for MAINTAINERS.
Cheers,
--
Greg
Quoted 26 lines · Markus Armbruster
We have a bunch of headers without multiple inclusion guards. Some are clearly intentional, some look accidental. Too many for me to find out by examining each of them, so I'm asking their maintainers.
Why do I ask? I'd like to mark the intentional ones and fix the accidental ones, so they don't flunk "make check-headers" from "[RFC v4 0/7] Baby steps towards saner headers" just because they lack multiple inclusion guards.
Just in case: what's a multiple inclusion guard? It's
#ifndef UNIQUE_GUARD_SYMBOL_H #define UNIQUE_GUARD_SYMBOL_H ... #endifwith nothing but comments outside the conditional, so that the header can safely be included more than once.
I append the alphabetical list of headers without multiple inclusion guards (as reported by
scripts/clean-header-guards-nv), followed by the same list sorted into maintainer buckets. If you're cc'ed, please find your bucket(s), and tell me which headers intentionally lack guards.= Headers without inclusion guards =
<snip>
Quoted 5 lines
include/exec/cpu_ldst_template.hinclude/exec/cpu_ldst_useronly_template.hinclude/exec/memory_ldst.inc.hinclude/exec/memory_ldst_cached.inc.hinclude/exec/memory_ldst_phys.inc.h
These are all included multiple times with different #define's to expand out our various helpers. Eventually I hope to make them go away but for now they are fine.
--
Alex Bennée
Quoted 11 lines · Markus Armbruster
Just in case: what's a multiple inclusion guard? It's
#ifndef UNIQUE_GUARD_SYMBOL_H #define UNIQUE_GUARD_SYMBOL_H ... #endifwith nothing but comments outside the conditional, so that the header can safely be included more than once.
Quoted 8 lines
Guest CPU Cores (Xen):
----------------------X86
M: Stefano Stabellini <[email protected]>
M: Anthony Perard <[email protected]>
M: Paul Durrant <[email protected]>include/hw/xen/io/ring.h
That file does have a guard, it's __XEN_PUBLIC_IO_RING_H__
Do you (or the checker) want it to be changed to XEN_PUBLIC_IO_RING_H ?
Quoted 3 lines
virtio-9p
M: Greg Kurz <[email protected]>hw/9pfs/xen-9pfs.h
Stefano, is the missing inclusion guard was intentional? Otherwise, I can send a patch for it.
Cheers,
Signature · 1 line
Anthony PERARD
Quoted 21 lines · Anthony PERARD
Quoted 11 lines · Markus Armbruster
Just in case: what's a multiple inclusion guard? It's
#ifndef UNIQUE_GUARD_SYMBOL_H #define UNIQUE_GUARD_SYMBOL_H ... #endifwith nothing but comments outside the conditional, so that the header can safely be included more than once.
Quoted 8 lines
Guest CPU Cores (Xen):
----------------------X86
M: Stefano Stabellini <[email protected]>
M: Anthony Perard <[email protected]>
M: Paul Durrant <[email protected]>include/hw/xen/io/ring.h
Quoted 3 lines
That file does have a guard, it's
__XEN_PUBLIC_IO_RING_H__Do you (or the checker) want it to be changed to
XEN_PUBLIC_IO_RING_H?
Yes. I'll post a patch.
Quoted 6 lines
Quoted 3 lines
virtio-9p
M: Greg Kurz <[email protected]>hw/9pfs/xen-9pfs.hStefano, is the missing inclusion guard was intentional? Otherwise, I can send a patch for it.
Sending a patch is okay, but telling me "unintential, please fix it along with the other ones" is also okay :)
Thanks!
Quoted 5 lines
S390
M: Richard Henderson <[email protected]>
M: David Hildenbrand <[email protected]>target/s390x/helper.h
Intentional.
Cheers!
Signature · 3 lines
Thanks, David / dhildenb
Quoted 24 lines · Markus Armbruster
We have a bunch of headers without multiple inclusion guards. Some are clearly intentional, some look accidental. Too many for me to find out by examining each of them, so I'm asking their maintainers.
Why do I ask? I'd like to mark the intentional ones and fix the accidental ones, so they don't flunk "make check-headers" from "[RFC v4 0/7] Baby steps towards saner headers" just because they lack multiple inclusion guards.
Just in case: what's a multiple inclusion guard? It's
#ifndef UNIQUE_GUARD_SYMBOL_H #define UNIQUE_GUARD_SYMBOL_H ... #endifwith nothing but comments outside the conditional, so that the header can safely be included more than once.
I append the alphabetical list of headers without multiple inclusion guards (as reported by
scripts/clean-header-guards-nv), followed by the same list sorted into maintainer buckets. If you're cc'ed, please find your bucket(s), and tell me which headers intentionally lack guards.
[...]
Quoted 5 lines
EDK2 Firmware
M: Laszlo Ersek <[email protected]>
M: Philippe Mathieu-Daudé <[email protected]>tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h
This file has a guard in non-standard formats:
#ifndef __BIOS_TABLES_TEST_H__
#define __BIOS_TABLES_TEST_H__
...
Quoted 32 lines · Philippe Mathieu-Daudé
Quoted 24 lines · Markus Armbruster
We have a bunch of headers without multiple inclusion guards. Some are clearly intentional, some look accidental. Too many for me to find out by examining each of them, so I'm asking their maintainers.
Why do I ask? I'd like to mark the intentional ones and fix the accidental ones, so they don't flunk "make check-headers" from "[RFC v4 0/7] Baby steps towards saner headers" just because they lack multiple inclusion guards.
Just in case: what's a multiple inclusion guard? It's
#ifndef UNIQUE_GUARD_SYMBOL_H #define UNIQUE_GUARD_SYMBOL_H ... #endifwith nothing but comments outside the conditional, so that the header can safely be included more than once.
I append the alphabetical list of headers without multiple inclusion guards (as reported by
scripts/clean-header-guards-nv), followed by the same list sorted into maintainer buckets. If you're cc'ed, please find your bucket(s), and tell me which headers intentionally lack guards.[...]
Quoted 5 lines
EDK2 Firmware
M: Laszlo Ersek <[email protected]>
M: Philippe Mathieu-Daudé <[email protected]>tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h
Quoted 5 lines
This file has a guard in non-standard formats:
#ifndef
__BIOS_TABLES_TEST_H__
#define__BIOS_TABLES_TEST_H__
...
scripts/clean-header-guards.pl didn't recognize the guard due to the // comment after the #endif. I fixed the script, then used it to clean up this header.
Thanks!
Quoted 40 lines · Markus Armbruster
Quoted 32 lines · Philippe Mathieu-Daudé
Quoted 24 lines · Markus Armbruster
We have a bunch of headers without multiple inclusion guards. Some are clearly intentional, some look accidental. Too many for me to find out by examining each of them, so I'm asking their maintainers.
Why do I ask? I'd like to mark the intentional ones and fix the accidental ones, so they don't flunk "make check-headers" from "[RFC v4 0/7] Baby steps towards saner headers" just because they lack multiple inclusion guards.
Just in case: what's a multiple inclusion guard? It's
#ifndef UNIQUE_GUARD_SYMBOL_H #define UNIQUE_GUARD_SYMBOL_H ... #endifwith nothing but comments outside the conditional, so that the header can safely be included more than once.
I append the alphabetical list of headers without multiple inclusion guards (as reported by
scripts/clean-header-guards-nv), followed by the same list sorted into maintainer buckets. If you're cc'ed, please find your bucket(s), and tell me which headers intentionally lack guards.[...]
Quoted 5 lines
EDK2 Firmware
M: Laszlo Ersek <[email protected]>
M: Philippe Mathieu-Daudé <[email protected]>tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.hQuoted 5 lines
This file has a guard in non-standard formats:
#ifndef
__BIOS_TABLES_TEST_H__
#define__BIOS_TABLES_TEST_H__
...
Quoted 6 lines
scripts/clean-header-guards.pldidn't recognize the guard due to the // comment after the #endif. I fixed the script, then used it to clean up this header.Thanks!
(Sorry, I've just replied to the thread starter, before seeing this subthread. I'm OK if the header file is cleaned up.)
Quoted 4 lines
hw/net/e1000e_core.hhw/net/e1000x_common.hhw/net/vmxnet3_defs.h
Unintentional.
Hi Markus,
(sorry about the late reply, I've been away.)
Quoted 4 lines · Markus Armbruster
EDK2 Firmware
M: Laszlo Ersek <[email protected]>
M: Philippe Mathieu-Daudé <[email protected]>tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h
This header file does have a multiple inclusion guard:
Quoted 7 lines
/** @file
Expose the address(es) of the ACPI RSD PTR table(s) and the SMBIOS entry point(s) in a MB-aligned structure to the hypervisor.[...]
**/
Quoted 6 lines
#ifndef
__BIOS_TABLES_TEST_H__
#define__BIOS_TABLES_TEST_H__[...]
#endif //
__BIOS_TABLES_TEST_H__
It's possible that "scripts/clean-header-guards.pl" does not recognize the guard.
According to the ISO C standard, "All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use". Therefore, technically speaking, the above inclusion guard implies undefined behavior. In practice, this particular style for header guards is extremely common in the edk2 codebase:
$ git grep '^#ifndef __' -- '*.h' | wc -l 1012
And, "tests/uefi-test-tools/UefiTestToolsPkg" follows the edk2 coding style.
That said, if you'd like to remove the leading "__" from the macro name, I'd be fully OK with that.
Thank you!
Laszlo
Quoted 23 lines · Laszlo Ersek
Hi Markus,
(sorry about the late reply, I've been away.)
Quoted 4 lines · Markus Armbruster
EDK2 Firmware
M: Laszlo Ersek <[email protected]>
M: Philippe Mathieu-Daudé <[email protected]>tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.hThis header file does have a multiple inclusion guard:
Quoted 10 lines
/** @file
Expose the address(es) of the ACPI RSD PTR table(s) and the SMBIOS entry point(s) in a MB-aligned structure to the hypervisor.[...]
**/#ifndef
__BIOS_TABLES_TEST_H__
#define__BIOS_TABLES_TEST_H__
Quoted 6 lines
Quoted 3 lines
[...]
#endif //
__BIOS_TABLES_TEST_H__It's possible that "
scripts/clean-header-guards.pl" does not recognize the guard.
Correct. I fixed the script in my tree.
Quoted 6 lines
According to the ISO C standard, "All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use". Therefore, technically speaking, the above inclusion guard implies undefined behavior. In practice, this particular style for header guards is extremely common in the edk2 codebase:
Quoted 8 lines
$ git grep '^#ifndef __' -- '*.h' | wc -l 1012And, "tests/uefi-test-tools/UefiTestToolsPkg" follows the edk2 coding style.
That said, if you'd like to remove the leading "__" from the macro name, I'd be fully OK with that.
We routinely exempt files from style cleanups when we have a reason. If you want this one to be exempted, that's fine with me.
If we decide not to exempt it, then I want a header guard that makes my (fixed) script happy. It isn't right now:
$ scripts/clean-header-guards.pl -nv tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h
tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h guard __BIOS_TABLES_TEST_H__ needs cleanup:
is a reserved identifier, doesn't end with _H, doesn't match the file name
[...]Removing the leading "__" takes care of the first complaint:
tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h guard BIOS_TABLES_TEST_H__ needs cleanup:
doesn't end with _H, doesn't match the file name
Removing the trailing "__" as well takes care of the second one:
tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h guard BIOS_TABLES_TEST_H needs cleanup:
doesn't match the file name
To get rid of the last one, we can:
* Rename to BIOSTABLESTEST_H. Easy.
* Teach scripts/clean-header-guards.pl to capitalize StudlyCaps filenames to STUDLY_CAPS rather than STUDLYCAPS. But that would break include/libdecnumber/*.h.
* Teach scripts/clean-header-guards to accept either STUDLYCAPS or STUDLY_CAPS. Considering we have exactly one filename that needs this, I'd prefer not to.
My first preference is BIOSTABLESTEST_H, second is to exempt the file. Yours?
Quoted 78 lines · Markus Armbruster
Quoted 23 lines · Laszlo Ersek
Hi Markus,
(sorry about the late reply, I've been away.)
Quoted 4 lines · Markus Armbruster
EDK2 Firmware
M: Laszlo Ersek <[email protected]>
M: Philippe Mathieu-Daudé <[email protected]>tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.hThis header file does have a multiple inclusion guard:
Quoted 10 lines
/** @file
Expose the address(es) of the ACPI RSD PTR table(s) and the SMBIOS entry point(s) in a MB-aligned structure to the hypervisor.[...]
**/#ifndef
__BIOS_TABLES_TEST_H__
#define__BIOS_TABLES_TEST_H__Quoted 6 lines
Quoted 3 lines
[...]
#endif //
__BIOS_TABLES_TEST_H__It's possible that "
scripts/clean-header-guards.pl" does not recognize the guard.Correct. I fixed the script in my tree.
Quoted 6 lines
According to the ISO C standard, "All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use". Therefore, technically speaking, the above inclusion guard implies undefined behavior. In practice, this particular style for header guards is extremely common in the edk2 codebase:
Quoted 8 lines
$ git grep '^#ifndef __' -- '*.h' | wc -l 1012And, "tests/uefi-test-tools/UefiTestToolsPkg" follows the edk2 coding style.
That said, if you'd like to remove the leading "__" from the macro name, I'd be fully OK with that.
We routinely exempt files from style cleanups when we have a reason. If you want this one to be exempted, that's fine with me.
If we decide not to exempt it, then I want a header guard that makes my (fixed) script happy. It isn't right now:
$ scripts/clean-header-guards.pl -nv tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h guard __BIOS_TABLES_TEST_H__ needs cleanup: is a reserved identifier, doesn't end with _H, doesn't match the file name [...]Removing the leading "__" takes care of the first complaint:
tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.hguardBIOS_TABLES_TEST_H__needs cleanup:
doesn't end with _H, doesn't match the file nameRemoving the trailing "__" as well takes care of the second one:
tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.hguardBIOS_TABLES_TEST_Hneeds cleanup:
doesn't match the file nameTo get rid of the last one, we can:
* Rename to
BIOSTABLESTEST_H. Easy.* Teach
scripts/clean-header-guards.plto capitalize StudlyCaps filenames toSTUDLY_CAPSrather than STUDLYCAPS. But that would breakinclude/libdecnumber/*.h.
Quoted 7 lines
* Teach
scripts/clean-header-guardsto accept either STUDLYCAPS orSTUDLY_CAPS. Considering we have exactly one filename that needs this, I'd prefer not to.My first preference is
BIOSTABLESTEST_H, second is to exempt the file. Yours?
What about excluding UefiTestToolsPkg?
$ git grep '^#ifndef __' -- \ '*.h' ':!tests/uefi-test-tools/UefiTestToolsPkg'
Quoted 83 lines · Philippe Mathieu-Daudé
Quoted 82 lines · Markus Armbruster
Quoted 23 lines · Laszlo Ersek
Hi Markus,
(sorry about the late reply, I've been away.)
Quoted 4 lines · Markus Armbruster
EDK2 Firmware
M: Laszlo Ersek <[email protected]>
M: Philippe Mathieu-Daudé <[email protected]>tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.hThis header file does have a multiple inclusion guard:
Quoted 10 lines
/** @file
Expose the address(es) of the ACPI RSD PTR table(s) and the SMBIOS entry point(s) in a MB-aligned structure to the hypervisor.[...]
**/#ifndef
__BIOS_TABLES_TEST_H__
#define__BIOS_TABLES_TEST_H__Quoted 6 lines
Quoted 3 lines
[...]
#endif //
__BIOS_TABLES_TEST_H__It's possible that "
scripts/clean-header-guards.pl" does not recognize the guard.Correct. I fixed the script in my tree.
Quoted 6 lines
According to the ISO C standard, "All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use". Therefore, technically speaking, the above inclusion guard implies undefined behavior. In practice, this particular style for header guards is extremely common in the edk2 codebase:
Quoted 8 lines
$ git grep '^#ifndef __' -- '*.h' | wc -l 1012And, "tests/uefi-test-tools/UefiTestToolsPkg" follows the edk2 coding style.
That said, if you'd like to remove the leading "__" from the macro name, I'd be fully OK with that.
We routinely exempt files from style cleanups when we have a reason. If you want this one to be exempted, that's fine with me.
If we decide not to exempt it, then I want a header guard that makes my (fixed) script happy. It isn't right now:
$ scripts/clean-header-guards.pl -nv tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h guard __BIOS_TABLES_TEST_H__ needs cleanup: is a reserved identifier, doesn't end with _H, doesn't match the file name [...]Removing the leading "__" takes care of the first complaint:
tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.hguardBIOS_TABLES_TEST_H__needs cleanup:
doesn't end with _H, doesn't match the file nameRemoving the trailing "__" as well takes care of the second one:
tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.hguardBIOS_TABLES_TEST_Hneeds cleanup:
doesn't match the file nameTo get rid of the last one, we can:
* Rename to
BIOSTABLESTEST_H. Easy.* Teach
scripts/clean-header-guards.plto capitalize StudlyCaps filenames toSTUDLY_CAPSrather than STUDLYCAPS. But that would breakinclude/libdecnumber/*.h.* Teach
scripts/clean-header-guardsto accept either STUDLYCAPS orSTUDLY_CAPS. Considering we have exactly one filename that needs this, I'd prefer not to.
Quoted 9 lines
Quoted 3 lines
My first preference is
BIOSTABLESTEST_H, second is to exempt the file. Yours?What about excluding UefiTestToolsPkg?
$ git grep '^#ifndef __' -- \ '*.h' ':!tests/uefi-test-tools/UefiTestToolsPkg'
Let's go with BIOSTABLESTEST_H for now. If UefiTestToolsPkg continues to generate a bunch of warnings in other QEMU checkers too, we can still decide to exclude it, later. This change looks small enough to me, for now.
BTW thanks for that nice git-grep syntax :) I guess I should read up on "pathspec" in gitglossary(7) sometime...
Thanks!
Laszlo
Quoted 11 lines · Markus Armbruster
We have a bunch of headers without multiple inclusion guards. Some are clearly intentional, some look accidental. Too many for me to find out by examining each of them, so I'm asking their maintainers.
Why do I ask? I'd like to mark the intentional ones and fix the accidental ones, so they don't flunk "make check-headers" from "[RFC v4 0/7] Baby steps towards saner headers" just because they lack multiple inclusion guards.
Just in case: what's a multiple inclusion guard? It's
Quoted 7 lines
#ifndef UNIQUE_GUARD_SYMBOL_H #define UNIQUE_GUARD_SYMBOL_H ... #endifwith nothing but comments outside the conditional, so that the header can safely be included more than once.
Any opinions on using the less verbose syntax instead:
#pragma once
It is not portable C, but we explicitly only care about GCC or CLang, so portability isn't an issue for us.
Quoted 5 lines
Cryptography
M: Daniel P. Berrange <[email protected]>crypto/ivgen-essiv.hcrypto/ivgen-plain.hcrypto/ivgen-plain64.h
These have header guards present
Quoted 2 lines
tests/crypto-tls-psk-helpers.htests/crypto-tls-x509-helpers.h
These should be fixed.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 20 lines · Daniel P. Berrangé
Quoted 11 lines · Markus Armbruster
We have a bunch of headers without multiple inclusion guards. Some are clearly intentional, some look accidental. Too many for me to find out by examining each of them, so I'm asking their maintainers.
Why do I ask? I'd like to mark the intentional ones and fix the accidental ones, so they don't flunk "make check-headers" from "[RFC v4 0/7] Baby steps towards saner headers" just because they lack multiple inclusion guards.
Just in case: what's a multiple inclusion guard? It's
Quoted 7 lines
#ifndef UNIQUE_GUARD_SYMBOL_H #define UNIQUE_GUARD_SYMBOL_H ... #endifwith nothing but comments outside the conditional, so that the header can safely be included more than once.
Quoted 6 lines
Any opinions on using the less verbose syntax instead:
#pragma once
It is not portable C, but we explicitly only care about GCC or CLang, so portability isn't an issue for us.
I don't feel strongly about this particular question, so if folks prefer "#pragma once", I won't complain. I'd just like to report that section 6 of "HACKING" appears the opposite of "we explicitly only care about GCC or CLang".
Thanks,
Laszlo
Quoted 18 lines
Quoted 7 lines
Cryptography
M: Daniel P. Berrange <[email protected]>crypto/ivgen-essiv.hcrypto/ivgen-plain.hcrypto/ivgen-plain64.hThese have header guards present
Quoted 2 lines
tests/crypto-tls-psk-helpers.htests/crypto-tls-x509-helpers.hThese should be fixed.
Regards,
Daniel
Quoted 25 lines · Laszlo Ersek
Quoted 24 lines · Daniel P. Berrangé
Quoted 11 lines · Markus Armbruster
We have a bunch of headers without multiple inclusion guards. Some are clearly intentional, some look accidental. Too many for me to find out by examining each of them, so I'm asking their maintainers.
Why do I ask? I'd like to mark the intentional ones and fix the accidental ones, so they don't flunk "make check-headers" from "[RFC v4 0/7] Baby steps towards saner headers" just because they lack multiple inclusion guards.
Just in case: what's a multiple inclusion guard? It's
Quoted 7 lines
#ifndef UNIQUE_GUARD_SYMBOL_H #define UNIQUE_GUARD_SYMBOL_H ... #endifwith nothing but comments outside the conditional, so that the header can safely be included more than once.
Any opinions on using the less verbose syntax instead:
#pragma once
Quoted 7 lines
Quoted 2 lines
It is not portable C, but we explicitly only care about GCC or CLang, so portability isn't an issue for us.
I don't feel strongly about this particular question, so if folks prefer "#pragma once", I won't complain. I'd just like to report that section 6 of "HACKING" appears the opposite of "we explicitly only care about GCC or CLang".
Heh, yeah that doc does require some updating, as we certainly don't require conformance to the vanilla C standard any more. We now explicitly request "-std=gnu99" as the conformance level which allows many GNU extensions to the standard.
commit 7be41675f7cb16be7c8d2554add7a63fa43781a8
Author: Thomas Huth <[email protected]> Date: Mon Jan 7 11:25:22 2019 +0100
configure: Force the C standard to gnu99
Different versions of GCC and Clang use different versions of the C standard. This repeatedly caused problems already, e.g. with duplicated typedefs:
https://lists.gnu.org/archive/html/qemu-devel/2018-11/msg05829.html
or with for-loop variable initializers:
https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg00237.html
To avoid these problems, we should enforce the C language version to the same level for all compilers. Since our minimum compiler versions is GCC v4.8, our best option is "gnu99" for C code right now ("gnu17" is not available there yet, and "gnu11" is marked as "experimental"), and "gnu++98" for the few C++ code that we have in the repository.
The HACKING docs predate this commit, and when reviewing, we failed to notice we needed to update HACKING to match our new policy.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 52 lines · Daniel P. Berrangé
Quoted 25 lines · Laszlo Ersek
Quoted 24 lines · Daniel P. Berrangé
Quoted 11 lines · Markus Armbruster
We have a bunch of headers without multiple inclusion guards. Some are clearly intentional, some look accidental. Too many for me to find out by examining each of them, so I'm asking their maintainers.
Why do I ask? I'd like to mark the intentional ones and fix the accidental ones, so they don't flunk "make check-headers" from "[RFC v4 0/7] Baby steps towards saner headers" just because they lack multiple inclusion guards.
Just in case: what's a multiple inclusion guard? It's
Quoted 7 lines
#ifndef UNIQUE_GUARD_SYMBOL_H #define UNIQUE_GUARD_SYMBOL_H ... #endifwith nothing but comments outside the conditional, so that the header can safely be included more than once.
Any opinions on using the less verbose syntax instead:
#pragma once
Quoted 7 lines
Quoted 2 lines
It is not portable C, but we explicitly only care about GCC or CLang, so portability isn't an issue for us.
I don't feel strongly about this particular question, so if folks prefer "#pragma once", I won't complain. I'd just like to report that section 6 of "HACKING" appears the opposite of "we explicitly only care about GCC or CLang".
Heh, yeah that doc does require some updating, as we certainly don't require conformance to the vanilla C standard any more. We now explicitly request "-std=gnu99" as the conformance level which allows many GNU extensions to the standard.
commit
7be41675f7cb16be7c8d2554add7a63fa43781a8Author: Thomas Huth <[email protected]> Date: Mon Jan 7 11:25:22 2019 +0100configure: Force the C standard to gnu99
Different versions of GCC and Clang use different versions of the C standard. This repeatedly caused problems already, e.g. with duplicated typedefs:
https://lists.gnu.org/archive/html/qemu-devel/2018-11/msg05829.html
or with for-loop variable initializers:
Quoted 7 lines
https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg00237.html
To avoid these problems, we should enforce the C language version to the same level for all compilers. Since our minimum compiler versions is GCC v4.8, our best option is "gnu99" for C code right now ("gnu17" is not available there yet, and "gnu11" is marked as "experimental"), and "gnu++98" for the few C++ code that we have in the repository.
TIL :)
Thanks!
Laszlo
Quoted 6 lines
The HACKING docs predate this commit, and when reviewing, we failed to notice we needed to update HACKING to match our new policy.
Regards,
Daniel
Quoted 20 lines · Daniel P. Berrangé
Quoted 11 lines · Markus Armbruster
We have a bunch of headers without multiple inclusion guards. Some are clearly intentional, some look accidental. Too many for me to find out by examining each of them, so I'm asking their maintainers.
Why do I ask? I'd like to mark the intentional ones and fix the accidental ones, so they don't flunk "make check-headers" from "[RFC v4 0/7] Baby steps towards saner headers" just because they lack multiple inclusion guards.
Just in case: what's a multiple inclusion guard? It's
Quoted 7 lines
#ifndef UNIQUE_GUARD_SYMBOL_H #define UNIQUE_GUARD_SYMBOL_H ... #endifwith nothing but comments outside the conditional, so that the header can safely be included more than once.
Quoted 6 lines
Any opinions on using the less verbose syntax instead:
#pragma once
It is not portable C, but we explicitly only care about GCC or CLang, so portability isn't an issue for us.
I doubt its worth the churn. But I'm content to go with the flow here.
Quoted 7 lines
Quoted 5 lines
Cryptography
M: Daniel P. Berrange <[email protected]>crypto/ivgen-essiv.hcrypto/ivgen-plain.hcrypto/ivgen-plain64.hThese have header guards present
Yes. They #include outside the header guard, which confuses my script.
Quoted 4 lines
Quoted 2 lines
tests/crypto-tls-psk-helpers.htests/crypto-tls-x509-helpers.hThese should be fixed.
Will do, thanks!
Quoted 22 lines · Markus Armbruster
Quoted 20 lines · Daniel P. Berrangé
Quoted 18 lines · Markus Armbruster
We have a bunch of headers without multiple inclusion guards. Some are clearly intentional, some look accidental. Too many for me to find out by examining each of them, so I'm asking their maintainers.
Why do I ask? I'd like to mark the intentional ones and fix the accidental ones, so they don't flunk "make check-headers" from "[RFC v4 0/7] Baby steps towards saner headers" just because they lack multiple inclusion guards.
Just in case: what's a multiple inclusion guard? It's
#ifndef UNIQUE_GUARD_SYMBOL_H #define UNIQUE_GUARD_SYMBOL_H ... #endifwith nothing but comments outside the conditional, so that the header can safely be included more than once.
Quoted 8 lines
Quoted 6 lines
Any opinions on using the less verbose syntax instead:
#pragma once
It is not portable C, but we explicitly only care about GCC or CLang, so portability isn't an issue for us.
I doubt its worth the churn. But I'm content to go with the flow here.
Since the collective response was effectively "Meh", lets just pretend i didn't raise this suggestion :-)
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 10 lines · Markus Armbruster
We have a bunch of headers without multiple inclusion guards. Some are clearly intentional, some look accidental. Too many for me to find out by examining each of them, so I'm asking their maintainers.
Why do I ask? I'd like to mark the intentional ones and fix the accidental ones, so they don't flunk "make check-headers" from "[RFC v4 0/7] Baby steps towards saner headers" just because they lack multiple inclusion guards.
Sorry for the delay I have been on holidays. I think the ARM ones have all been covered by Peter, here is some info on the RISC-V includes.
....
Quoted 4 lines
linux-user/riscv/sockbits.hlinux-user/riscv/syscall_nr.hlinux-user/riscv/target_syscall.hlinux-user/riscv/termbits.h
I'm not sure here, it looks like all targets have the same guards, so just follow what the others do here.
....
Quoted 2 lines
target/riscv/cpu_bits.htarget/riscv/cpu_user.h
These should have guards
Quoted 1 line
target/riscv/helper.h
Intentional
Quoted 1 line
target/riscv/instmap.h
I think this should have a guard.
Alistair