[PATCH 2/3] libs/wine: suppress GCC12 warning (from -Waddress)
Eric Pouech
wine at gitlab.winehq.org
Fri Jun 10 05:13:55 CDT 2022
From: Eric Pouech <eric.pouech at 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 at 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 */
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/224
More information about the wine-devel
mailing list