From: Andrew Cooper Date: Thu, 22 Mar 2018 11:50:50 +0000 (+0000) Subject: Introduce and use __maybe_unused X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=f14c17397fe330fbd3d747804bb85d690cea6064;p=people%2Fandrewcoop%2Fxen-test-framework.git Introduce and use __maybe_unused This allows for the 32bit ifdefary of ex_pf_user to be dropped without suffering a warning in the 64bit build, while still allowing LTO to drop the function. Signed-off-by: Andrew Cooper --- diff --git a/Doxyfile b/Doxyfile index afb55e9..75f2b34 100644 --- a/Doxyfile +++ b/Doxyfile @@ -2032,6 +2032,7 @@ PREDEFINED = __alias(x)= \ __page_aligned_bss \ __page_aligned_data \ __printf(x,y)= \ + __maybe_unused \ __noinline \ __noreturn \ __used \ diff --git a/arch/x86/pv/traps.c b/arch/x86/pv/traps.c index ca0b9a3..bbc9377 100644 --- a/arch/x86/pv/traps.c +++ b/arch/x86/pv/traps.c @@ -73,8 +73,8 @@ int xtf_set_idte(unsigned int vector, struct xtf_idte *idte) return hypercall_set_trap_table(ti); } -#ifdef __i386__ -static bool ex_pf_user(struct cpu_regs *regs, const struct extable_entry *ex) +static bool __maybe_unused ex_pf_user(struct cpu_regs *regs, + const struct extable_entry *ex) { if ( regs->entry_vector == X86_EXC_PF && read_cr2() == 0xfff ) { @@ -86,7 +86,6 @@ static bool ex_pf_user(struct cpu_regs *regs, const struct extable_entry *ex) return false; } -#endif void arch_init_traps(void) { diff --git a/include/xtf/compiler.h b/include/xtf/compiler.h index b148687..2cc7d22 100644 --- a/include/xtf/compiler.h +++ b/include/xtf/compiler.h @@ -10,6 +10,7 @@ #define __noreturn __attribute__((__noreturn__)) #define __packed __attribute__((__packed__)) #define __printf(f, v) __attribute__((__format__(__printf__, f, v))) +#define __maybe_unused __attribute__((__unused__)) #define __used __attribute__((__used__)) #define __weak __attribute__((__weak__))