@samitouri / QOSamiQemu / commits / 0595136754

hw/xen/interface: Remove pre-C99 checks

We mandate a compiler supporting C99 since 2019-01-17 in commit 7be41675f7c ("configure: Force the C standard to gnu99"), thus supporting flexible array members [*]. Remove what is now dead code. [*] https://www.gnu.org/software/c-intro-and-ref/manual/html_node/Flexible-Array-Fields.html Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20260615091308.4458-2-philmd@oss.qualcomm.com>

Philippe Mathieu-Daudé committed Jun 12, 2026 at 15:00 UTC 059513675417c58f94e77a5d0941212a83dff071
4 files changed +3 -20
include/hw/xen/interface/physdev.h
+1 -1
@@ -283,7 +283,7 @@ struct physdev_pci_device_add {
283 * First element ([0]) is PXM domain associated with the device (if
284 * XEN_PCI_DEV_PXM is set)
285 */
286 - uint32_t optarr[XEN_FLEX_ARRAY_DIM];
286 + uint32_t optarr[];
287 };
288 typedef struct physdev_pci_device_add physdev_pci_device_add_t;
289 DEFINE_XEN_GUEST_HANDLE(physdev_pci_device_add_t);
include/hw/xen/interface/version.h
+2 -3
@@ -77,9 +77,8 @@ typedef char xen_commandline_t[1024];
77 */
78 #define XENVER_build_id 10
79 struct xen_build_id {
80 - uint32_t len; /* IN: size of buf[]. */
81 - unsigned char buf[XEN_FLEX_ARRAY_DIM];
82 - /* OUT: Variable length buffer with build_id. */
80 + uint32_t len; /* IN: size of buf[]. */
81 + unsigned char buf[]; /* OUT: Variable length buffer with build_id. */
82 };
83 typedef struct xen_build_id xen_build_id_t;
84
include/hw/xen/interface/xen-compat.h
-2
@@ -24,6 +24,4 @@
24 #error "These header files do not support the requested interface version."
25 #endif
26
27 -#define COMPAT_FLEX_ARRAY_DIM XEN_FLEX_ARRAY_DIM
28 -
27 #endif /* __XEN_PUBLIC_XEN_COMPAT_H__ */
include/hw/xen/interface/xen.h
-14
@@ -36,15 +36,6 @@ DEFINE_XEN_GUEST_HANDLE(uint64_t);
36 DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
37 DEFINE_XEN_GUEST_HANDLE(xen_ulong_t);
38
39 -/* Define a variable length array (depends on compiler). */
40 -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
41 -#define XEN_FLEX_ARRAY_DIM
42 -#elif defined(__GNUC__)
43 -#define XEN_FLEX_ARRAY_DIM 0
44 -#else
45 -#define XEN_FLEX_ARRAY_DIM 1 /* variable size */
46 -#endif
47 -
39 /* Turn a plain number into a C unsigned (long (long)) constant. */
40 #define __xen_mk_uint(x) x ## U
41 #define __xen_mk_ulong(x) x ## UL
@@ -986,13 +977,8 @@ typedef struct {
977 ((d) >> 8) & 0xFF, ((d) >> 0) & 0xFF, \
978 e1, e2, e3, e4, e5, e6}}
979
989 -#if defined(__STDC_VERSION__) ? __STDC_VERSION__ >= 199901L : defined(__GNUC__)
980 #define XEN_DEFINE_UUID(a, b, c, d, e1, e2, e3, e4, e5, e6) \
981 ((xen_uuid_t)XEN_DEFINE_UUID_(a, b, c, d, e1, e2, e3, e4, e5, e6))
992 -#else
993 -#define XEN_DEFINE_UUID(a, b, c, d, e1, e2, e3, e4, e5, e6) \
994 - XEN_DEFINE_UUID_(a, b, c, d, e1, e2, e3, e4, e5, e6)
995 -#endif /* __STDC_VERSION__ / __GNUC__ */
982
983 #endif /* !__ASSEMBLY__ */
984