[PATCH 0/1] MR2954: iphlpapi/tests: Use (DWORD)-1 instead of ~0ul in testGetIpNetTable.
Fixes warnings on GCC 13. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2954
From: Alex Henrie <alexhenrie24(a)gmail.com> Fixes warnings on GCC 13. --- dlls/iphlpapi/tests/iphlpapi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/iphlpapi/tests/iphlpapi.c b/dlls/iphlpapi/tests/iphlpapi.c index 8002afc0a89..c3ad99f79d5 100644 --- a/dlls/iphlpapi/tests/iphlpapi.c +++ b/dlls/iphlpapi/tests/iphlpapi.c @@ -419,12 +419,12 @@ static void testGetIpNetTable(void) } igmp3_found = ssdp_found = FALSE; - prev_idx = ~0ul; + prev_idx = (DWORD)-1; for (i = 0; i < buf->dwNumEntries; ++i) { if (buf->table[i].dwIndex != prev_idx) { - if (prev_idx != ~0ul) + if (prev_idx != (DWORD)-1) { ok( igmp3_found, "%s not found, iface index %lu.\n", ntoa( igmp3_addr ), prev_idx); ok( ssdp_found || broken(!ssdp_found) /* 239.255.255.250 is always present since Win10 */, -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2954
This seems unfortunate - what's the warning? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2954#note_34415
On Fri Jun 2 06:31:29 2023 +0000, Huw Davies wrote:
This seems unfortunate - what's the warning?
../wine/dlls/iphlpapi/tests/iphlpapi.c: In function ‘testGetIpNetTable’:
../wine/dlls/iphlpapi/tests/iphlpapi.c:422:24: warning: conversion from ‘long unsigned int’ to ‘DWORD’ {aka ‘unsigned int’} changes value from ‘18446744073709551615’ to ‘4294967295’ [-Woverflow]
422 | prev_idx = ~0ul;
| ^
../wine/dlls/iphlpapi/tests/iphlpapi.c:427:34: warning: comparison is always true due to limited range of data type [-Wtype-limits]
427 | if (prev_idx != ~0ul)
| ^~
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/2954#note_34416
On Fri Jun 2 06:31:29 2023 +0000, Alex Henrie wrote:
``` ../wine/dlls/iphlpapi/tests/iphlpapi.c: In function ‘testGetIpNetTable’: ../wine/dlls/iphlpapi/tests/iphlpapi.c:422:24: warning: conversion from ‘long unsigned int’ to ‘DWORD’ {aka ‘unsigned int’} changes value from ‘18446744073709551615’ to ‘4294967295’ [-Woverflow] 422 | prev_idx = ~0ul; | ^ ../wine/dlls/iphlpapi/tests/iphlpapi.c:427:34: warning: comparison is always true due to limited range of data type [-Wtype-limits] 427 | if (prev_idx != ~0ul) | ^~ ```
So this is with a non-PE build, right? Do we care any more? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2954#note_34417
So this is with a non-PE build, right? Do we care any more?
We don't care that much, but in general we should avoid using long constants. Of course ~0u would be better than a cast. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2954#note_34418
participants (4)
-
Alex Henrie -
Alex Henrie (@alexhenrie) -
Alexandre Julliard (@julliard) -
Huw Davies (@huw)