[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] xen: add macro for defining variable length array in public headers
On 30.08.2019 10:32, Juergen Gross wrote: > --- a/xen/include/public/xen.h > +++ b/xen/include/public/xen.h > @@ -53,6 +53,15 @@ DEFINE_XEN_GUEST_HANDLE(uint64_t); > DEFINE_XEN_GUEST_HANDLE(xen_pfn_t); > DEFINE_XEN_GUEST_HANDLE(xen_ulong_t); > > +/* Define a variable length array (depends on compiler). */ > +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L > +#define __XEN_VARLEN_ARRAY_SIZE > +#elif defined(__GNUC__) > +#define __XEN_VARLEN_ARRAY_SIZE 0 > +#else > +#define __XEN_VARLEN_ARRAY_SIZE 1 /* variable size */ > +#endif To be in line with the intentions, the C90 standard, and io/ring.h I'd suggest to use FLEX instead of VARLEN. Furthermore, especially in a public header, two double leading underscores need to go away. And then, with FLEX in the name, SIZE isn't really appropriate anymore. Therefore I see three possible names: XEN_FLEXIBLE_ARRAY, XEN_FLEX_ARRAY_DIMENSION (possibly just _DIM at its end), or XEN_FLEX_ARRAY_DESIGNATOR. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |