[gcc r16-6139] libgomp: Avoid -Waddress warning

Jakub Jelinek jakub@gcc.gnu.org
Mon Dec 15 18:10:26 GMT 2025


https://gcc.gnu.org/g:f4b80b03388fc0b5a21bd8e15f6c5d98fb8b3e53

commit r16-6139-gf4b80b03388fc0b5a21bd8e15f6c5d98fb8b3e53
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Dec 15 19:08:06 2025 +0100

    libgomp: Avoid -Waddress warning
    
    The function has assert (htab_find) with a comment that that is to
    avoid -Wunused-function warning.  The problem is that it triggers
    a different warning,
    ../../../libgomp/plugin/build-target-indirect-htab.h:68:3: warning: the address of ‘htab_find’ will always evaluate as ‘true’
    (or error depending on exact flags).
    
    This uses (void) htab_find instead to avoid any diagnostics.
    
    2025-12-15  Jakub Jelinek  <jakub@redhat.com>
    
            * plugin/build-target-indirect-htab.h (create_target_indirect_map):
            Use (void) htab_find instead of assert (htab_find) to silence
            -Werror=unused-function because the latter triggers -Werror=address.

Diff:
---
 libgomp/plugin/build-target-indirect-htab.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libgomp/plugin/build-target-indirect-htab.h b/libgomp/plugin/build-target-indirect-htab.h
index d732aca3e038..889e23db8b47 100644
--- a/libgomp/plugin/build-target-indirect-htab.h
+++ b/libgomp/plugin/build-target-indirect-htab.h
@@ -65,7 +65,7 @@ void*
 create_target_indirect_map (size_t *h_size, size_t count,
 			    uint64_t *host_addrs, uint64_t *device_addrs)
 {
-  assert (htab_find);  /* Silence -Werror=unused-function.  */
+  (void) htab_find;  /* Silence -Werror=unused-function.  */
 
   htab_t indirect_htab = htab_create (count);


More information about the Gcc-cvs mailing list