```c dlls/wined3d/context_vk.c:2377:42: warning: ‘null_binding’ may be used uninitialized in this function [-Wmaybe-uninitialized] 2377 | *null_buffer_binding = b->binding = null_binding; | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ ```
-- v2: wined3d: Fix uninitialized variable warning.
From: Davide Beatrici git@davidebeatrici.dev
dlls/wined3d/context_vk.c:2377:42: warning: ‘null_binding’ may be used uninitialized in this function [-Wmaybe-uninitialized] 2377 | *null_buffer_binding = b->binding = null_binding; | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ --- dlls/wined3d/context_vk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c index 10713985e7e..8076ac54166 100644 --- a/dlls/wined3d/context_vk.c +++ b/dlls/wined3d/context_vk.c @@ -2337,7 +2337,7 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte { struct wined3d_shader_signature_element *element; struct wined3d_shader_signature *signature; - uint32_t null_binding, location; + uint32_t null_binding = UINT32_MAX, location;
for (i = 0; i < ARRAY_SIZE(state->streams); ++i) {
With what gcc version and compiler flags does this appear?
On Wed May 24 17:50:18 2023 +0000, Zebediah Figura wrote:
With what gcc version and compiler flags does this appear?
``` gcc-9 (Ubuntu 9.4.0-1ubuntu1~18.04) 9.4.0 x86_64-w64-mingw32-gcc (GCC) 9.3-win32 20200422 ```
``` export CFLAGS_X32="-march=i686 -msse2 -mfpmath=sse -Og -ftree-vectorize" export CFLAGS_X64="-march=x86-64 -msse3 -mfpmath=sse -Og -ftree-vectorize" export LDFLAGS="-Wl,-O1,--sort-common,--as-needed" ```
On Wed May 24 17:52:33 2023 +0000, Davide Beatrici wrote:
gcc-9 (Ubuntu 9.4.0-1ubuntu1~18.04) 9.4.0 x86_64-w64-mingw32-gcc (GCC) 9.3-win32 20200422
export CFLAGS_X32="-march=i686 -msse2 -mfpmath=sse -Og -ftree-vectorize" export CFLAGS_X64="-march=x86-64 -msse3 -mfpmath=sse -Og -ftree-vectorize" export LDFLAGS="-Wl,-O1,--sort-common,--as-needed"
That's both old and nonstandard, and while I'm not going to argue too hard against fixing these warnings, it doesn't seem the best use of time. I have to wonder how many other such warnings exist across the codebase with those options...
Anyway, suppressing -Wmaybe-uninitialized by initializing the variable to a dummy value is bad for clarity, and in my experience almost never the right solution. In this case I'd rather replace the for + if pattern (which I pretty much universally dislike) with a helper function.
That's both old and nonstandard, and while I'm not going to argue too hard against fixing these warnings, it doesn't seem the best use of time. I have to wonder how many other such warnings exist across the codebase with those options...
Quite a few, not too many though.
Anyway, suppressing -Wmaybe-uninitialized by initializing the variable to a dummy value is bad for clarity, and in my experience almost never the right solution. In this case I'd rather replace the for + if pattern (which I pretty much universally dislike) with a helper function.
I strongly agree, I honestly didn't like this "solution" anyway. !2863 solved the warning the right way.