On 28/04/16 18:43, Jason Ekstrand wrote:
On Thu, Apr 28, 2016 at 8:49 AM, Jose Fonseca <[email protected] <mailto:[email protected]>> wrote:On 28/04/16 15:37, Connor Abbott wrote: For the series: Reviewed-by: Connor Abbott <[email protected] <mailto:[email protected]>> For the zero-sized array thing... we could make it a statically-sized array, since we never have more than 4 arguments to an ALU instruction, but that would be wasteful of memory. Also, we always have at least 1 argument, so we could make the size 1 to shut up the warning, but that would be more confusing and introduce undefined behavior in C99 that the compiler is likely to actually take advantage of. I don't see any options better than just accepting the warning and/or shutting that specific warning off. I feared so. Thanks for looking into it though. Can you be a bit more specific about the issues that MSVC has with zero-length arrays? Can it "accept nir_src src[0]" instead of "src[]"?
To be clear, MSVC doesn't really have a problem with zero length arrays. (I haven't actually tested the code, but at least MSVC compiles it without errors.)
MSVC does have a problem with C99 field initializers -- it will throw an error.
So I'd like to GCC to warn about C99 field initializers. But unfortunately it's not possible to only warn about that: -Wpedantic warns about all non-standard extensions, including C99 zero-length arrays.
So, if we could avoid zero-length arrays and other stuff that -Wpedantic warngs, that would make things simpler. But no biggie.
The key thing here is avoid C99 struct field initializers on the NIR headers that are mean to be used from C++.
Jose _______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
