Re: [XEN PATCH v2] xen/include: avoid undefined behavior.

2023-06-22 Thread Jan Beulich
On 22.06.2023 10:15, Nicola Vetrini wrote: > On 21/06/23 10:48, Jan Beulich wrote: >> On 21.06.2023 09:58, Nicola Vetrini wrote: >>> -#define BUILD_BUG_ON_ZERO(cond) sizeof(struct { int:-!!(cond); }) >>> +#define BUILD_BUG_ON_ZERO(cond) \ >>> +(sizeof(struct { unsigned u : (cond) ? -1 : sizeof(

Re: [XEN PATCH v2] xen/include: avoid undefined behavior.

2023-06-22 Thread Nicola Vetrini
On 21/06/23 10:48, Jan Beulich wrote: On 21.06.2023 09:58, Nicola Vetrini wrote: Redefine BUILD_BUG_ON_ZERO to fully comply with C99 avoiding undefined behavior 58 ("A structure or union is defined as containing no named members (6.7.2.1)." Here and in the title I'm not happy about you refe

Re: [XEN PATCH v2] xen/include: avoid undefined behavior.

2023-06-21 Thread Jan Beulich
On 21.06.2023 09:58, Nicola Vetrini wrote: > Redefine BUILD_BUG_ON_ZERO to fully comply with C99 avoiding > undefined behavior 58 ("A structure or union is defined as > containing no named members (6.7.2.1)." Here and in the title I'm not happy about you referencing undefined behavior. What we do

[XEN PATCH v2] xen/include: avoid undefined behavior.

2023-06-21 Thread Nicola Vetrini
Redefine BUILD_BUG_ON_ZERO to fully comply with C99 avoiding undefined behavior 58 ("A structure or union is defined as containing no named members (6.7.2.1)." The chosen ill-formed construct is a negative bitwidth in a bitfield within a struct containing at least one named member, which prevents