https://bugs.winehq.org/show_bug.cgi?id=40136
Bug ID: 40136 Summary: directx.c:4425:5: warning: comparison of unsigned expression < 0 is always false Product: Wine Version: 1.9.3 Hardware: x86 OS: Linux Status: NEW Severity: normal Priority: P2 Component: directx-d3d Assignee: wine-bugs@winehq.org Reporter: wylda@volny.cz Distribution: ---
Noticed during compilation of wine-1.9.3-217-g0f8a0fd on older Debian Wheezy:
/wine_git_build/dlls/wined3d/directx.c: In function ‘wined3d_check_device_multisample_type’:
/wine_git_build/dlls/wined3d/directx.c:4425:5: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
https://bugs.winehq.org/show_bug.cgi?id=40136
Wylda wylda@volny.cz changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |source Distribution|--- |Debian
--- Comment #1 from Wylda wylda@volny.cz --- Filling some fields...
https://bugs.winehq.org/show_bug.cgi?id=40136
Sergey Isakov isakov-sl@bk.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |isakov-sl@bk.ru
--- Comment #2 from Sergey Isakov isakov-sl@bk.ru --- This is wrong programming style to check if enum type variable have a value out of enum range. For my mind the check must be at the function call and not inside the function.
Yes, the expression will never be < 0, this check is redundant.
https://bugs.winehq.org/show_bug.cgi?id=40136
--- Comment #3 from Nikolay Sivov bunglehead@gmail.com --- Why is that wrong? Function validates its argument, which can be anything. Whether enum integer type is signed or not is compiler specific, for gcc and this particular enum it will be unsigned int most likely, so more reliable check would be to use (unsigned int)multisample_type > WINED3D_MULTISAMPLE_16_SAMPLES.
https://bugs.winehq.org/show_bug.cgi?id=40136
--- Comment #4 from Sergey Isakov isakov-sl@bk.ru --- It is not an error, it is redundant codes.
https://bugs.winehq.org/show_bug.cgi?id=40136
Matteo Bruni matteo.mystral@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |INVALID
--- Comment #5 from Matteo Bruni matteo.mystral@gmail.com --- I guess we could cast to unsigned and only check for > WINED3D_MULTISAMPLE_16_SAMPLES as Nikolay wrote but I don't see the current code being wrong in any way. Newer gcc doesn't complain, I guess the check became smarter.
https://bugs.winehq.org/show_bug.cgi?id=40136
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #6 from Austin English austinenglish@gmail.com --- Closing.