GCC 10 alphas (and probably before that) issue
font.c: In function ‘test_fontsetbuilder’: font.c:9149:21: warning: ‘ivalue’ may be used uninitialized in this function [-Wmaybe-uninitialized] 9149 | wsprintfW(buffW, fmtW, ivalue); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
in dlls/dwrite/tests/font.c.
The structure of our code is
switch ... { case 1: ivalue =... ; break; case 2: ivalue =... ; break; default: ; } switch ... { case 1: case 2: do something with ivalue; default: ; }
so this looks like a false positive, however one that appears rather involved for compilers to handle.
Hence, best to pragmatically silence this by initializing ivalue in the default case?
Gerald
--- dlls/dwrite/tests/font.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c index 309c0a2b08..3b6c2dc3c2 100644 --- a/dlls/dwrite/tests/font.c +++ b/dlls/dwrite/tests/font.c @@ -9126,7 +9126,7 @@ todo_wine ivalue = IDWriteFont3_GetStyle(font); break; default: - ; + ivalue = 0; }
switch (id)