From: Gerald Pfeifer gerald@pfeifer.com
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
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- 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..7d434222a3 100644 --- a/dlls/dwrite/tests/font.c +++ b/dlls/dwrite/tests/font.c @@ -9105,7 +9105,7 @@ todo_wine static const WCHAR fmtW[] = {'%','u',0}; IDWriteLocalizedStrings *values; WCHAR buffW[255], buff2W[255]; - UINT32 c, ivalue; + UINT32 c, ivalue = 0; BOOL exists;
hr = IDWriteFontSet_GetPropertyValues(fontset, 0, id, &exists, &values);