On 30/1/26 18:04, Philippe Mathieu-Daudé wrote:
The C99 standard chapter §6.7.2.2 point 4 mentions:

   Each enumerated type shall be compatible with char, a signed
   integer type, or an unsigned integer type. The choice of type
   is implementation-defined, but shall be capable of representing
   the values of all the members of the enumeration.

Align with that recommendation by defining the typedef
along with the enum.

For information, building with -Werror=pedantic was reporting:

   In file included from ../../ui/kbd-state.c:10:
   include/ui/kbd-state.h:12:14: error: ISO C forbids forward references to 
'enum' types [-Werror,-Wpedantic]
      12 | typedef enum QKbdModifier QKbdModifier;
         |              ^
   ...

Reported-by: Roman Kiryanov <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
  hw/riscv/riscv-iommu-bits.h          |  4 ++--
  hw/riscv/riscv-iommu.h               |  2 --
  include/hw/misc/auxbus.h             | 11 ++++-------
  include/hw/pci/pci_device.h          |  5 ++---
  include/hw/ssi/ssi.h                 |  6 ++----
  include/hw/xen/interface/io/xenbus.h |  5 ++---
  include/io/channel.h                 | 11 ++++-------
  include/system/replay.h              | 10 ++++------
  include/ui/clipboard.h               | 15 ++++++---------
  include/ui/kbd-state.h               |  6 ++----
  pc-bios/s390-ccw/virtio.h            |  5 ++---
  tests/qtest/libqos/qgraph_internal.h | 10 ++++------
  hw/core/loader.c                     |  5 ++---
  hw/display/xlnx_dp.c                 | 11 ++++-------
  hw/dma/xlnx_dpdma.c                  | 10 ++++------
  qapi/opts-visitor.c                  |  7 ++-----
  qapi/string-output-visitor.c         |  6 ++----
  tests/unit/check-qom-proplist.c      |  6 ++----
  18 files changed, 50 insertions(+), 85 deletions(-)


diff --git a/include/ui/clipboard.h b/include/ui/clipboard.h
index 62a96ce9ff5..84b7d6c54a4 100644
--- a/include/ui/clipboard.h
+++ b/include/ui/clipboard.h
@@ -20,9 +20,6 @@
   * is supported for now.
   */
-typedef enum QemuClipboardType QemuClipboardType;
-typedef enum QemuClipboardNotifyType QemuClipboardNotifyType;
-typedef enum QemuClipboardSelection QemuClipboardSelection;
  typedef struct QemuClipboardPeer QemuClipboardPeer;
  typedef struct QemuClipboardNotify QemuClipboardNotify;
  typedef struct QemuClipboardInfo QemuClipboardInfo;
@@ -36,10 +33,10 @@ extern const VMStateDescription vmstate_cbinfo;
   * @QEMU_CLIPBOARD_TYPE_TEXT: text/plain; charset=utf-8
   * @QEMU_CLIPBOARD_TYPE__COUNT: type count.
   */
-enum QemuClipboardType {
+typedef enum QemuClipboardType {
      QEMU_CLIPBOARD_TYPE_TEXT,
      QEMU_CLIPBOARD_TYPE__COUNT,
-};
+} QemuClipboardType;
/* same as VD_AGENT_CLIPBOARD_SELECTION_* */
  /**
@@ -50,12 +47,12 @@ enum QemuClipboardType {
   * @QEMU_CLIPBOARD_SELECTION_SECONDARY: secondary selection (dunno).
   * @QEMU_CLIPBOARD_SELECTION__COUNT: selection count.
   */
-enum QemuClipboardSelection {
+typedef enum QemuClipboardSelection {
      QEMU_CLIPBOARD_SELECTION_CLIPBOARD,
      QEMU_CLIPBOARD_SELECTION_PRIMARY,
      QEMU_CLIPBOARD_SELECTION_SECONDARY,
      QEMU_CLIPBOARD_SELECTION__COUNT,
-};
+} QemuClipboardSelection;
/**
   * struct QemuClipboardPeer
@@ -81,10 +78,10 @@ struct QemuClipboardPeer {
   *
   * Clipboard notify type.
   */
-enum QemuClipboardNotifyType {
+typedef enum QemuClipboardNotifyType {
      QEMU_CLIPBOARD_UPDATE_INFO,
      QEMU_CLIPBOARD_RESET_SERIAL,
-};
+} QemuClipboardSelection;

Oops, squashing this:

-- >8 --
diff --git a/include/ui/clipboard.h b/include/ui/clipboard.h
index 84b7d6c54a4..2704434ded9 100644
--- a/include/ui/clipboard.h
+++ b/include/ui/clipboard.h
@@ -81,7 +81,7 @@ struct QemuClipboardPeer {
 typedef enum QemuClipboardNotifyType {
     QEMU_CLIPBOARD_UPDATE_INFO,
     QEMU_CLIPBOARD_RESET_SERIAL,
-} QemuClipboardSelection;
+} QemuClipboardNotifyType;

 /**
  * struct QemuClipboardNotify
---


Reply via email to