https://bugs.winehq.org/show_bug.cgi?id=38337
Bug ID: 38337 Summary: clang compiling warnings Product: Wine Version: 1.7.39 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: isakov-sl@bk.ru Distribution: ---
Wine1.7.39-251-gdbf8bde compiled by Apple's clang. The wine works somehow. There are hundreds warning so I show them in one bug although there are many possible bugs. ---- keyboard.c:287:2: warning: illegal character encoding in string literal [-Winvalid-source-encoding] "?","&1","?2",""3","'4","(5","-6","?7","_8","?9","?0",")?","=+", ^ ---- cocoa_status_item.m:100:13: warning: instance method '-discardEventsPassingTest:' not found (return type defaults to 'id') [queue discardEventsPassingTest:^BOOL (macdrv_event* event){ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. ---- imgfactory.c:715:88: warning: implicit conversion from enumeration type 'WICBitmapAlphaChannelOption' (aka 'enum WICBitmapAlphaChannelOption') to different enumeration type 'WICBitmapCreateCacheOption' (aka 'enum WICBitmapCreateCacheOption') [-Wconversion] ...BitmapImpl_Create(bm.bmWidth, bm.bmHeight, bm.bmWidthBytes, 0, NULL, &format, option,... ~~~~~~~~~~~~~~~~~ ^~~~~~ ----- display.c:225:24: warning: unused function 'create_mode_dict' [-Wunused-function] static CFDictionaryRef create_mode_dict(CGDisplayModeRef display_mode) ^ 1 warning generated. ----- node.c:1620:37: warning: implicit conversion from enumeration type 'xmlElementType' to different enumeration type 'DOMNodeType' (aka 'enum tagDOMNodeType') [-Wconversion] *domNodeType = This->node.node->type; ~ ~~~~~~~~~~~~~~~~~^~~~ 1 warning generated. ----- locale.c:11344:13: warning: unknown attribute '__force_align_arg_pointer__' ignored [-Wattributes] call_locale_facet_vector_dtor(iter->fac, 1); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ locale.c:246:52: note: expanded from macro 'call_locale_facet_vector_dtor' #define call_locale_facet_vector_dtor(this, flags) CALL_VTBL_FUNC(this, 0, \ ^ ./cxx.h:269:59: note: expanded from macro 'CALL_VTBL_FUNC' #define CALL_VTBL_FUNC(this, off, ret, type, args) ((ret (WINAPI*... ^ ../../include/windef.h:169:21: note: expanded from macro 'WINAPI' #define WINAPI __stdcall ^ ../../include/msvcrt/crtdefs.h:48:67: note: expanded from macro '__stdcall' ...__attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ----- mach.c:93:9: warning: 'bootstrap_register' is deprecated [-Wdeprecated-declarations] if (bootstrap_register(bp, (char*)wine_get_server_dir(), ... ^ ---- warning: Small Fonts 11: missing glyph for char 05b0 ---- file.c:2124:49: warning: array index 1 is past the end of the array (which contains 1 element) [-Warray-bounds] dir_info->FileName[0] == '.' && dir_info->FileName[1] == ... ^ ~ ../../include/winternl.h:495:5: note: array 'FileName' declared here WCHAR FileName[ANYSIZE_ARRAY]; ^ 1 warning generated. ----
I omitted same warnings repeated many times.
https://bugs.winehq.org/show_bug.cgi?id=38337
--- Comment #1 from Nikolay Sivov bunglehead@gmail.com --- Created attachment 51183 --> https://bugs.winehq.org/attachment.cgi?id=51183 msmxl warnings
For msxml3 part please try this one.
https://bugs.winehq.org/show_bug.cgi?id=38337
--- Comment #2 from Nikolay Sivov bunglehead@gmail.com --- Two of the issues you mentioned are fixed now with e1b160b00511ff37bdd625b91e73e9335158190f and de6649ede03eed385207564e8f9ac907852c4fbd.
https://bugs.winehq.org/show_bug.cgi?id=38337
--- Comment #3 from Sergey Isakov isakov-sl@bk.ru --- (In reply to Nikolay Sivov from comment #1)
Created attachment 51183 [details] msmxl warnings
For msxml3 part please try this one.
This patch is wrong you just forget to exclude old line where the warning is line:1620. Meanwhile, I expected assignment on each case statement without type conversion.
I see you committed related patches so I will wait for an update.
There are also warnings with similar mistakes, for example --- imgfactory.c:715:88: warning: implicit conversion from enumeration type 'WICBitmapAlphaChannelOption' (aka 'enum WICBitmapAlphaChannelOption') to different enumeration type 'WICBitmapCreateCacheOption' (aka 'enum WICBitmapCreateCacheOption') [-Wenum-conversion] ...BitmapImpl_Create(bm.bmWidth, bm.bmHeight, bm.bmWidthBytes, 0, NULL, &format, option... ~~~~~~~~~~~~~~~~~ ^~~~~~ ---- Should I report them separately or commit a set of patches one for each message? I already affraid to commit something because all my patches rejected except &prc.
https://bugs.winehq.org/show_bug.cgi?id=38337
--- Comment #4 from Nikolay Sivov bunglehead@gmail.com --- Both msxml3 and windowscodecs issues are fixed now, commits are mentioned in comment 2.
https://bugs.winehq.org/show_bug.cgi?id=38337
--- Comment #5 from Sergey Isakov isakov-sl@bk.ru --- More warnings: ----- /programs/winedbg/gdbproxy.c:2146:23: warning: comparison of constant -1 with expression of type 'enum be_xpoint_type' is always false [-Wtautological-constant-out-of-range-compare] if (xpt->type == -1) ~~~~~~~~~ ^ ~~ ------- /programs/winemine/main.c:83:9: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses] if( !RegQueryValueExW( hkey, xposW, NULL, &type, ^ -------- /dlls/xmllite/tests/reader.c:245:20: warning: comparison of constant -1 with expression of type 'XmlReadState' (aka 'enum XmlReadState') is always false [-Wtautological-constant-out-of-range-compare] if (exp_broken == -1) ~~~~~~~~~~ ^ ~~ ---------- /dlls/wintab32/context.c:233:31: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value] packet->pkY = abs(ptr->context.lcOutExtY + packet->pkY); ^ ------------ /dlls/winmm/tests/mixer.c:637:25: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value] if (abs(ret_value.dwValue-new_value.dwValue)<=1) { ^ ----------- /dlls/winmm/joystick.c:107:6: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value] abs(joy->ji.wZpos - ji.wZpos) > joy->threshold) { ^ ----------- /programs/winedbg/types.c:78:13: warning: variable 'bt' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized] if (!types_get_info(&type, TI_GET_LENGTH, &size) || ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ----------
Hope authors of these codes will correct own mistakes protected by LGPL.
https://bugs.winehq.org/show_bug.cgi?id=38337
--- Comment #6 from Nikolay Sivov bunglehead@gmail.com --- (In reply to Sergey Isakov from comment #5)
More warnings:
/programs/winedbg/gdbproxy.c:2146:23: warning: comparison of constant -1 with expression of type 'enum be_xpoint_type' is always false [-Wtautological-constant-out-of-range-compare] if (xpt->type == -1) ~~~~~~~~~ ^ ~~
I don't think this warning is accurate.
/programs/winemine/main.c:83:9: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses] if( !RegQueryValueExW( hkey, xposW, NULL, &type, ^
I sent a patch for this.
/dlls/xmllite/tests/reader.c:245:20: warning: comparison of constant -1 with expression of type 'XmlReadState' (aka 'enum XmlReadState') is always false [-Wtautological-constant-out-of-range-compare] if (exp_broken == -1) ~~~~~~~~~~ ^ ~~
Same.
/dlls/wintab32/context.c:233:31: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value] packet->pkY = abs(ptr->context.lcOutExtY + packet->pkY); ^
/dlls/winmm/tests/mixer.c:637:25: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value] if (abs(ret_value.dwValue-new_value.dwValue)<=1) { ^
/dlls/winmm/joystick.c:107:6: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value] abs(joy->ji.wZpos - ji.wZpos) > joy->threshold) { ^
Probably valid, let's see if someone picks them up.
/programs/winedbg/types.c:78:13: warning: variable 'bt' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized] if (!types_get_info(&type, TI_GET_LENGTH, &size) || ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This one could be ignored.
Hope authors of these codes will correct own mistakes protected by LGPL.
As you said those are opensource LGPL mistakes, so fixes are welcome, not only from original authors.
https://bugs.winehq.org/show_bug.cgi?id=38337
--- Comment #7 from Sergey Isakov isakov-sl@bk.ru --- About abs(unsinged). This is Clang bad alarm. Test snippet ------ #include <stdio.h> #include <stdlib.h> #include <string.h>
int main() { unsigned int x = 3, y = 5, z; z = x - y; printf(" results: %d, abs=%d\n", z, abs(z)); } --------- Results: -------- iMac:2 sergey$ llvm-clang test_unsigned.c -o test2 test_unsigned.c:9:39: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value] printf(" results: %d, abs=%d\n", z, abs(z)); ^ test_unsigned.c:9:39: note: remove the call to 'abs' since unsigned values cannot be negative printf(" results: %d, abs=%d\n", z, abs(z)); ^~~ 1 warning generated. iMac:2 sergey $ ./test2 results: -2, abs=2 iMac:2 sergey $ --------- So there will be no problem. Should set a flag -Wno-absolute-value
https://bugs.winehq.org/show_bug.cgi?id=38337
--- Comment #8 from Sergey Isakov isakov-sl@bk.ru --- But next attempt make crazy!
~~~ int main() { unsigned short x = 3, y = 5, z; z = x - y; printf(" results: %d, abs=%d\n", z, abs(z)); } ~~~~~
results: 65534, abs=65534
If there is unsigned short then the result is bad!
https://bugs.winehq.org/show_bug.cgi?id=38337
--- Comment #9 from Dmitry Timoshkov dmitry@baikal.ru --- (In reply to Sergey Isakov from comment #8)
But next attempt make crazy!
int main() { unsigned short x = 3, y = 5, z; z = x - y; printf(" results: %d, abs=%d\n", z, abs(z)); }
results: 65534, abs=65534
If there is unsigned short then the result is bad!
The result is perfectly correct. You need to add explicit casts to (signed int)z and abs((signed int)z) if you want to unbreak it.
https://bugs.winehq.org/show_bug.cgi?id=38337
--- Comment #10 from Dmitry Timoshkov dmitry@baikal.ru --- (In reply to Dmitry Timoshkov from comment #9)
But next attempt make crazy!
int main() { unsigned short x = 3, y = 5, z; z = x - y; printf(" results: %d, abs=%d\n", z, abs(z)); }
results: 65534, abs=65534
If there is unsigned short then the result is bad!
The result is perfectly correct. You need to add explicit casts to (signed int)z and abs((signed int)z) if you want to unbreak it.
Or rather cast to 'signed short'.
https://bugs.winehq.org/show_bug.cgi?id=38337
--- Comment #11 from Sergey Isakov isakov-sl@bk.ru --- I still get numerous warning during clang compilation. May be some of them not valid just shown bad programming style. I will not open several bugs and will show different bugs in different posts. Lets begin.
https://bugs.winehq.org/show_bug.cgi?id=38337
--- Comment #12 from Sergey Isakov isakov-sl@bk.ru --- /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/dlls/d3d12/tests/d3d12.c:28:9: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value] if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) ^ /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/dlls/d3d12/tests/d3d12.c:28:9: note: remove the call to 'abs' since unsigned values cannot be negative if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) ^~~ /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/dlls/d3d12/tests/d3d12.c:31:9: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value] if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) ^ /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/dlls/d3d12/tests/d3d12.c:31:9: note: remove the call to 'abs' since unsigned values cannot be negative if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) ^~~
------------------------ as said before there must be cast to singed int.
https://bugs.winehq.org/show_bug.cgi?id=38337
--- Comment #13 from Sergey Isakov isakov-sl@bk.ru --- /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/dlls/glu32/tess.c:447:56: warning: '__force_align_arg_pointer__' attribute ignored when parsing type [-Wignored-attributes] tess->callBegin = (fn == NULL) ? &noBegin : (void (GLAPIENTRY *)(GLenum)) fn; ^~~~~~~~~~ /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/include/wine/wgl.h:7:20: note: expanded from macro 'GLAPIENTRY' #define GLAPIENTRY __stdcall ^~~~~~~~~ /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/include/windef.h:57:67: note: expanded from macro '__stdcall' # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
^~~~~~~~~~~~~~~~~~~~~~~~~~~ /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/dlls/glu32/tess.c:451:29: warning: '__force_align_arg_pointer__' attribute ignored when parsing type [-Wignored-attributes] &__gl_noBeginData : (void (GLAPIENTRY *)(GLenum, void *)) fn; ^~~~~~~~~~ -------------------
This I don't know
https://bugs.winehq.org/show_bug.cgi?id=38337
--- Comment #14 from Sergey Isakov isakov-sl@bk.ru --- /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/dlls/kernel32/file.c:2193:49: warning: array index 1 is past the end of the array (which contains 1 element) [-Warray-bounds] dir_info->FileName[0] == '.' && dir_info->FileName[1] == '.') continue; ^ ~ /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/include/winternl.h:551:5: note: array 'FileName' declared here WCHAR FileName[ANYSIZE_ARRAY]; ^ ---------------------------------
Something like dynamic array size? Make a pointer instead of array.
https://bugs.winehq.org/show_bug.cgi?id=38337
--- Comment #15 from Sergey Isakov isakov-sl@bk.ru --- /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/include/ddk/wdm.h:34:9: warning: 'PAGE_SHIFT' macro redefined [-Wmacro-redefined] #define PAGE_SHIFT 12 ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/mach/i386/vm_param.h:99:9: note: previous definition is here #define PAGE_SHIFT I386_PGSHIFT ^ 1 warning generated. ----------------------------------
There is a conflict with the macOS definition. May be reasonable to rename the constant
#define WINE_PAGE_SHIFT 12
https://bugs.winehq.org/show_bug.cgi?id=38337
--- Comment #16 from Sergey Isakov isakov-sl@bk.ru --- winemsi_s.c:3912:5: warning: cast between incompatible calling conventions 'cdecl' and 'stdcall'; calls through this pointer may abort at runtime [-Wcast-calling-convention] (SERVER_ROUTINE)s_remote_ViewClose, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./winemsi.h:68:14: note: consider defining 's_remote_ViewClose' with the 'stdcall' calling convention UINT __cdecl s_remote_ViewClose( ^ __attribute__((stdcall))
-----------------------------------
Same warning about all such procedures (SERVER_ROUTINE)s_remote_***
https://bugs.winehq.org/show_bug.cgi?id=38337
--- Comment #17 from Sergey Isakov isakov-sl@bk.ru --- /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/dlls/user32/sysparams.c:1740:15: warning: variable 'padded_border' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized] ret = get_entry( &entry_BORDER, 0, &lpnm->iBorderWidth ) && ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/dlls/user32/sysparams.c:1755:31: note: uninitialized use occurs here lpnm->iBorderWidth += padded_border; ^~~~~~~~~~~~~ /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/dlls/user32/sysparams.c:1740:15: note: remove the '&&' if its condition is always true ret = get_entry( &entry_BORDER, 0, &lpnm->iBorderWidth ) && ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/dlls/user32/sysparams.c:1736:26: note: initialize the variable 'padded_border' to silence this warning int padded_border; ^ = 0 -------------------------------------
No comment
https://bugs.winehq.org/show_bug.cgi?id=38337
--- Comment #18 from Sergey Isakov isakov-sl@bk.ru --- /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/dlls/winemac.drv/clipboard.c:291:78: warning: format specifies type 'const unichar *' (aka 'const unsigned short *') but the argument has type 'WCHAR *' (aka 'unsigned short *') [-Wformat] registered_name_type_prefix, buffer);
^~~~~~ 1 warning generated. --------------------------------------- can be ignored
https://bugs.winehq.org/show_bug.cgi?id=38337
--- Comment #19 from Sergey Isakov isakov-sl@bk.ru --- /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/dlls/winemac.drv/cocoa_app.m:1226:16: warning: 15 enumeration values not handled in switch: 'kCGEventNull', 'kCGEventLeftMouseDown', 'kCGEventLeftMouseUp'... [-Wswitch] switch(type) ^ /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/dlls/winemac.drv/cocoa_app.m:1226:16: note: add missing switch cases switch(type) ^ -------------------------------- or make default?
https://bugs.winehq.org/show_bug.cgi?id=38337
--- Comment #20 from Sergey Isakov isakov-sl@bk.ru --- /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/dlls/winemac.drv/cocoa_clipboard.m:163:45: warning: null passed to a callee that requires a non-null argument [-Wnonnull] ret = [NSBitmapImageRep representationOfImageRepsInArray:reps ^ 1 warning generated. ---------------------------------
/Volumes/MacHD/Users/sergey/Documents/Projects/winehq/dlls/winemac.drv/cocoa_window.m:1770:19: warning: null passed to a callee that requires a non-null argument [-Wnonnull] [self windowDidResize:nil]; ^ ~~~ /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/dlls/winemac.drv/cocoa_window.m:1949:27: warning: null passed to a callee that requires a non-null argument [-Wnonnull] [self windowDidResize:nil]; ^ ~~~ /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/dlls/winemac.drv/cocoa_window.m:2848:15: warning: null passed to a callee that requires a non-null argument [-Wnonnull] [self windowDidResize:nil]; ^ ~~~ /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/dlls/winemac.drv/cocoa_window.m:2864:15: warning: null passed to a callee that requires a non-null argument [-Wnonnull] [self windowDidResize:nil]; ^ ~~~ 4 warnings generated. ---------------------------------------
I don't know the logic
https://bugs.winehq.org/show_bug.cgi?id=38337
--- Comment #21 from Sergey Isakov isakov-sl@bk.ru --- /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/dlls/winex11.drv/pen.c:50:56: warning: implicit conversion from 'int' to 'char' changes value from 255 to -1 [-Wconstant-conversion] for (i = 0; i < pos; i++) res[i] = min( dashes[i], 255 ); ~ ^~~ ------------------------------
signed <-> unsigned errors again
https://bugs.winehq.org/show_bug.cgi?id=38337
--- Comment #22 from Sergey Isakov isakov-sl@bk.ru --- /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/dlls/winemac.drv/cocoa_status_item.m:100:20: warning: instance method '-discardEventsPassingTest:' not found (return type defaults to 'id') [-Wobjc-method-access] [queue discardEventsPassingTest:^BOOL (macdrv_event* event){ ^~~~~~~~~~~~~~~~~~~~~~~~ /Volumes/MacHD/Users/sergey/Documents/Projects/winehq/dlls/winemac.drv/cocoa_event.h:40:12: note: receiver is instance of class declared here @interface WineEventQueue : NSObject ^ 1 warning generated. ------------------------------------
Ask to author.
https://bugs.winehq.org/show_bug.cgi?id=38337
--- Comment #23 from Sergey Isakov isakov-sl@bk.ru --- /Volumes/MacHD/Users/sergey/Documents/Projects/wine/dlls/gdi32/freetype.c:841:53: warning: incompatible pointer types passing 'SInt16 *' (aka 'short *') to parameter of type 'ResFileRefNum *' (aka 'int *') [-Wincompatible-pointer-types] s = FSOpenResourceFile(&ref, 0, NULL, fsRdPerm, &res_ref); ^~~~~~~~ ~~~~~~~~~~~~~~~~~~
The variable is local and defined as SInt16. This is the error! There must be SInt32 res_ref = 0; I prefer also initialize it.