On 25/07/2023 5:16 pm, Jan Beulich wrote: > On 25.07.2023 15:55, Juergen Gross wrote: >> Flexible arrays in public headers can be problematic with some >> compilers. >> >> Replace them with arr[XEN_FLEX_ARRAY_DIM] in order to avoid compilation >> errors. >> >> This includes arrays defined as "arr[1]", as seen with a recent Linux >> kernel [1]. >> >> [1]: https://bugzilla.kernel.org/show_bug.cgi?id=217693 >> >> Signed-off-by: Juergen Gross <[email protected]> > I think we need to be careful here: What if someone somewhere applies > sizeof() to any of the types you alter?
Then the code was most likely wrong already. > The resulting value would > change with the changes you propose, which we cannot allow to happen > in a stable interface. Therefore imo it can only be an opt-in feature > to have these arrays no longer be one-element ones. I don't consider this an issue. If people take an update to the headers and their code stops compiling, then of course they fix the compilation issue. That's normal. It's unreasonable to take opt-in features to a set of headers intended to be vendored in the first place, to work around a corner case that's likely buggy already. ~Andrew
