From: Adhemerval Zanella Date: Fri, 17 Oct 2025 19:13:14 +0000 (-0300) Subject: elf: Suppress unused function clang warning for __ifunc_resolver X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ff758345eb7a66165264ce454f3fb48d1163026a;p=thirdparty%2Fglibc.git elf: Suppress unused function clang warning for __ifunc_resolver The __ifunc_resolver macro expands to: extern __typeof (__redirect_name) name __attribute__ ((ifunc ("iname_ifunc"))); static __typeof (__redirect_name) *name_ifunc (void) { [...] }; And although NAME_IFUNC is and alias for NAME, clang still emits an 'unused function 'name_ifunc' [-Werror,-Wunused-function]' warning. The static is used to avoid name pollution on static linkage. Reviewed-by: Sam James --- diff --git a/include/libc-symbols.h b/include/libc-symbols.h index b407fa8f7d..2f9453e0d7 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -86,6 +86,7 @@ /* Obtain the definition of symbol_version_reference. */ #include +#include /* When PIC is defined and SHARED isn't defined, we are building PIE by default. */ @@ -671,7 +672,10 @@ for linking") # define __ifunc_args(type_name, name, expr, init, ...) \ extern __typeof (type_name) name __attribute__ \ ((ifunc (#name "_ifunc"))); \ - __ifunc_resolver (type_name, name, expr, init, static, __VA_ARGS__) + DIAG_PUSH_NEEDS_COMMENT_CLANG; \ + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wunused-function"); \ + __ifunc_resolver (type_name, name, expr, init, static, __VA_ARGS__); \ + DIAG_POP_NEEDS_COMMENT_CLANG; # define __ifunc_args_hidden(type_name, name, expr, init, ...) \ __ifunc_args (type_name, name, expr, init, __VA_ARGS__)