From: Eric Pouech eric.pouech@gmail.com
GCC12 warns about testing ptr + delta against 0/NULL when -Waddress is enabled as it's 'most always wrong'. It's not wrong here :-( GCC docs suggests casting to (u)intptr_t to get rid of the warning
Signed-off-by: Eric Pouech eric.pouech@gmail.com --- dlls/ntdll/unix/virtual.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 6ecca9cb98a..b37ab44c5dc 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -238,7 +238,7 @@ static void mmap_add_reserved_area( void *addr, SIZE_T size ) struct reserved_area *area; struct list *ptr;
- if (!((char *)addr + size)) size--; /* avoid wrap-around */ + if (!(intptr_t)((char *)addr + size)) size--; /* avoid wrap-around */
LIST_FOR_EACH( ptr, &reserved_areas ) { @@ -287,7 +287,7 @@ static void mmap_remove_reserved_area( void *addr, SIZE_T size ) struct reserved_area *area; struct list *ptr;
- if (!((char *)addr + size)) size--; /* avoid wrap-around */ + if (!(intptr_t)((char *)addr + size)) size--; /* avoid wrap-around */
ptr = list_head( &reserved_areas ); /* find the first area covering address */