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 --- libs/wine/mmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libs/wine/mmap.c b/libs/wine/mmap.c index ad51153d039..5296d87e086 100644 --- a/libs/wine/mmap.c +++ b/libs/wine/mmap.c @@ -501,7 +501,7 @@ void wine_mmap_add_reserved_area_obsolete( 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 ) { @@ -560,7 +560,7 @@ void wine_mmap_remove_reserved_area_obsolete( void *addr, size_t size, int unmap 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 */