* [PATCH 1/5] scripts/clean-header-guards: Update exclusions
2026-01-19 10:05 [PATCH 0/5] Clean up header guards again Markus Armbruster
@ 2026-01-19 10:05 ` Markus Armbruster
2026-01-19 10:33 ` Daniel P. Berrangé
2026-01-19 10:05 ` [PATCH 2/5] Clean up header guards that don't match their file name Markus Armbruster
` (4 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Markus Armbruster @ 2026-01-19 10:05 UTC (permalink / raw)
To: qemu-devel
Exclude ebpf/rss.bpf.skeleton.h, because it's generated from
tools/ebpf/rss.bpf.c.
Exclude include/hw/xen/interface/, because these headers were imported
from Xen.
Exclude tests/tracetool/, because these headers are tracetool
reference output.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
| 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--git a/scripts/clean-header-guards.pl b/scripts/clean-header-guards.pl
index a7fd8dc99f..06ecff55af 100755
--- a/scripts/clean-header-guards.pl
+++ b/scripts/clean-header-guards.pl
@@ -32,8 +32,9 @@ use warnings;
use Getopt::Std;
# Stuff we don't want to clean because we import it into our tree:
-my $exclude = qr,^(include/standard-headers/|linux-headers/
- |pc-bios/|tests/tcg/|tests/multiboot/),x;
+my $exclude = qr,^(ebpf/rss.bpf\.skeleton\.h$|include/standard-headers/
+ |include/hw/xen/interface/|linux-headers/|pc-bios/|tests/tcg/
+ |tests/multiboot/|tests/tracetool/),x;
# Stuff that is expected to fail the preprocessing test:
my $exclude_cpp = qr,^include/libdecnumber/decNumberLocal.h,;
--
2.52.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH 1/5] scripts/clean-header-guards: Update exclusions
2026-01-19 10:05 ` [PATCH 1/5] scripts/clean-header-guards: Update exclusions Markus Armbruster
@ 2026-01-19 10:33 ` Daniel P. Berrangé
0 siblings, 0 replies; 13+ messages in thread
From: Daniel P. Berrangé @ 2026-01-19 10:33 UTC (permalink / raw)
To: Markus Armbruster; +Cc: qemu-devel
On Mon, Jan 19, 2026 at 11:05:33AM +0100, Markus Armbruster wrote:
> Exclude ebpf/rss.bpf.skeleton.h, because it's generated from
> tools/ebpf/rss.bpf.c.
>
> Exclude include/hw/xen/interface/, because these headers were imported
> from Xen.
>
> Exclude tests/tracetool/, because these headers are tracetool
> reference output.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> scripts/clean-header-guards.pl | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
With regards,
Daniel
--
|: 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 :|
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/5] Clean up header guards that don't match their file name
2026-01-19 10:05 [PATCH 0/5] Clean up header guards again Markus Armbruster
2026-01-19 10:05 ` [PATCH 1/5] scripts/clean-header-guards: Update exclusions Markus Armbruster
@ 2026-01-19 10:05 ` Markus Armbruster
2026-01-19 10:35 ` Daniel P. Berrangé
2026-01-19 10:05 ` [PATCH 3/5] Clean up ill-advised or unusual header guards Markus Armbruster
` (3 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Markus Armbruster @ 2026-01-19 10:05 UTC (permalink / raw)
To: qemu-devel
Header guard symbols should match their file name to make guard
collisions less likely.
Cleaned up with scripts/clean-header-guards.pl, followed by some
renaming of new guard symbols picked by the script to better ones.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
accel/accel-internal.h | 2 +-
accel/tcg/tb-internal.h | 4 ++--
crypto/tlscredsbox.h | 6 +++---
hw/i386/tdvf-hob.h | 4 ++--
hw/riscv/riscv-iommu.h | 4 ++--
include/exec/page-protection.h | 5 +++--
include/exec/replay-core.h | 4 ++--
include/hw/acpi/ich9_tco.h | 6 +++---
include/hw/audio/virtio-snd.h | 4 ++--
include/hw/core/hw-error.h | 4 ++--
include/hw/core/qdev.h | 4 ++--
include/hw/core/sysemu-cpu-ops.h | 6 +++---
include/hw/loongarch/virt.h | 4 ++--
include/hw/misc/sifive_e_aon.h | 4 ++--
include/hw/misc/xlnx-versal-cfu.h | 5 +++--
include/hw/net/xlnx-versal-canfd.h | 4 ++--
include/hw/pci-bridge/cxl_upstream_port.h | 7 ++++---
include/hw/pci-host/fsl_imx8m_phy.h | 4 ++--
include/hw/ppc/pnv_nest_pervasive.h | 6 +++---
include/hw/ssi/pnv_spi_regs.h | 4 ++--
include/hw/virtio/vdpa-dev.h | 5 +++--
include/io/channel-null.h | 4 ++--
include/qapi/qmp-registry.h | 4 ++--
include/qemu/target-info-qapi.h | 4 ++--
include/system/cpu-timers-internal.h | 6 +++---
include/system/dirtylimit.h | 5 +++--
include/system/spdm-socket.h | 4 ++--
include/user/tswap-target.h | 5 +++--
target/arm/cpu-features.h | 4 ++--
target/arm/tcg/mte_helper.h | 6 +++---
target/i386/confidential-guest.h | 5 +++--
target/i386/emulate/x86.h | 4 ++--
target/i386/emulate/x86_decode.h | 4 ++--
target/i386/emulate/x86_flags.h | 6 +++---
target/sparc/translate.h | 5 +++--
target/xtensa/core-lx106/core-isa.h | 7 +++----
36 files changed, 88 insertions(+), 81 deletions(-)
diff --git a/accel/accel-internal.h b/accel/accel-internal.h
index d3a4422cbf..8db77fc0ba 100644
--- a/accel/accel-internal.h
+++ b/accel/accel-internal.h
@@ -14,4 +14,4 @@
void accel_init_ops_interfaces(AccelClass *ac);
-#endif /* ACCEL_SYSTEM_H */
+#endif /* ACCEL_INTERNAL_H */
diff --git a/accel/tcg/tb-internal.h b/accel/tcg/tb-internal.h
index 40439f03c3..a1b30baa38 100644
--- a/accel/tcg/tb-internal.h
+++ b/accel/tcg/tb-internal.h
@@ -6,8 +6,8 @@
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
-#ifndef ACCEL_TCG_TB_INTERNAL_TARGET_H
-#define ACCEL_TCG_TB_INTERNAL_TARGET_H
+#ifndef ACCEL_TCG_TB_INTERNAL_H
+#define ACCEL_TCG_TB_INTERNAL_H
#include "exec/translation-block.h"
diff --git a/crypto/tlscredsbox.h b/crypto/tlscredsbox.h
index eeb54d1eeb..179488dc3a 100644
--- a/crypto/tlscredsbox.h
+++ b/crypto/tlscredsbox.h
@@ -6,8 +6,8 @@
* Copyright (c) 2025 Red Hat, Inc.
*/
-#ifndef QCRYPTO_TLSCREDS_BOX_H
-#define QCRYPTO_TLSCREDS_BOX_H
+#ifndef QCRYPTO_TLSCREDSBOX_H
+#define QCRYPTO_TLSCREDSBOX_H
#include "qom/object.h"
@@ -47,4 +47,4 @@ void qcrypto_tls_creds_box_unref(QCryptoTLSCredsBox *credsbox);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoTLSCredsBox, qcrypto_tls_creds_box_unref);
-#endif /* QCRYPTO_TLSCREDS_BOX_H */
+#endif /* QCRYPTO_TLSCREDSBOX_H */
diff --git a/hw/i386/tdvf-hob.h b/hw/i386/tdvf-hob.h
index 4fc6a3740a..b712595df2 100644
--- a/hw/i386/tdvf-hob.h
+++ b/hw/i386/tdvf-hob.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
-#ifndef HW_I386_TD_HOB_H
-#define HW_I386_TD_HOB_H
+#ifndef HW_I386_TDVF_HOB_H
+#define HW_I386_TDVF_HOB_H
#include "hw/i386/tdvf.h"
#include "target/i386/kvm/tdx.h"
diff --git a/hw/riscv/riscv-iommu.h b/hw/riscv/riscv-iommu.h
index 2dabd86941..286adacc13 100644
--- a/hw/riscv/riscv-iommu.h
+++ b/hw/riscv/riscv-iommu.h
@@ -16,8 +16,8 @@
* with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef HW_RISCV_IOMMU_STATE_H
-#define HW_RISCV_IOMMU_STATE_H
+#ifndef HW_RISCV_IOMMU_H
+#define HW_RISCV_IOMMU_H
#include "qom/object.h"
#include "hw/core/qdev-properties.h"
diff --git a/include/exec/page-protection.h b/include/exec/page-protection.h
index c50ce57d15..7cb11857af 100644
--- a/include/exec/page-protection.h
+++ b/include/exec/page-protection.h
@@ -5,8 +5,9 @@
*
* SPDX-License-Identifier: LGPL-2.1+
*/
-#ifndef EXEC_PAGE_PROT_COMMON_H
-#define EXEC_PAGE_PROT_COMMON_H
+
+#ifndef EXEC_PAGE_PROTECTION_H
+#define EXEC_PAGE_PROTECTION_H
/* same as PROT_xxx */
#define PAGE_READ 0x0001
diff --git a/include/exec/replay-core.h b/include/exec/replay-core.h
index 244c77acce..849d642b0b 100644
--- a/include/exec/replay-core.h
+++ b/include/exec/replay-core.h
@@ -8,8 +8,8 @@
* See the COPYING file in the top-level directory.
*/
-#ifndef EXEC_REPLAY_H
-#define EXEC_REPLAY_H
+#ifndef EXEC_REPLAY_CORE_H
+#define EXEC_REPLAY_CORE_H
#include "qapi/qapi-types-replay.h"
diff --git a/include/hw/acpi/ich9_tco.h b/include/hw/acpi/ich9_tco.h
index b3c3f69451..c1457a3cb2 100644
--- a/include/hw/acpi/ich9_tco.h
+++ b/include/hw/acpi/ich9_tco.h
@@ -7,8 +7,8 @@
* See the COPYING file in the top-level directory.
*/
-#ifndef HW_ACPI_TCO_H
-#define HW_ACPI_TCO_H
+#ifndef HW_ACPI_ICH9_TCO_H
+#define HW_ACPI_ICH9_TCO_H
#include "system/memory.h"
#include "migration/vmstate.h"
@@ -80,4 +80,4 @@ void acpi_pm_tco_init(TCOIORegs *tr, MemoryRegion *parent);
extern const VMStateDescription vmstate_tco_io_sts;
-#endif /* HW_ACPI_TCO_H */
+#endif /* HW_ACPI_ICH9_TCO_H */
diff --git a/include/hw/audio/virtio-snd.h b/include/hw/audio/virtio-snd.h
index c176066584..c4ca781769 100644
--- a/include/hw/audio/virtio-snd.h
+++ b/include/hw/audio/virtio-snd.h
@@ -13,8 +13,8 @@
* top-level directory.
*/
-#ifndef QEMU_VIRTIO_SOUND_H
-#define QEMU_VIRTIO_SOUND_H
+#ifndef HW_AUDIO_VIRTIO_SND_H
+#define HW_AUDIO_VIRTIO_SND_H
#include "hw/virtio/virtio.h"
#include "qemu/audio.h"
diff --git a/include/hw/core/hw-error.h b/include/hw/core/hw-error.h
index 1b33d12b7f..ab9bb097ee 100644
--- a/include/hw/core/hw-error.h
+++ b/include/hw/core/hw-error.h
@@ -1,5 +1,5 @@
-#ifndef QEMU_HW_H
-#define QEMU_HW_H
+#ifndef HW_CORE_HW_ERROR_H
+#define HW_CORE_HW_ERROR_H
G_NORETURN void hw_error(const char *fmt, ...) G_GNUC_PRINTF(1, 2);
diff --git a/include/hw/core/qdev.h b/include/hw/core/qdev.h
index 4b2730e9d8..8d8ec90f63 100644
--- a/include/hw/core/qdev.h
+++ b/include/hw/core/qdev.h
@@ -1,5 +1,5 @@
-#ifndef QDEV_CORE_H
-#define QDEV_CORE_H
+#ifndef HW_CORE_QDEV_H
+#define HW_CORE_QDEV_H
#include "qemu/atomic.h"
#include "qemu/queue.h"
diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h
index 877892373f..6f95a59094 100644
--- a/include/hw/core/sysemu-cpu-ops.h
+++ b/include/hw/core/sysemu-cpu-ops.h
@@ -7,8 +7,8 @@
* See the COPYING file in the top-level directory.
*/
-#ifndef SYSTEM_CPU_OPS_H
-#define SYSTEM_CPU_OPS_H
+#ifndef HW_CORE_SYSEMU_CPU_OPS_H
+#define HW_CORE_SYSEMU_CPU_OPS_H
#include "hw/core/cpu.h"
@@ -93,4 +93,4 @@ typedef struct SysemuCPUOps {
} SysemuCPUOps;
-#endif /* SYSTEM_CPU_OPS_H */
+#endif /* HW_CORE_SYSEMU_CPU_OPS_H */
diff --git a/include/hw/loongarch/virt.h b/include/hw/loongarch/virt.h
index d39a9bbf5d..8ada77b238 100644
--- a/include/hw/loongarch/virt.h
+++ b/include/hw/loongarch/virt.h
@@ -5,8 +5,8 @@
* Copyright (C) 2021 Loongson Technology Corporation Limited
*/
-#ifndef HW_LOONGARCH_H
-#define HW_LOONGARCH_H
+#ifndef HW_LOONGARCH_VIRT_H
+#define HW_LOONGARCH_VIRT_H
#include "hw/core/boards.h"
#include "qemu/queue.h"
diff --git a/include/hw/misc/sifive_e_aon.h b/include/hw/misc/sifive_e_aon.h
index efa2c3023f..514b852417 100644
--- a/include/hw/misc/sifive_e_aon.h
+++ b/include/hw/misc/sifive_e_aon.h
@@ -16,8 +16,8 @@
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef HW_SIFIVE_AON_H
-#define HW_SIFIVE_AON_H
+#ifndef HW_SIFIVE_E_AON_H
+#define HW_SIFIVE_E_AON_H
#include "hw/core/sysbus.h"
#include "qom/object.h"
diff --git a/include/hw/misc/xlnx-versal-cfu.h b/include/hw/misc/xlnx-versal-cfu.h
index e4fefe43c0..8e3ba0bc99 100644
--- a/include/hw/misc/xlnx-versal-cfu.h
+++ b/include/hw/misc/xlnx-versal-cfu.h
@@ -14,8 +14,9 @@
* [2] Versal ACAP Register Reference,
* https://docs.xilinx.com/r/en-US/am012-versal-register-reference/CFU_CSR-Module
*/
-#ifndef HW_MISC_XLNX_VERSAL_CFU_APB_H
-#define HW_MISC_XLNX_VERSAL_CFU_APB_H
+
+#ifndef HW_MISC_XLNX_VERSAL_CFU_H
+#define HW_MISC_XLNX_VERSAL_CFU_H
#include "hw/core/sysbus.h"
#include "hw/core/register.h"
diff --git a/include/hw/net/xlnx-versal-canfd.h b/include/hw/net/xlnx-versal-canfd.h
index 7cadf3123b..54667a344f 100644
--- a/include/hw/net/xlnx-versal-canfd.h
+++ b/include/hw/net/xlnx-versal-canfd.h
@@ -25,8 +25,8 @@
* THE SOFTWARE.
*/
-#ifndef HW_CANFD_XILINX_H
-#define HW_CANFD_XILINX_H
+#ifndef HW_NET_XLNX_VERSAL_CANFD_H
+#define HW_NET_XLNX_VERSAL_CANFD_H
#include "hw/core/register.h"
#include "hw/core/ptimer.h"
diff --git a/include/hw/pci-bridge/cxl_upstream_port.h b/include/hw/pci-bridge/cxl_upstream_port.h
index f208397ffe..4424b35eeb 100644
--- a/include/hw/pci-bridge/cxl_upstream_port.h
+++ b/include/hw/pci-bridge/cxl_upstream_port.h
@@ -1,6 +1,7 @@
-#ifndef CXL_USP_H
-#define CXL_USP_H
+#ifndef HW_PCI_BRIDGE_CXL_UPSTREAM_PORT_H
+#define HW_PCI_BRIDGE_CXL_UPSTREAM_PORT_H
+
#include "hw/pci/pcie.h"
#include "hw/pci/pcie_port.h"
#include "hw/cxl/cxl.h"
@@ -20,4 +21,4 @@ typedef struct CXLUpstreamPort {
uint64_t sn;
} CXLUpstreamPort;
-#endif /* CXL_SUP_H */
+#endif /* HW_PCI_BRIDGE_CXL_UPSTREAM_PORT_H */
diff --git a/include/hw/pci-host/fsl_imx8m_phy.h b/include/hw/pci-host/fsl_imx8m_phy.h
index 5786534b0e..d19baa8cd2 100644
--- a/include/hw/pci-host/fsl_imx8m_phy.h
+++ b/include/hw/pci-host/fsl_imx8m_phy.h
@@ -6,8 +6,8 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
-#ifndef HW_PCIHOST_FSLIMX8MPCIEPHY_H
-#define HW_PCIHOST_FSLIMX8MPCIEPHY_H
+#ifndef HW_PCI_HOST_FSL_IMX8M_PHY_H
+#define HW_PCI_HOST_FSL_IMX8M_PHY_H
#include "hw/core/sysbus.h"
#include "qom/object.h"
diff --git a/include/hw/ppc/pnv_nest_pervasive.h b/include/hw/ppc/pnv_nest_pervasive.h
index 73cacf3823..f0132cd525 100644
--- a/include/hw/ppc/pnv_nest_pervasive.h
+++ b/include/hw/ppc/pnv_nest_pervasive.h
@@ -6,8 +6,8 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
-#ifndef PPC_PNV_NEST_CHIPLET_PERVASIVE_H
-#define PPC_PNV_NEST_CHIPLET_PERVASIVE_H
+#ifndef HW_PPC_PNV_NEST_PERVASIVE_H
+#define HW_PPC_PNV_NEST_PERVASIVE_H
#define TYPE_PNV_NEST_CHIPLET_PERVASIVE "pnv-nest-chiplet-pervasive"
#define PNV_NEST_CHIPLET_PERVASIVE(obj) OBJECT_CHECK(PnvNestChipletPervasive, (obj), TYPE_PNV_NEST_CHIPLET_PERVASIVE)
@@ -29,4 +29,4 @@ typedef struct PnvNestChipletPervasive {
PnvPervasiveCtrlRegs control_regs;
} PnvNestChipletPervasive;
-#endif /*PPC_PNV_NEST_CHIPLET_PERVASIVE_H */
+#endif /* HW_PPC_PNV_NEST_PERVASIVE_H */
diff --git a/include/hw/ssi/pnv_spi_regs.h b/include/hw/ssi/pnv_spi_regs.h
index 596e2c1911..f26aeb5a0d 100644
--- a/include/hw/ssi/pnv_spi_regs.h
+++ b/include/hw/ssi/pnv_spi_regs.h
@@ -6,8 +6,8 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
-#ifndef PNV_SPI_CONTROLLER_REGS_H
-#define PNV_SPI_CONTROLLER_REGS_H
+#ifndef HW_SSI_PNV_SPI_REGS_H
+#define HW_SSI_PNV_SPI_REGS_H
/*
* Macros from target/ppc/cpu.h
diff --git a/include/hw/virtio/vdpa-dev.h b/include/hw/virtio/vdpa-dev.h
index 4dbf98195c..a4e49bd34a 100644
--- a/include/hw/virtio/vdpa-dev.h
+++ b/include/hw/virtio/vdpa-dev.h
@@ -12,8 +12,9 @@
* This work is licensed under the terms of the GNU LGPL, version 2 or later.
* See the COPYING.LIB file in the top-level directory.
*/
-#ifndef _VHOST_VDPA_DEVICE_H
-#define _VHOST_VDPA_DEVICE_H
+
+#ifndef HW_VIRTIO_VDPA_DEV_H
+#define HW_VIRTIO_VDPA_DEV_H
#include "hw/virtio/vhost.h"
#include "hw/virtio/vhost-vdpa.h"
diff --git a/include/io/channel-null.h b/include/io/channel-null.h
index f6d54e63cf..062edbb1bb 100644
--- a/include/io/channel-null.h
+++ b/include/io/channel-null.h
@@ -18,8 +18,8 @@
*
*/
-#ifndef QIO_CHANNEL_FILE_H
-#define QIO_CHANNEL_FILE_H
+#ifndef QIO_CHANNEL_NULL_H
+#define QIO_CHANNEL_NULL_H
#include "io/channel.h"
#include "qom/object.h"
diff --git a/include/qapi/qmp-registry.h b/include/qapi/qmp-registry.h
index e0ee1ad3ac..d53aa5f36c 100644
--- a/include/qapi/qmp-registry.h
+++ b/include/qapi/qmp-registry.h
@@ -11,8 +11,8 @@
*
*/
-#ifndef QAPI_QMP_DISPATCH_H
-#define QAPI_QMP_DISPATCH_H
+#ifndef QAPI_QMP_REGISTRY_H
+#define QAPI_QMP_REGISTRY_H
#include "monitor/monitor.h"
#include "qemu/queue.h"
diff --git a/include/qemu/target-info-qapi.h b/include/qemu/target-info-qapi.h
index d5ce052323..c1fbc7e10b 100644
--- a/include/qemu/target-info-qapi.h
+++ b/include/qemu/target-info-qapi.h
@@ -6,8 +6,8 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
-#ifndef QEMU_TARGET_INFO_EXTRA_H
-#define QEMU_TARGET_INFO_EXTRA_H
+#ifndef QEMU_TARGET_INFO_QAPI_H
+#define QEMU_TARGET_INFO_QAPI_H
#include "qapi/qapi-types-common.h"
#include "qapi/qapi-types-machine.h"
diff --git a/include/system/cpu-timers-internal.h b/include/system/cpu-timers-internal.h
index 8c262ce139..126c81bcb4 100644
--- a/include/system/cpu-timers-internal.h
+++ b/include/system/cpu-timers-internal.h
@@ -22,8 +22,8 @@
* THE SOFTWARE.
*/
-#ifndef TIMERS_STATE_H
-#define TIMERS_STATE_H
+#ifndef SYSTEM_CPU_TIMERS_INTERNAL_H
+#define SYSTEM_CPU_TIMERS_INTERNAL_H
/* timers state, for sharing between icount and cpu-timers */
@@ -68,4 +68,4 @@ extern TimersState timers_state;
*/
int64_t cpu_get_clock_locked(void);
-#endif /* TIMERS_STATE_H */
+#endif /* SYSTEM_CPU_TIMERS_INTERNAL_H */
diff --git a/include/system/dirtylimit.h b/include/system/dirtylimit.h
index d11ebbbbdb..cc4619fef7 100644
--- a/include/system/dirtylimit.h
+++ b/include/system/dirtylimit.h
@@ -9,8 +9,9 @@
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
-#ifndef QEMU_DIRTYRLIMIT_H
-#define QEMU_DIRTYRLIMIT_H
+
+#ifndef SYSTEM_DIRTYLIMIT_H
+#define SYSTEM_DIRTYLIMIT_H
#define DIRTYLIMIT_CALC_TIME_MS 1000 /* 1000ms */
diff --git a/include/system/spdm-socket.h b/include/system/spdm-socket.h
index 00cb0e97f3..2745588456 100644
--- a/include/system/spdm-socket.h
+++ b/include/system/spdm-socket.h
@@ -20,8 +20,8 @@
* THE SOFTWARE.
*/
-#ifndef SPDM_REQUESTER_H
-#define SPDM_REQUESTER_H
+#ifndef SYSTEM_SPDM_SOCKET_H
+#define SYSTEM_SPDM_SOCKET_H
/**
* spdm_socket_connect: connect to an external SPDM socket
diff --git a/include/user/tswap-target.h b/include/user/tswap-target.h
index 4719330dbb..4189d1fec1 100644
--- a/include/user/tswap-target.h
+++ b/include/user/tswap-target.h
@@ -5,8 +5,9 @@
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
-#ifndef USER_TSWAP_H
-#define USER_TSWAP_H
+
+#ifndef USER_TSWAP_TARGET_H
+#define USER_TSWAP_TARGET_H
#include "exec/cpu-defs.h"
#include "exec/tswap.h"
diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h
index a7ca410dcb..5fbd3e6e03 100644
--- a/target/arm/cpu-features.h
+++ b/target/arm/cpu-features.h
@@ -17,8 +17,8 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef TARGET_ARM_FEATURES_H
-#define TARGET_ARM_FEATURES_H
+#ifndef TARGET_ARM_CPU_FEATURES_H
+#define TARGET_ARM_CPU_FEATURES_H
#include "hw/core/registerfields.h"
#include "qemu/host-utils.h"
diff --git a/target/arm/tcg/mte_helper.h b/target/arm/tcg/mte_helper.h
index 1f471fb69b..0ae2b0ced1 100644
--- a/target/arm/tcg/mte_helper.h
+++ b/target/arm/tcg/mte_helper.h
@@ -6,8 +6,8 @@
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
-#ifndef TARGET_ARM_MTE_H
-#define TARGET_ARM_MTE_H
+#ifndef TARGET_ARM_TCG_MTE_HELPER_H
+#define TARGET_ARM_TCG_MTE_HELPER_H
#include "exec/mmu-access-type.h"
@@ -63,4 +63,4 @@ int load_tag1(uint64_t ptr, uint8_t *mem);
*/
void store_tag1(uint64_t ptr, uint8_t *mem, int tag);
-#endif /* TARGET_ARM_MTE_H */
+#endif /* TARGET_ARM_TCG_MTE_HELPER_H */
diff --git a/target/i386/confidential-guest.h b/target/i386/confidential-guest.h
index 48b88dbd31..7114cbf7d1 100644
--- a/target/i386/confidential-guest.h
+++ b/target/i386/confidential-guest.h
@@ -9,8 +9,9 @@
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
-#ifndef TARGET_I386_CG_H
-#define TARGET_I386_CG_H
+
+#ifndef TARGET_I386_CONFIDENTIAL_GUEST_H
+#define TARGET_I386_CONFIDENTIAL_GUEST_H
#include "qom/object.h"
diff --git a/target/i386/emulate/x86.h b/target/i386/emulate/x86.h
index 73edccfba0..46d6a60e92 100644
--- a/target/i386/emulate/x86.h
+++ b/target/i386/emulate/x86.h
@@ -16,8 +16,8 @@
* License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef X86_EMU_DEFS_H
-#define X86_EMU_DEFS_H
+#ifndef TARGET_I386_EMULATE_X86_H
+#define TARGET_I386_EMULATE_X86_H
typedef struct x86_register {
union {
diff --git a/target/i386/emulate/x86_decode.h b/target/i386/emulate/x86_decode.h
index 1cadf3694f..adbff86164 100644
--- a/target/i386/emulate/x86_decode.h
+++ b/target/i386/emulate/x86_decode.h
@@ -15,8 +15,8 @@
* License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef X86_EMU_DECODE_H
-#define X86_EMU_DECODE_H
+#ifndef TARGET_I386_EMULATE_X86_DECODE_H
+#define TARGET_I386_EMULATE_X86_DECODE_H
#include "cpu.h"
#include "x86.h"
diff --git a/target/i386/emulate/x86_flags.h b/target/i386/emulate/x86_flags.h
index a395c837a0..9f081fde4a 100644
--- a/target/i386/emulate/x86_flags.h
+++ b/target/i386/emulate/x86_flags.h
@@ -21,8 +21,8 @@
* x86 eflags functions
*/
-#ifndef X86_EMU_FLAGS_H
-#define X86_EMU_FLAGS_H
+#ifndef TARGET_I386_EMULATE_X86_FLAGS_H
+#define TARGET_I386_EMULATE_X86_FLAGS_H
#include "cpu.h"
void lflags_to_rflags(CPUX86State *env);
@@ -68,4 +68,4 @@ void SET_FLAGS_OSZAPC_LOGIC16(CPUX86State *env, uint16_t v1, uint16_t v2,
void SET_FLAGS_OSZAPC_LOGIC8(CPUX86State *env, uint8_t v1, uint8_t v2,
uint8_t diff);
-#endif /* X86_EMU_FLAGS_H */
+#endif /* TARGET_I386_EMULATE_X86_FLAGS_H */
diff --git a/target/sparc/translate.h b/target/sparc/translate.h
index a46fa4f124..06979c67ae 100644
--- a/target/sparc/translate.h
+++ b/target/sparc/translate.h
@@ -4,8 +4,9 @@
* Copyright (c) 2024 Linaro, Ltd
* SPDX-License-Identifier: GPL-2.0-or-later
*/
-#ifndef SPARC_TRANSLATION_H
-#define SPARC_TRANSLATION_H
+
+#ifndef SPARC_TRANSLATE_H
+#define SPARC_TRANSLATE_H
/* Dynamic PC, must exit to main loop. */
#define DYNAMIC_PC 1
diff --git a/target/xtensa/core-lx106/core-isa.h b/target/xtensa/core-lx106/core-isa.h
index 86bcf1a5d6..6933f1a406 100644
--- a/target/xtensa/core-lx106/core-isa.h
+++ b/target/xtensa/core-lx106/core-isa.h
@@ -28,9 +28,8 @@
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-#ifndef _XTENSA_CORE_CONFIGURATION_H
-#define _XTENSA_CORE_CONFIGURATION_H
-
+#ifndef XTENSA_CORE_LX106_CORE_ISA_H
+#define XTENSA_CORE_LX106_CORE_ISA_H
/****************************************************************************
Parameters Useful for Any Code, USER or PRIVILEGED
@@ -466,5 +465,5 @@
#endif /* !XTENSA_HAL_NON_PRIVILEGED_ONLY */
-#endif /* _XTENSA_CORE_CONFIGURATION_H */
+#endif /* XTENSA_CORE_LX106_CORE_ISA_H */
--
2.52.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH 2/5] Clean up header guards that don't match their file name
2026-01-19 10:05 ` [PATCH 2/5] Clean up header guards that don't match their file name Markus Armbruster
@ 2026-01-19 10:35 ` Daniel P. Berrangé
0 siblings, 0 replies; 13+ messages in thread
From: Daniel P. Berrangé @ 2026-01-19 10:35 UTC (permalink / raw)
To: Markus Armbruster; +Cc: qemu-devel
On Mon, Jan 19, 2026 at 11:05:34AM +0100, Markus Armbruster wrote:
> Header guard symbols should match their file name to make guard
> collisions less likely.
>
> Cleaned up with scripts/clean-header-guards.pl, followed by some
> renaming of new guard symbols picked by the script to better ones.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> accel/accel-internal.h | 2 +-
> accel/tcg/tb-internal.h | 4 ++--
> crypto/tlscredsbox.h | 6 +++---
> hw/i386/tdvf-hob.h | 4 ++--
> hw/riscv/riscv-iommu.h | 4 ++--
> include/exec/page-protection.h | 5 +++--
> include/exec/replay-core.h | 4 ++--
> include/hw/acpi/ich9_tco.h | 6 +++---
> include/hw/audio/virtio-snd.h | 4 ++--
> include/hw/core/hw-error.h | 4 ++--
> include/hw/core/qdev.h | 4 ++--
> include/hw/core/sysemu-cpu-ops.h | 6 +++---
> include/hw/loongarch/virt.h | 4 ++--
> include/hw/misc/sifive_e_aon.h | 4 ++--
> include/hw/misc/xlnx-versal-cfu.h | 5 +++--
> include/hw/net/xlnx-versal-canfd.h | 4 ++--
> include/hw/pci-bridge/cxl_upstream_port.h | 7 ++++---
> include/hw/pci-host/fsl_imx8m_phy.h | 4 ++--
> include/hw/ppc/pnv_nest_pervasive.h | 6 +++---
> include/hw/ssi/pnv_spi_regs.h | 4 ++--
> include/hw/virtio/vdpa-dev.h | 5 +++--
> include/io/channel-null.h | 4 ++--
> include/qapi/qmp-registry.h | 4 ++--
> include/qemu/target-info-qapi.h | 4 ++--
> include/system/cpu-timers-internal.h | 6 +++---
> include/system/dirtylimit.h | 5 +++--
> include/system/spdm-socket.h | 4 ++--
> include/user/tswap-target.h | 5 +++--
> target/arm/cpu-features.h | 4 ++--
> target/arm/tcg/mte_helper.h | 6 +++---
> target/i386/confidential-guest.h | 5 +++--
> target/i386/emulate/x86.h | 4 ++--
> target/i386/emulate/x86_decode.h | 4 ++--
> target/i386/emulate/x86_flags.h | 6 +++---
> target/sparc/translate.h | 5 +++--
> target/xtensa/core-lx106/core-isa.h | 7 +++----
> 36 files changed, 88 insertions(+), 81 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
With regards,
Daniel
--
|: 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 :|
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 3/5] Clean up ill-advised or unusual header guards
2026-01-19 10:05 [PATCH 0/5] Clean up header guards again Markus Armbruster
2026-01-19 10:05 ` [PATCH 1/5] scripts/clean-header-guards: Update exclusions Markus Armbruster
2026-01-19 10:05 ` [PATCH 2/5] Clean up header guards that don't match their file name Markus Armbruster
@ 2026-01-19 10:05 ` Markus Armbruster
2026-01-19 10:35 ` Daniel P. Berrangé
2026-01-19 15:09 ` Warner Losh
2026-01-19 10:05 ` [PATCH 4/5] Normalize header guard symbol definition Markus Armbruster
` (2 subsequent siblings)
5 siblings, 2 replies; 13+ messages in thread
From: Markus Armbruster @ 2026-01-19 10:05 UTC (permalink / raw)
To: qemu-devel
Leading underscores are ill-advised because such identifiers are
reserved. Trailing underscores are merely ugly. Strip both.
Our header guards commonly end in _H. Normalize the exceptions.
Macros should be ALL_CAPS. Normalize the exception.
Done with scripts/clean-header-guards.pl.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
backends/tpm/tpm_ioctl.h | 7 ++++---
bsd-user/bsd-proc.h | 6 +++---
hw/net/igb_regs.h | 4 ++--
include/exec/target_long.h | 6 +++---
include/exec/tb-flush.h | 7 ++++---
include/gdbstub/helpers.h | 6 +++---
include/gdbstub/syscalls.h | 6 +++---
include/hw/arm/raspberrypi-fw-defs.h | 7 +++----
include/hw/arm/stm32l4x5_soc.h | 4 ++--
include/hw/gpio/pcf8574.h | 6 +++---
include/hw/virtio/vhost-user-gpio.h | 6 +++---
include/hw/virtio/vhost-user-scmi.h | 6 +++---
include/hw/xen/xen-pvh-common.h | 4 ++--
include/tcg/insn-start-words.h | 6 +++---
qga/cutils.h | 6 +++---
15 files changed, 44 insertions(+), 43 deletions(-)
diff --git a/backends/tpm/tpm_ioctl.h b/backends/tpm/tpm_ioctl.h
index ee2dd15d35..e1e858c4bc 100644
--- a/backends/tpm/tpm_ioctl.h
+++ b/backends/tpm/tpm_ioctl.h
@@ -5,8 +5,9 @@
*
* This file is licensed under the terms of the 3-clause BSD license
*/
-#ifndef _TPM_IOCTL_H_
-#define _TPM_IOCTL_H_
+
+#ifndef TPM_IOCTL_H
+#define TPM_IOCTL_H
#if defined(__CYGWIN__)
# define __USE_LINUX_IOCTL_DEFS
@@ -341,4 +342,4 @@ enum {
CMD_LOCK_STORAGE, /* 0x13 */
};
-#endif /* _TPM_IOCTL_H_ */
+#endif /* TPM_IOCTL_H */
diff --git a/bsd-user/bsd-proc.h b/bsd-user/bsd-proc.h
index 8b1c2deea3..8b7bd492ba 100644
--- a/bsd-user/bsd-proc.h
+++ b/bsd-user/bsd-proc.h
@@ -17,8 +17,8 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef BSD_PROC_H_
-#define BSD_PROC_H_
+#ifndef BSD_PROC_H
+#define BSD_PROC_H
#include <sys/resource.h>
@@ -411,4 +411,4 @@ static inline abi_long do_bsd_setpriority(abi_long which, abi_long who,
return get_errno(setpriority(which, who, prio));
}
-#endif /* !BSD_PROC_H_ */
+#endif /* BSD_PROC_H */
diff --git a/hw/net/igb_regs.h b/hw/net/igb_regs.h
index 4dc4c31da2..3b135feef2 100644
--- a/hw/net/igb_regs.h
+++ b/hw/net/igb_regs.h
@@ -4,8 +4,8 @@
* drivers/net/ethernet/intel/igb
*/
-#ifndef HW_IGB_REGS_H_
-#define HW_IGB_REGS_H_
+#ifndef HW_IGB_REGS_H
+#define HW_IGB_REGS_H
#include "e1000x_regs.h"
diff --git a/include/exec/target_long.h b/include/exec/target_long.h
index 3cd8e26a23..db335ebb0b 100644
--- a/include/exec/target_long.h
+++ b/include/exec/target_long.h
@@ -7,8 +7,8 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
-#ifndef _TARGET_LONG_H_
-#define _TARGET_LONG_H_
+#ifndef TARGET_LONG_H
+#define TARGET_LONG_H
/*
* Usually this should only be included via cpu-defs.h however for
@@ -41,4 +41,4 @@ typedef uint64_t target_ulong;
#error TARGET_LONG_SIZE undefined
#endif
-#endif /* _TARGET_LONG_H_ */
+#endif /* TARGET_LONG_H */
diff --git a/include/exec/tb-flush.h b/include/exec/tb-flush.h
index e971d4ba6d..76f51094e6 100644
--- a/include/exec/tb-flush.h
+++ b/include/exec/tb-flush.h
@@ -5,8 +5,9 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
-#ifndef _TB_FLUSH_H_
-#define _TB_FLUSH_H_
+
+#ifndef TB_FLUSH_H
+#define TB_FLUSH_H
/**
* tb_flush__exclusive_or_serial()
@@ -35,4 +36,4 @@ void queue_tb_flush(CPUState *cs);
void tcg_flush_jmp_cache(CPUState *cs);
-#endif /* _TB_FLUSH_H_ */
+#endif /* TB_FLUSH_H */
diff --git a/include/gdbstub/helpers.h b/include/gdbstub/helpers.h
index 197592036b..806195458f 100644
--- a/include/gdbstub/helpers.h
+++ b/include/gdbstub/helpers.h
@@ -9,8 +9,8 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
-#ifndef _GDBSTUB_HELPERS_H_
-#define _GDBSTUB_HELPERS_H_
+#ifndef GDBSTUB_HELPERS_H
+#define GDBSTUB_HELPERS_H
#include "qemu/bswap.h"
#include "qemu/target-info.h"
@@ -115,4 +115,4 @@ static inline uint8_t *gdb_get_reg_ptr(GByteArray *buf, int len)
#endif
#endif /* COMPILING_PER_TARGET */
-#endif /* _GDBSTUB_HELPERS_H_ */
+#endif /* GDBSTUB_HELPERS_H */
diff --git a/include/gdbstub/syscalls.h b/include/gdbstub/syscalls.h
index d63228e96b..070b165b42 100644
--- a/include/gdbstub/syscalls.h
+++ b/include/gdbstub/syscalls.h
@@ -6,8 +6,8 @@
* SPDX-License-Identifier: LGPL-2.0-or-later
*/
-#ifndef _SYSCALLS_H_
-#define _SYSCALLS_H_
+#ifndef SYSCALLS_H
+#define SYSCALLS_H
/* For gdb file i/o remote protocol open flags. */
#define GDB_O_RDONLY 0
@@ -119,4 +119,4 @@ void gdb_exit(int code);
*/
void gdb_qemu_exit(int code);
-#endif /* _SYSCALLS_H_ */
+#endif /* SYSCALLS_H */
diff --git a/include/hw/arm/raspberrypi-fw-defs.h b/include/hw/arm/raspberrypi-fw-defs.h
index 60b8e5b451..906de53379 100644
--- a/include/hw/arm/raspberrypi-fw-defs.h
+++ b/include/hw/arm/raspberrypi-fw-defs.h
@@ -7,9 +7,8 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
-#ifndef INCLUDE_HW_MISC_RASPBERRYPI_FW_DEFS_H_
-#define INCLUDE_HW_MISC_RASPBERRYPI_FW_DEFS_H_
-
+#ifndef INCLUDE_HW_MISC_RASPBERRYPI_FW_DEFS_H
+#define INCLUDE_HW_MISC_RASPBERRYPI_FW_DEFS_H
enum rpi_firmware_property_tag {
RPI_FWREQ_PROPERTY_END = 0,
@@ -172,4 +171,4 @@ typedef struct rpi_firmware_prop_request {
uint8_t payload[0];
} rpi_firmware_prop_request_t;
-#endif /* INCLUDE_HW_MISC_RASPBERRYPI_FW_DEFS_H_ */
+#endif /* INCLUDE_HW_MISC_RASPBERRYPI_FW_DEFS_H */
diff --git a/include/hw/arm/stm32l4x5_soc.h b/include/hw/arm/stm32l4x5_soc.h
index 9c3d662bca..cc61d582cb 100644
--- a/include/hw/arm/stm32l4x5_soc.h
+++ b/include/hw/arm/stm32l4x5_soc.h
@@ -21,8 +21,8 @@
* https://www.st.com/en/microcontrollers-microprocessors/stm32l4x5/documentation.html
*/
-#ifndef HW_ARM_STM32L4x5_SOC_H
-#define HW_ARM_STM32L4x5_SOC_H
+#ifndef HW_ARM_STM32L4X5_SOC_H
+#define HW_ARM_STM32L4X5_SOC_H
#include "system/memory.h"
#include "hw/arm/armv7m.h"
diff --git a/include/hw/gpio/pcf8574.h b/include/hw/gpio/pcf8574.h
index 3291d7dbbc..9f46cf7167 100644
--- a/include/hw/gpio/pcf8574.h
+++ b/include/hw/gpio/pcf8574.h
@@ -7,9 +7,9 @@
* Written by Dmitrii Sharikhin <d.sharikhin@yadro.com>
*/
-#ifndef _HW_GPIO_PCF8574
-#define _HW_GPIO_PCF8574
+#ifndef HW_GPIO_PCF8574_H
+#define HW_GPIO_PCF8574_H
#define TYPE_PCF8574 "pcf8574"
-#endif /* _HW_GPIO_PCF8574 */
+#endif /* HW_GPIO_PCF8574_H */
diff --git a/include/hw/virtio/vhost-user-gpio.h b/include/hw/virtio/vhost-user-gpio.h
index 5814a8400a..4e50f45066 100644
--- a/include/hw/virtio/vhost-user-gpio.h
+++ b/include/hw/virtio/vhost-user-gpio.h
@@ -6,8 +6,8 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
-#ifndef _QEMU_VHOST_USER_GPIO_H
-#define _QEMU_VHOST_USER_GPIO_H
+#ifndef QEMU_VHOST_USER_GPIO_H
+#define QEMU_VHOST_USER_GPIO_H
#include "hw/virtio/virtio.h"
#include "hw/virtio/vhost.h"
@@ -21,4 +21,4 @@ struct VHostUserGPIO {
VHostUserBase parent_obj;
};
-#endif /* _QEMU_VHOST_USER_GPIO_H */
+#endif /* QEMU_VHOST_USER_GPIO_H */
diff --git a/include/hw/virtio/vhost-user-scmi.h b/include/hw/virtio/vhost-user-scmi.h
index 30ab0d7ab7..47bdde17ca 100644
--- a/include/hw/virtio/vhost-user-scmi.h
+++ b/include/hw/virtio/vhost-user-scmi.h
@@ -6,8 +6,8 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
-#ifndef _QEMU_VHOST_USER_SCMI_H
-#define _QEMU_VHOST_USER_SCMI_H
+#ifndef QEMU_VHOST_USER_SCMI_H
+#define QEMU_VHOST_USER_SCMI_H
#include "hw/virtio/virtio.h"
#include "hw/virtio/vhost.h"
@@ -28,4 +28,4 @@ struct VHostUserSCMI {
bool started_vu;
};
-#endif /* _QEMU_VHOST_USER_SCMI_H */
+#endif /* QEMU_VHOST_USER_SCMI_H */
diff --git a/include/hw/xen/xen-pvh-common.h b/include/hw/xen/xen-pvh-common.h
index 0ed07c5694..a1ec505518 100644
--- a/include/hw/xen/xen-pvh-common.h
+++ b/include/hw/xen/xen-pvh-common.h
@@ -6,8 +6,8 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
-#ifndef XEN_PVH_COMMON_H__
-#define XEN_PVH_COMMON_H__
+#ifndef XEN_PVH_COMMON_H
+#define XEN_PVH_COMMON_H
#include "system/memory.h"
#include "qom/object.h"
diff --git a/include/tcg/insn-start-words.h b/include/tcg/insn-start-words.h
index c52aec50a7..c2921c24bc 100644
--- a/include/tcg/insn-start-words.h
+++ b/include/tcg/insn-start-words.h
@@ -4,9 +4,9 @@
* Copyright (c) 2008 Fabrice Bellard
*/
-#ifndef TCG_INSN_START_WORDS
-#define TCG_INSN_START_WORDS
+#ifndef TCG_INSN_START_WORDS_H
+#define TCG_INSN_START_WORDS_H
#define INSN_START_WORDS 3
-#endif /* TCG_INSN_START_WORDS */
+#endif /* TCG_INSN_START_WORDS_H */
diff --git a/qga/cutils.h b/qga/cutils.h
index c1f2f4b17a..e6c73c8d83 100644
--- a/qga/cutils.h
+++ b/qga/cutils.h
@@ -1,6 +1,6 @@
-#ifndef CUTILS_H_
-#define CUTILS_H_
+#ifndef CUTILS_H
+#define CUTILS_H
int qga_open_cloexec(const char *name, int flags, mode_t mode);
-#endif /* CUTILS_H_ */
+#endif /* CUTILS_H */
--
2.52.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH 3/5] Clean up ill-advised or unusual header guards
2026-01-19 10:05 ` [PATCH 3/5] Clean up ill-advised or unusual header guards Markus Armbruster
@ 2026-01-19 10:35 ` Daniel P. Berrangé
2026-01-19 15:09 ` Warner Losh
1 sibling, 0 replies; 13+ messages in thread
From: Daniel P. Berrangé @ 2026-01-19 10:35 UTC (permalink / raw)
To: Markus Armbruster; +Cc: qemu-devel
On Mon, Jan 19, 2026 at 11:05:35AM +0100, Markus Armbruster wrote:
> Leading underscores are ill-advised because such identifiers are
> reserved. Trailing underscores are merely ugly. Strip both.
>
> Our header guards commonly end in _H. Normalize the exceptions.
>
> Macros should be ALL_CAPS. Normalize the exception.
>
> Done with scripts/clean-header-guards.pl.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> backends/tpm/tpm_ioctl.h | 7 ++++---
> bsd-user/bsd-proc.h | 6 +++---
> hw/net/igb_regs.h | 4 ++--
> include/exec/target_long.h | 6 +++---
> include/exec/tb-flush.h | 7 ++++---
> include/gdbstub/helpers.h | 6 +++---
> include/gdbstub/syscalls.h | 6 +++---
> include/hw/arm/raspberrypi-fw-defs.h | 7 +++----
> include/hw/arm/stm32l4x5_soc.h | 4 ++--
> include/hw/gpio/pcf8574.h | 6 +++---
> include/hw/virtio/vhost-user-gpio.h | 6 +++---
> include/hw/virtio/vhost-user-scmi.h | 6 +++---
> include/hw/xen/xen-pvh-common.h | 4 ++--
> include/tcg/insn-start-words.h | 6 +++---
> qga/cutils.h | 6 +++---
> 15 files changed, 44 insertions(+), 43 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
With regards,
Daniel
--
|: 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 :|
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/5] Clean up ill-advised or unusual header guards
2026-01-19 10:05 ` [PATCH 3/5] Clean up ill-advised or unusual header guards Markus Armbruster
2026-01-19 10:35 ` Daniel P. Berrangé
@ 2026-01-19 15:09 ` Warner Losh
1 sibling, 0 replies; 13+ messages in thread
From: Warner Losh @ 2026-01-19 15:09 UTC (permalink / raw)
To: Markus Armbruster; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 10163 bytes --]
The bsd-user header
Reviewed-by: Warner Losh. <imp@bsdimp.com>
Seems like needless churn, though. Better to use #pragma once
everywhere instead. There's no varadic include files in the tree as
far as I recall...
Warner
On Mon, Jan 19, 2026 at 3:07 AM Markus Armbruster <armbru@redhat.com> wrote:
> Leading underscores are ill-advised because such identifiers are
> reserved. Trailing underscores are merely ugly. Strip both.
>
> Our header guards commonly end in _H. Normalize the exceptions.
>
> Macros should be ALL_CAPS. Normalize the exception.
>
> Done with scripts/clean-header-guards.pl.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> backends/tpm/tpm_ioctl.h | 7 ++++---
> bsd-user/bsd-proc.h | 6 +++---
> hw/net/igb_regs.h | 4 ++--
> include/exec/target_long.h | 6 +++---
> include/exec/tb-flush.h | 7 ++++---
> include/gdbstub/helpers.h | 6 +++---
> include/gdbstub/syscalls.h | 6 +++---
> include/hw/arm/raspberrypi-fw-defs.h | 7 +++----
> include/hw/arm/stm32l4x5_soc.h | 4 ++--
> include/hw/gpio/pcf8574.h | 6 +++---
> include/hw/virtio/vhost-user-gpio.h | 6 +++---
> include/hw/virtio/vhost-user-scmi.h | 6 +++---
> include/hw/xen/xen-pvh-common.h | 4 ++--
> include/tcg/insn-start-words.h | 6 +++---
> qga/cutils.h | 6 +++---
> 15 files changed, 44 insertions(+), 43 deletions(-)
>
> diff --git a/backends/tpm/tpm_ioctl.h b/backends/tpm/tpm_ioctl.h
> index ee2dd15d35..e1e858c4bc 100644
> --- a/backends/tpm/tpm_ioctl.h
> +++ b/backends/tpm/tpm_ioctl.h
> @@ -5,8 +5,9 @@
> *
> * This file is licensed under the terms of the 3-clause BSD license
> */
> -#ifndef _TPM_IOCTL_H_
> -#define _TPM_IOCTL_H_
> +
> +#ifndef TPM_IOCTL_H
> +#define TPM_IOCTL_H
>
> #if defined(__CYGWIN__)
> # define __USE_LINUX_IOCTL_DEFS
> @@ -341,4 +342,4 @@ enum {
> CMD_LOCK_STORAGE, /* 0x13 */
> };
>
> -#endif /* _TPM_IOCTL_H_ */
> +#endif /* TPM_IOCTL_H */
> diff --git a/bsd-user/bsd-proc.h b/bsd-user/bsd-proc.h
> index 8b1c2deea3..8b7bd492ba 100644
> --- a/bsd-user/bsd-proc.h
> +++ b/bsd-user/bsd-proc.h
> @@ -17,8 +17,8 @@
> * along with this program; if not, see <http://www.gnu.org/licenses/>.
> */
>
> -#ifndef BSD_PROC_H_
> -#define BSD_PROC_H_
> +#ifndef BSD_PROC_H
> +#define BSD_PROC_H
>
> #include <sys/resource.h>
>
> @@ -411,4 +411,4 @@ static inline abi_long do_bsd_setpriority(abi_long
> which, abi_long who,
> return get_errno(setpriority(which, who, prio));
> }
>
> -#endif /* !BSD_PROC_H_ */
> +#endif /* BSD_PROC_H */
> diff --git a/hw/net/igb_regs.h b/hw/net/igb_regs.h
> index 4dc4c31da2..3b135feef2 100644
> --- a/hw/net/igb_regs.h
> +++ b/hw/net/igb_regs.h
> @@ -4,8 +4,8 @@
> * drivers/net/ethernet/intel/igb
> */
>
> -#ifndef HW_IGB_REGS_H_
> -#define HW_IGB_REGS_H_
> +#ifndef HW_IGB_REGS_H
> +#define HW_IGB_REGS_H
>
> #include "e1000x_regs.h"
>
> diff --git a/include/exec/target_long.h b/include/exec/target_long.h
> index 3cd8e26a23..db335ebb0b 100644
> --- a/include/exec/target_long.h
> +++ b/include/exec/target_long.h
> @@ -7,8 +7,8 @@
> * SPDX-License-Identifier: GPL-2.0-or-later
> */
>
> -#ifndef _TARGET_LONG_H_
> -#define _TARGET_LONG_H_
> +#ifndef TARGET_LONG_H
> +#define TARGET_LONG_H
>
> /*
> * Usually this should only be included via cpu-defs.h however for
> @@ -41,4 +41,4 @@ typedef uint64_t target_ulong;
> #error TARGET_LONG_SIZE undefined
> #endif
>
> -#endif /* _TARGET_LONG_H_ */
> +#endif /* TARGET_LONG_H */
> diff --git a/include/exec/tb-flush.h b/include/exec/tb-flush.h
> index e971d4ba6d..76f51094e6 100644
> --- a/include/exec/tb-flush.h
> +++ b/include/exec/tb-flush.h
> @@ -5,8 +5,9 @@
> *
> * SPDX-License-Identifier: GPL-2.0-or-later
> */
> -#ifndef _TB_FLUSH_H_
> -#define _TB_FLUSH_H_
> +
> +#ifndef TB_FLUSH_H
> +#define TB_FLUSH_H
>
> /**
> * tb_flush__exclusive_or_serial()
> @@ -35,4 +36,4 @@ void queue_tb_flush(CPUState *cs);
>
> void tcg_flush_jmp_cache(CPUState *cs);
>
> -#endif /* _TB_FLUSH_H_ */
> +#endif /* TB_FLUSH_H */
> diff --git a/include/gdbstub/helpers.h b/include/gdbstub/helpers.h
> index 197592036b..806195458f 100644
> --- a/include/gdbstub/helpers.h
> +++ b/include/gdbstub/helpers.h
> @@ -9,8 +9,8 @@
> * SPDX-License-Identifier: GPL-2.0-or-later
> */
>
> -#ifndef _GDBSTUB_HELPERS_H_
> -#define _GDBSTUB_HELPERS_H_
> +#ifndef GDBSTUB_HELPERS_H
> +#define GDBSTUB_HELPERS_H
>
> #include "qemu/bswap.h"
> #include "qemu/target-info.h"
> @@ -115,4 +115,4 @@ static inline uint8_t *gdb_get_reg_ptr(GByteArray
> *buf, int len)
> #endif
> #endif /* COMPILING_PER_TARGET */
>
> -#endif /* _GDBSTUB_HELPERS_H_ */
> +#endif /* GDBSTUB_HELPERS_H */
> diff --git a/include/gdbstub/syscalls.h b/include/gdbstub/syscalls.h
> index d63228e96b..070b165b42 100644
> --- a/include/gdbstub/syscalls.h
> +++ b/include/gdbstub/syscalls.h
> @@ -6,8 +6,8 @@
> * SPDX-License-Identifier: LGPL-2.0-or-later
> */
>
> -#ifndef _SYSCALLS_H_
> -#define _SYSCALLS_H_
> +#ifndef SYSCALLS_H
> +#define SYSCALLS_H
>
> /* For gdb file i/o remote protocol open flags. */
> #define GDB_O_RDONLY 0
> @@ -119,4 +119,4 @@ void gdb_exit(int code);
> */
> void gdb_qemu_exit(int code);
>
> -#endif /* _SYSCALLS_H_ */
> +#endif /* SYSCALLS_H */
> diff --git a/include/hw/arm/raspberrypi-fw-defs.h
> b/include/hw/arm/raspberrypi-fw-defs.h
> index 60b8e5b451..906de53379 100644
> --- a/include/hw/arm/raspberrypi-fw-defs.h
> +++ b/include/hw/arm/raspberrypi-fw-defs.h
> @@ -7,9 +7,8 @@
> * SPDX-License-Identifier: GPL-2.0-or-later
> */
>
> -#ifndef INCLUDE_HW_MISC_RASPBERRYPI_FW_DEFS_H_
> -#define INCLUDE_HW_MISC_RASPBERRYPI_FW_DEFS_H_
> -
> +#ifndef INCLUDE_HW_MISC_RASPBERRYPI_FW_DEFS_H
> +#define INCLUDE_HW_MISC_RASPBERRYPI_FW_DEFS_H
>
> enum rpi_firmware_property_tag {
> RPI_FWREQ_PROPERTY_END = 0,
> @@ -172,4 +171,4 @@ typedef struct rpi_firmware_prop_request {
> uint8_t payload[0];
> } rpi_firmware_prop_request_t;
>
> -#endif /* INCLUDE_HW_MISC_RASPBERRYPI_FW_DEFS_H_ */
> +#endif /* INCLUDE_HW_MISC_RASPBERRYPI_FW_DEFS_H */
> diff --git a/include/hw/arm/stm32l4x5_soc.h
> b/include/hw/arm/stm32l4x5_soc.h
> index 9c3d662bca..cc61d582cb 100644
> --- a/include/hw/arm/stm32l4x5_soc.h
> +++ b/include/hw/arm/stm32l4x5_soc.h
> @@ -21,8 +21,8 @@
> *
> https://www.st.com/en/microcontrollers-microprocessors/stm32l4x5/documentation.html
> */
>
> -#ifndef HW_ARM_STM32L4x5_SOC_H
> -#define HW_ARM_STM32L4x5_SOC_H
> +#ifndef HW_ARM_STM32L4X5_SOC_H
> +#define HW_ARM_STM32L4X5_SOC_H
>
> #include "system/memory.h"
> #include "hw/arm/armv7m.h"
> diff --git a/include/hw/gpio/pcf8574.h b/include/hw/gpio/pcf8574.h
> index 3291d7dbbc..9f46cf7167 100644
> --- a/include/hw/gpio/pcf8574.h
> +++ b/include/hw/gpio/pcf8574.h
> @@ -7,9 +7,9 @@
> * Written by Dmitrii Sharikhin <d.sharikhin@yadro.com>
> */
>
> -#ifndef _HW_GPIO_PCF8574
> -#define _HW_GPIO_PCF8574
> +#ifndef HW_GPIO_PCF8574_H
> +#define HW_GPIO_PCF8574_H
>
> #define TYPE_PCF8574 "pcf8574"
>
> -#endif /* _HW_GPIO_PCF8574 */
> +#endif /* HW_GPIO_PCF8574_H */
> diff --git a/include/hw/virtio/vhost-user-gpio.h
> b/include/hw/virtio/vhost-user-gpio.h
> index 5814a8400a..4e50f45066 100644
> --- a/include/hw/virtio/vhost-user-gpio.h
> +++ b/include/hw/virtio/vhost-user-gpio.h
> @@ -6,8 +6,8 @@
> * SPDX-License-Identifier: GPL-2.0-or-later
> */
>
> -#ifndef _QEMU_VHOST_USER_GPIO_H
> -#define _QEMU_VHOST_USER_GPIO_H
> +#ifndef QEMU_VHOST_USER_GPIO_H
> +#define QEMU_VHOST_USER_GPIO_H
>
> #include "hw/virtio/virtio.h"
> #include "hw/virtio/vhost.h"
> @@ -21,4 +21,4 @@ struct VHostUserGPIO {
> VHostUserBase parent_obj;
> };
>
> -#endif /* _QEMU_VHOST_USER_GPIO_H */
> +#endif /* QEMU_VHOST_USER_GPIO_H */
> diff --git a/include/hw/virtio/vhost-user-scmi.h
> b/include/hw/virtio/vhost-user-scmi.h
> index 30ab0d7ab7..47bdde17ca 100644
> --- a/include/hw/virtio/vhost-user-scmi.h
> +++ b/include/hw/virtio/vhost-user-scmi.h
> @@ -6,8 +6,8 @@
> * SPDX-License-Identifier: GPL-2.0-or-later
> */
>
> -#ifndef _QEMU_VHOST_USER_SCMI_H
> -#define _QEMU_VHOST_USER_SCMI_H
> +#ifndef QEMU_VHOST_USER_SCMI_H
> +#define QEMU_VHOST_USER_SCMI_H
>
> #include "hw/virtio/virtio.h"
> #include "hw/virtio/vhost.h"
> @@ -28,4 +28,4 @@ struct VHostUserSCMI {
> bool started_vu;
> };
>
> -#endif /* _QEMU_VHOST_USER_SCMI_H */
> +#endif /* QEMU_VHOST_USER_SCMI_H */
> diff --git a/include/hw/xen/xen-pvh-common.h
> b/include/hw/xen/xen-pvh-common.h
> index 0ed07c5694..a1ec505518 100644
> --- a/include/hw/xen/xen-pvh-common.h
> +++ b/include/hw/xen/xen-pvh-common.h
> @@ -6,8 +6,8 @@
> * SPDX-License-Identifier: GPL-2.0-or-later
> */
>
> -#ifndef XEN_PVH_COMMON_H__
> -#define XEN_PVH_COMMON_H__
> +#ifndef XEN_PVH_COMMON_H
> +#define XEN_PVH_COMMON_H
>
> #include "system/memory.h"
> #include "qom/object.h"
> diff --git a/include/tcg/insn-start-words.h
> b/include/tcg/insn-start-words.h
> index c52aec50a7..c2921c24bc 100644
> --- a/include/tcg/insn-start-words.h
> +++ b/include/tcg/insn-start-words.h
> @@ -4,9 +4,9 @@
> * Copyright (c) 2008 Fabrice Bellard
> */
>
> -#ifndef TCG_INSN_START_WORDS
> -#define TCG_INSN_START_WORDS
> +#ifndef TCG_INSN_START_WORDS_H
> +#define TCG_INSN_START_WORDS_H
>
> #define INSN_START_WORDS 3
>
> -#endif /* TCG_INSN_START_WORDS */
> +#endif /* TCG_INSN_START_WORDS_H */
> diff --git a/qga/cutils.h b/qga/cutils.h
> index c1f2f4b17a..e6c73c8d83 100644
> --- a/qga/cutils.h
> +++ b/qga/cutils.h
> @@ -1,6 +1,6 @@
> -#ifndef CUTILS_H_
> -#define CUTILS_H_
> +#ifndef CUTILS_H
> +#define CUTILS_H
>
> int qga_open_cloexec(const char *name, int flags, mode_t mode);
>
> -#endif /* CUTILS_H_ */
> +#endif /* CUTILS_H */
> --
> 2.52.0
>
>
>
[-- Attachment #2: Type: text/html, Size: 11993 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 4/5] Normalize header guard symbol definition
2026-01-19 10:05 [PATCH 0/5] Clean up header guards again Markus Armbruster
` (2 preceding siblings ...)
2026-01-19 10:05 ` [PATCH 3/5] Clean up ill-advised or unusual header guards Markus Armbruster
@ 2026-01-19 10:05 ` Markus Armbruster
2026-01-19 10:35 ` Daniel P. Berrangé
2026-01-19 10:05 ` [PATCH 5/5] Clean up decorations and whitespace around header guards Markus Armbruster
2026-01-19 10:46 ` [PATCH 0/5] Clean up header guards again Daniel P. Berrangé
5 siblings, 1 reply; 13+ messages in thread
From: Markus Armbruster @ 2026-01-19 10:05 UTC (permalink / raw)
To: qemu-devel
We commonly define the header guard symbol without an explicit value.
Normalize the exceptions.
Done with scripts/clean-header-guards.pl.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
include/exec/tlb-common.h | 3 ++-
include/hw/misc/xlnx-cfi-if.h | 3 ++-
include/qemu/mem-reentrancy.h | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/include/exec/tlb-common.h b/include/exec/tlb-common.h
index 03b5a8ffc7..1bfc278d69 100644
--- a/include/exec/tlb-common.h
+++ b/include/exec/tlb-common.h
@@ -16,8 +16,9 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef EXEC_TLB_COMMON_H
-#define EXEC_TLB_COMMON_H 1
+#define EXEC_TLB_COMMON_H
#define CPU_TLB_ENTRY_BITS (HOST_LONG_BITS == 32 ? 4 : 5)
diff --git a/include/hw/misc/xlnx-cfi-if.h b/include/hw/misc/xlnx-cfi-if.h
index 5010401517..b1012beb4d 100644
--- a/include/hw/misc/xlnx-cfi-if.h
+++ b/include/hw/misc/xlnx-cfi-if.h
@@ -7,8 +7,9 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
+
#ifndef XLNX_CFI_IF_H
-#define XLNX_CFI_IF_H 1
+#define XLNX_CFI_IF_H
#include "qemu/help-texts.h"
#include "qom/object.h"
diff --git a/include/qemu/mem-reentrancy.h b/include/qemu/mem-reentrancy.h
index 07cafd4717..86e377c0c0 100644
--- a/include/qemu/mem-reentrancy.h
+++ b/include/qemu/mem-reentrancy.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef QEMU_MEM_REENTRANCY_H
-#define QEMU_MEM_REENTRANCY_H 1
+#define QEMU_MEM_REENTRANCY_H
typedef struct MemReentrancyGuard {
bool engaged_in_io;
--
2.52.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 5/5] Clean up decorations and whitespace around header guards
2026-01-19 10:05 [PATCH 0/5] Clean up header guards again Markus Armbruster
` (3 preceding siblings ...)
2026-01-19 10:05 ` [PATCH 4/5] Normalize header guard symbol definition Markus Armbruster
@ 2026-01-19 10:05 ` Markus Armbruster
2026-01-19 10:36 ` Daniel P. Berrangé
2026-01-19 10:46 ` [PATCH 0/5] Clean up header guards again Daniel P. Berrangé
5 siblings, 1 reply; 13+ messages in thread
From: Markus Armbruster @ 2026-01-19 10:05 UTC (permalink / raw)
To: qemu-devel
Cleaned up with scripts/clean-header-guards.pl.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
crypto/akcipherpriv.h | 2 +-
crypto/der.h | 2 +-
hw/net/e1000x_regs.h | 2 +-
hw/riscv/riscv-iommu-bits.h | 2 +-
include/accel/accel-cpu-target.h | 2 +-
include/exec/tswap.h | 2 +-
include/hw/char/max78000_uart.h | 2 +-
include/hw/fsi/fsi-master.h | 3 ++-
include/hw/intc/loongarch_extioi_common.h | 2 +-
include/hw/intc/loongarch_pic_common.h | 2 +-
include/hw/misc/allwinner-a10-ccm.h | 2 +-
include/hw/ppc/pnv_n1_chiplet.h | 2 +-
include/semihosting/uaccess.h | 2 +-
include/system/ioport.h | 2 +-
include/tcg/tcg-temp-internal.h | 2 +-
target/hexagon/idef-parser/parser-helpers.h | 2 +-
target/i386/kvm/xen-compat.h | 2 +-
target/loongarch/cpu-mmu.h | 2 +-
target/loongarch/tcg/tcg_loongarch.h | 4 +++-
target/riscv/cpu_vendorid.h | 2 +-
20 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/crypto/akcipherpriv.h b/crypto/akcipherpriv.h
index 3b33e54f08..09db61f120 100644
--- a/crypto/akcipherpriv.h
+++ b/crypto/akcipherpriv.h
@@ -52,4 +52,4 @@ struct QCryptoAkCipherDriver {
void (*free)(QCryptoAkCipher *akcipher);
};
-#endif /* QCRYPTO_AKCIPHER_H */
+#endif /* QCRYPTO_AKCIPHERPRIV_H */
diff --git a/crypto/der.h b/crypto/der.h
index bcfa4a2495..99275012c6 100644
--- a/crypto/der.h
+++ b/crypto/der.h
@@ -261,4 +261,4 @@ size_t qcrypto_der_encode_ctx_buffer_len(QCryptoEncodeContext *ctx);
void qcrypto_der_encode_ctx_flush_and_free(QCryptoEncodeContext *ctx,
uint8_t *dst);
-#endif /* QCRYPTO_ASN1_DECODER_H */
+#endif /* QCRYPTO_ASN1_DECODER_H */
diff --git a/hw/net/e1000x_regs.h b/hw/net/e1000x_regs.h
index e9a74de6f4..971653e9b2 100644
--- a/hw/net/e1000x_regs.h
+++ b/hw/net/e1000x_regs.h
@@ -968,4 +968,4 @@ struct e1000_context_desc {
#define E1000_VFTA_ENTRY_MASK 0x7F
#define E1000_VFTA_ENTRY_BIT_SHIFT_MASK 0x1F
-#endif /* HW_E1000_REGS_H */
+#endif /* HW_E1000X_REGS_H */
diff --git a/hw/riscv/riscv-iommu-bits.h b/hw/riscv/riscv-iommu-bits.h
index 47fe01bee5..685f9af4e0 100644
--- a/hw/riscv/riscv-iommu-bits.h
+++ b/hw/riscv/riscv-iommu-bits.h
@@ -466,4 +466,4 @@ struct riscv_iommu_msi_pte {
#define RISCV_IOMMU_MSI_MRIF_NPPN RISCV_IOMMU_PPN_FIELD
#define RISCV_IOMMU_MSI_MRIF_NID_MSB BIT_ULL(60)
-#endif /* _RISCV_IOMMU_BITS_H_ */
+#endif /* HW_RISCV_IOMMU_BITS_H */
diff --git a/include/accel/accel-cpu-target.h b/include/accel/accel-cpu-target.h
index 6feb344e29..4ac85ddf74 100644
--- a/include/accel/accel-cpu-target.h
+++ b/include/accel/accel-cpu-target.h
@@ -28,4 +28,4 @@
#define ACCEL_CPU_NAME(name) (name "-" TYPE_ACCEL_CPU)
DECLARE_CLASS_CHECKERS(AccelCPUClass, ACCEL_CPU, TYPE_ACCEL_CPU)
-#endif /* ACCEL_CPU_H */
+#endif /* ACCEL_CPU_TARGET_H */
diff --git a/include/exec/tswap.h b/include/exec/tswap.h
index 72219e2c43..31c7d3d40b 100644
--- a/include/exec/tswap.h
+++ b/include/exec/tswap.h
@@ -69,4 +69,4 @@ static inline void tswap64s(uint64_t *s)
}
}
-#endif /* TSWAP_H */
+#endif /* TSWAP_H */
diff --git a/include/hw/char/max78000_uart.h b/include/hw/char/max78000_uart.h
index 6977c7b3f1..bef42f5078 100644
--- a/include/hw/char/max78000_uart.h
+++ b/include/hw/char/max78000_uart.h
@@ -75,4 +75,4 @@ struct Max78000UartState {
CharFrontend chr;
qemu_irq irq;
};
-#endif /* HW_STM32F2XX_USART_H */
+#endif /* HW_MAX78000_UART_H */
diff --git a/include/hw/fsi/fsi-master.h b/include/hw/fsi/fsi-master.h
index 60ddaa994f..193f6e0fde 100644
--- a/include/hw/fsi/fsi-master.h
+++ b/include/hw/fsi/fsi-master.h
@@ -4,6 +4,7 @@
*
* IBM Flexible Service Interface Master
*/
+
#ifndef FSI_FSI_MASTER_H
#define FSI_FSI_MASTER_H
@@ -29,4 +30,4 @@ typedef struct FSIMasterState {
} FSIMasterState;
-#endif /* FSI_FSI_H */
+#endif /* FSI_FSI_MASTER_H */
diff --git a/include/hw/intc/loongarch_extioi_common.h b/include/hw/intc/loongarch_extioi_common.h
index 2dbc2563eb..878e0a4586 100644
--- a/include/hw/intc/loongarch_extioi_common.h
+++ b/include/hw/intc/loongarch_extioi_common.h
@@ -100,4 +100,4 @@ struct LoongArchExtIOICommonClass {
int (*pre_save)(void *s);
int (*post_load)(void *s, int version_id);
};
-#endif /* LOONGARCH_EXTIOI_H */
+#endif /* LOONGARCH_EXTIOI_COMMON_H */
diff --git a/include/hw/intc/loongarch_pic_common.h b/include/hw/intc/loongarch_pic_common.h
index 1627ec0899..14897a6972 100644
--- a/include/hw/intc/loongarch_pic_common.h
+++ b/include/hw/intc/loongarch_pic_common.h
@@ -79,4 +79,4 @@ struct LoongArchPICCommonClass {
int (*pre_save)(LoongArchPICCommonState *s);
int (*post_load)(LoongArchPICCommonState *s, int version_id);
};
-#endif /* HW_LOONGARCH_PIC_COMMON_H */
+#endif /* HW_LOONGARCH_PIC_COMMON_H */
diff --git a/include/hw/misc/allwinner-a10-ccm.h b/include/hw/misc/allwinner-a10-ccm.h
index 109b83f4df..a80b814ce7 100644
--- a/include/hw/misc/allwinner-a10-ccm.h
+++ b/include/hw/misc/allwinner-a10-ccm.h
@@ -64,4 +64,4 @@ struct AwA10ClockCtlState {
uint32_t regs[AW_A10_CCM_REGS_NUM];
};
-#endif /* HW_MISC_ALLWINNER_H3_CCU_H */
+#endif /* HW_MISC_ALLWINNER_A10_CCM_H */
diff --git a/include/hw/ppc/pnv_n1_chiplet.h b/include/hw/ppc/pnv_n1_chiplet.h
index a7ad039668..ff563eaee1 100644
--- a/include/hw/ppc/pnv_n1_chiplet.h
+++ b/include/hw/ppc/pnv_n1_chiplet.h
@@ -29,4 +29,4 @@ typedef struct PnvN1Chiplet {
#define PNV_PB_SCOM_ES_SIZE 4
PnvPbScom es[PNV_PB_SCOM_ES_SIZE];
} PnvN1Chiplet;
-#endif /*PPC_PNV_N1_CHIPLET_H */
+#endif /* PPC_PNV_N1_CHIPLET_H */
diff --git a/include/semihosting/uaccess.h b/include/semihosting/uaccess.h
index 2093a49827..2e6f80971f 100644
--- a/include/semihosting/uaccess.h
+++ b/include/semihosting/uaccess.h
@@ -118,4 +118,4 @@ void uaccess_unlock_user(CPUArchState *env, void *p,
ssize_t uaccess_strlen_user(CPUArchState *env, vaddr addr);
#define target_strlen(p) uaccess_strlen_user(env, p)
-#endif /* SEMIHOSTING_SOFTMMU_UACCESS_H */
+#endif /* SEMIHOSTING_UACCESS_H */
diff --git a/include/system/ioport.h b/include/system/ioport.h
index 780ea5a676..6ff57039c1 100644
--- a/include/system/ioport.h
+++ b/include/system/ioport.h
@@ -72,4 +72,4 @@ void portio_list_del(PortioList *piolist);
void portio_list_set_enabled(PortioList *piolist, bool enabled);
void portio_list_set_address(PortioList *piolist, uint32_t addr);
-#endif /* IOPORT_H */
+#endif /* SYSTEM_IOPORT_H */
diff --git a/include/tcg/tcg-temp-internal.h b/include/tcg/tcg-temp-internal.h
index 98f91e68b7..b3c78e309a 100644
--- a/include/tcg/tcg-temp-internal.h
+++ b/include/tcg/tcg-temp-internal.h
@@ -48,4 +48,4 @@ static inline void tcg_temp_ebb_reset_freed(TCGContext *s)
memset(s->free_temps, 0, sizeof(s->free_temps));
}
-#endif /* TCG_TEMP_FREE_H */
+#endif /* TCG_TEMP_INTERNAL_H */
diff --git a/target/hexagon/idef-parser/parser-helpers.h b/target/hexagon/idef-parser/parser-helpers.h
index 2087d534a9..d763a3609b 100644
--- a/target/hexagon/idef-parser/parser-helpers.h
+++ b/target/hexagon/idef-parser/parser-helpers.h
@@ -350,4 +350,4 @@ void assert_signedness(Context *c,
YYLTYPE *locp,
HexSignedness signedness);
-#endif /* PARSER_HELPERS_h */
+#endif /* PARSER_HELPERS_H */
diff --git a/target/i386/kvm/xen-compat.h b/target/i386/kvm/xen-compat.h
index 7f30180cc2..9f46eb2aa7 100644
--- a/target/i386/kvm/xen-compat.h
+++ b/target/i386/kvm/xen-compat.h
@@ -67,4 +67,4 @@ struct compat_physdev_map_pirq {
uint64_t table_base;
} __attribute__((packed));
-#endif /* QEMU_I386_XEN_COMPAT_H */
+#endif /* QEMU_I386_KVM_XEN_COMPAT_H */
diff --git a/target/loongarch/cpu-mmu.h b/target/loongarch/cpu-mmu.h
index 2259de9d36..a585cd3332 100644
--- a/target/loongarch/cpu-mmu.h
+++ b/target/loongarch/cpu-mmu.h
@@ -99,4 +99,4 @@ void get_dir_base_width(CPULoongArchState *env, uint64_t *dir_base,
uint64_t *dir_width, unsigned int level);
hwaddr loongarch_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-#endif /* LOONGARCH_CPU_MMU_H */
+#endif /* LOONGARCH_CPU_MMU_H */
diff --git a/target/loongarch/tcg/tcg_loongarch.h b/target/loongarch/tcg/tcg_loongarch.h
index 7fb627f2d6..ef6ced33a7 100644
--- a/target/loongarch/tcg/tcg_loongarch.h
+++ b/target/loongarch/tcg/tcg_loongarch.h
@@ -4,8 +4,10 @@
*
* Copyright (c) 2025 Loongson Technology Corporation Limited
*/
+
#ifndef TARGET_LOONGARCH_TCG_LOONGARCH_H
#define TARGET_LOONGARCH_TCG_LOONGARCH_H
+
#include "cpu.h"
#include "cpu-mmu.h"
@@ -20,4 +22,4 @@ TLBRet loongarch_get_addr_from_tlb(CPULoongArchState *env,
MMUContext *context,
MMUAccessType access_type, int mmu_idx);
-#endif /* TARGET_LOONGARCH_TCG_LOONGARCH_H */
+#endif /* TARGET_LOONGARCH_TCG_LOONGARCH_H */
diff --git a/target/riscv/cpu_vendorid.h b/target/riscv/cpu_vendorid.h
index f1ffc66542..d55632b73d 100644
--- a/target/riscv/cpu_vendorid.h
+++ b/target/riscv/cpu_vendorid.h
@@ -8,4 +8,4 @@
#define VEYRON_V1_MIMPID 0x111
#define VEYRON_V1_MVENDORID 0x61f
-#endif /* TARGET_RISCV_CPU_VENDORID_H */
+#endif /* TARGET_RISCV_CPU_VENDORID_H */
--
2.52.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH 0/5] Clean up header guards again
2026-01-19 10:05 [PATCH 0/5] Clean up header guards again Markus Armbruster
` (4 preceding siblings ...)
2026-01-19 10:05 ` [PATCH 5/5] Clean up decorations and whitespace around header guards Markus Armbruster
@ 2026-01-19 10:46 ` Daniel P. Berrangé
5 siblings, 0 replies; 13+ messages in thread
From: Daniel P. Berrangé @ 2026-01-19 10:46 UTC (permalink / raw)
To: Markus Armbruster; +Cc: qemu-devel
On Mon, Jan 19, 2026 at 11:05:32AM +0100, Markus Armbruster wrote:
> Our use of header guards is rather sloppy. Sloppiness there can lead
> to confusing compilation errors. This series cleans up existing
> header guards. In particular, it normalizes guard symbols to follow a
> common pattern, in the hope of making clashes less likely. It doesn't
> add new header guards. We have more than 300 headers without a
> recognizable header guard. A few of them are for multiple inclusion,
> many don't need header guards because they don't do anything but
> include, but quite a few probably should have one. Left for another
> day.
>
> Previously cleaned up in merge commit ec11dc41eec (2022), merge commit
> 01807c8b0e9 (2019), and merge commit ca3d87d4c84 (2016).
No objection to applying these fixups since you've done the work
already.
Based on the repeated cleanups, and your notes above that we still
have many problems though, can I again suggest we just adopt the
GCC/CLang extension of adding
#pragma once
at the top of every header and burn all the #ifdefs.
It is easy & cheap to verify that it is present on every single .h file,
and there are no style variations to get wrong, or closing statements to
make inconsistent.
With regards,
Daniel
--
|: 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 :|
^ permalink raw reply [flat|nested] 13+ messages in thread