KhronosGroup / glslang

Khronos-reference front end for GLSL/ESSL, partial front end for HLSL, and a SPIR-V generator.
Other
2.9k stars 816 forks source link

-Wmissing-field-initializers fixes #3522

Closed AnyOldName3 closed 4 months ago

AnyOldName3 commented 4 months ago

Like with the last few PRs from me, it fixes a warning that's commonly enabled in downstream projects that might want to consume glslang via FetchContent or equivalent.

It doesn't actually enable the warning, but that might be desirable.

I think I found a bug in the Spv.FromFile.cpp tests that would have been prevented had this warning been enabled all along. I had to guess the value for the missing field, so went for the most common one in the list. The only test case that used a different value before had an RWTexture1D, so if baseImageBinding is meaning the same kind of image as image load store in OpenGL, it would make sense that that would be the only one to need a non-zero value for the binding.

I'm a little concerned that the test wasn't previously failing with the incorrectly-assigned fields as it implies they don't make any difference, so the test might be too permissive.