|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v8 04/11] public: xen.h: add definitions for UUID handling
Hi jan On 11.10.17 11:07, Jan Beulich wrote: On 10.10.17 at 19:03, <volodymyr_babchuk@xxxxxxxx> wrote:On 10.10.17 19:12, Jan Beulich wrote:On 10.10.17 at 17:52, <volodymyr_babchuk@xxxxxxxx> wrote:
Yes. But there was a reason do to so. For example:
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
uint32_t optarr[];
#elif defined(__GNUC__)
uint32_t optarr[0];
#endif
(xen/include/public/physdev.h:303)
If compiler is C99 then we use flexible length array, else if compiller
is GCC, we use zero-length array, which is GCC extension (correct me).
Other compilers (non-gcc C90 compatible) are not supported. Probably
this is a bug.
Another case is even worse:
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
unsigned char buf[];
#elif defined(__GNUC__)
unsigned char buf[1]; /* OUT: Variable length buffer with
build_id. */
(xen/include/public/version.h:49)Array of length one is perfectly fine in any dialect of C. There are no need to check for GCC. Also, again, this code will not define `buf` on non-gcc, C90 compatible compilers. My code does not use gcc-only extensions like zero-length arrays, so I don't see how #elif defined (__GNUC__) can fit in the my case. >= 199901" in various places in XEN, so I did it alike. Also, I'm using C99 feature, not gcc-only one.I didn't ask you to replace the conditional, but to (possibly) extend it. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |