mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-24 05:50:14 +00:00
elf: Suppress unused function clang 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.
This commit is contained in:
parent
68cbe438b5
commit
413a452b5c
@ -22,6 +22,7 @@
|
||||
|
||||
# include <stdbool.h>
|
||||
# include <stdio.h>
|
||||
# include <libc-diag.h>
|
||||
|
||||
/* Do not use the test framework, so that the process setup is not
|
||||
disturbed. */
|
||||
@ -40,6 +41,8 @@ implementation (void)
|
||||
return random_constant;
|
||||
}
|
||||
|
||||
DIAG_PUSH_NEEDS_COMMENT_CLANG;
|
||||
DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wunused-function");
|
||||
static __typeof__ (implementation) *
|
||||
inhibit_stack_protector
|
||||
resolver (void)
|
||||
@ -49,6 +52,7 @@ resolver (void)
|
||||
}
|
||||
|
||||
static int magic (void) __attribute__ ((ifunc ("resolver")));
|
||||
DIAG_POP_NEEDS_COMMENT_CLANG;
|
||||
|
||||
int
|
||||
main (void)
|
||||
|
@ -21,6 +21,7 @@
|
||||
relocations. */
|
||||
|
||||
#include <config.h>
|
||||
#include <libc-diag.h>
|
||||
|
||||
#ifdef HAVE_GCC_IFUNC
|
||||
|
||||
@ -34,6 +35,8 @@ implementation (void)
|
||||
*p = 0;
|
||||
}
|
||||
|
||||
DIAG_PUSH_NEEDS_COMMENT_CLANG;
|
||||
DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wunused-function");
|
||||
static __typeof__ (implementation) *
|
||||
resolver (void)
|
||||
{
|
||||
@ -42,6 +45,7 @@ resolver (void)
|
||||
*p = 0;
|
||||
return implementation;
|
||||
}
|
||||
DIAG_POP_NEEDS_COMMENT_CLANG;
|
||||
|
||||
static void magic (void) __attribute__ ((ifunc ("resolver")));
|
||||
|
||||
|
@ -86,6 +86,7 @@
|
||||
|
||||
/* Obtain the definition of symbol_version_reference. */
|
||||
#include <libc-symver.h>
|
||||
#include <libc-diag.h>
|
||||
|
||||
/* When PIC is defined and SHARED isn't defined, we are building PIE
|
||||
by default. */
|
||||
@ -685,7 +686,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__)
|
||||
|
Loading…
Reference in New Issue
Block a user