Hi,

On 29/1/26 20:04, Roman Kiryanov wrote:
This patch fixes the C++ compilation error:

ISO C++ forbids forward references to 'enum' types

Signed-off-by: Will Hollins <[email protected]>
Signed-off-by: Roman Kiryanov <[email protected]>
---
  include/ui/kbd-state.h | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/include/ui/kbd-state.h b/include/ui/kbd-state.h
index 1f37b932eb..3522ebe51b 100644
--- a/include/ui/kbd-state.h
+++ b/include/ui/kbd-state.h
@@ -9,9 +9,7 @@
#include "qapi/qapi-types-ui.h" -typedef enum QKbdModifier QKbdModifier;
-
-enum QKbdModifier {
+typedef enum QKbdModifier {
      QKBD_MOD_NONE = 0,
QKBD_MOD_SHIFT,
@@ -23,7 +21,7 @@ enum QKbdModifier {
      QKBD_MOD_CAPSLOCK,
QKBD_MOD__MAX
-};
+} QKbdModifier;

Yes but:

$ git grep -E 'typedef enum.*;'
hw/core/loader.c:1691:typedef enum HexRecord HexRecord;
hw/display/xlnx_dp.c:259:typedef enum DPGraphicFmt DPGraphicFmt;
hw/display/xlnx_dp.c:260:typedef enum DPVideoFmt DPVideoFmt;
hw/dma/xlnx_dpdma.c:156:typedef enum DPDMABurstType DPDMABurstType;
hw/dma/xlnx_dpdma.c:157:typedef enum DPDMAMode DPDMAMode;
hw/riscv/riscv-iommu.h:28:typedef enum riscv_iommu_igs_modes riscv_iommu_igs_mode;
include/hw/misc/auxbus.h:32:typedef enum AUXCommand AUXCommand;
include/hw/misc/auxbus.h:33:typedef enum AUXReply AUXReply;
include/hw/pci/pci_device.h:52:typedef enum PCIReqIDType PCIReqIDType;
include/hw/ssi/ssi.h:19:typedef enum SSICSMode SSICSMode;
include/hw/xen/interface/io/xenbus.h:51:typedef enum xenbus_state XenbusState;
include/io/channel.h:41:typedef enum QIOChannelFeature QIOChannelFeature;
include/io/channel.h:54:typedef enum QIOChannelShutdown QIOChannelShutdown;
include/system/replay.h:29:typedef enum ReplayClockKind ReplayClockKind;
include/system/replay.h:44:typedef enum ReplayCheckpoint ReplayCheckpoint;
include/ui/clipboard.h:23:typedef enum QemuClipboardType QemuClipboardType;
include/ui/clipboard.h:24:typedef enum QemuClipboardNotifyType QemuClipboardNotifyType; include/ui/clipboard.h:25:typedef enum QemuClipboardSelection QemuClipboardSelection;
include/ui/kbd-state.h:12:typedef enum QKbdModifier QKbdModifier;
pc-bios/s390-ccw/virtio.h:31:typedef enum VirtioDevType VirtioDevType;
pc-bios/s390-ccw/virtio.h:182:typedef enum guessed_disk_nature_type VirtioGDN;
qapi/opts-visitor.c:63:typedef enum ListMode ListMode;
qapi/string-output-visitor.c:53:typedef enum ListMode ListMode;
target/s390x/gen-features.c:1175:           "typedef enum {\n");
tests/qtest/libqos/qgraph_internal.h:30:typedef enum QOSEdgeType QOSEdgeType; tests/qtest/libqos/qgraph_internal.h:31:typedef enum QOSNodeType QOSNodeType;
tests/unit/check-qom-proplist.c:43:typedef enum DummyAnimal DummyAnimal;

If we want QEMU headers to be C++ compilable, we should
1/ fix all enum forward declarations and
2/ add a CI job to ensure no more are added

Reply via email to