[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 1/2] xen/compiler: Replace opencoded __attribute__((noreturn))
Make a formal define for noreturn in compiler.h, and replace opencoded uses of __attribute__((noreturn)). There is a stale statement in sh_skip_sync(); BUG() now contains unreachable(), removing the justification for having "return 0". Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CC: Keir Fraser <keir@xxxxxxx> CC: Jan Beulich <JBeulich@xxxxxxxx> CC: Ian Campbell <ian.campbell@xxxxxxxxxx> CC: Stefano Stabellini <stefano.stabellini@xxxxxxxxxx> CC: Tim Deegan <tim@xxxxxxx> --- I have compile tested this for both arm32 and arm64 --- xen/arch/arm/early_printk.c | 2 +- xen/arch/x86/crash.c | 2 +- xen/arch/x86/mm/shadow/common.c | 1 - xen/arch/x86/shutdown.c | 2 +- xen/include/asm-arm/early_printk.h | 4 ++-- xen/include/xen/compiler.h | 2 ++ xen/include/xen/lib.h | 2 +- xen/include/xen/sched.h | 4 ++-- 8 files changed, 10 insertions(+), 9 deletions(-) diff --git a/xen/arch/arm/early_printk.c b/xen/arch/arm/early_printk.c index 058d044..00ec72a 100644 --- a/xen/arch/arm/early_printk.c +++ b/xen/arch/arm/early_printk.c @@ -52,7 +52,7 @@ void __init early_printk(const char *fmt, ...) va_end(args); } -void __attribute__((noreturn)) __init +void noreturn __init early_panic(const char *fmt, ...) { va_list args; diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c index 01fd906..836babb 100644 --- a/xen/arch/x86/crash.c +++ b/xen/arch/x86/crash.c @@ -36,7 +36,7 @@ static unsigned int crashing_cpu; static DEFINE_PER_CPU_READ_MOSTLY(bool_t, crash_save_done); /* This becomes the NMI handler for non-crashing CPUs, when Xen is crashing. */ -void __attribute__((noreturn)) do_nmi_crash(struct cpu_user_regs *regs) +void noreturn do_nmi_crash(struct cpu_user_regs *regs) { int cpu = smp_processor_id(); diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c index 0bfa595..c1a416c 100644 --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -875,7 +875,6 @@ static int sh_skip_sync(struct vcpu *v, mfn_t gl1mfn) SHADOW_ERROR("gmfn %#lx was OOS but not shadowed as an l1.\n", mfn_x(gl1mfn)); BUG(); - return 0; /* BUG() is no longer __attribute__((noreturn)). */ } diff --git a/xen/arch/x86/shutdown.c b/xen/arch/x86/shutdown.c index 6eba271..6143c40 100644 --- a/xen/arch/x86/shutdown.c +++ b/xen/arch/x86/shutdown.c @@ -85,7 +85,7 @@ static inline void kb_wait(void) break; } -static void __attribute__((noreturn)) __machine_halt(void *unused) +static void noreturn __machine_halt(void *unused) { local_irq_disable(); for ( ; ; ) diff --git a/xen/include/asm-arm/early_printk.h b/xen/include/asm-arm/early_printk.h index 707bbf7..3cb8dab 100644 --- a/xen/include/asm-arm/early_printk.h +++ b/xen/include/asm-arm/early_printk.h @@ -26,7 +26,7 @@ void early_printk(const char *fmt, ...) __attribute__((format (printf, 1, 2))); -void early_panic(const char *fmt, ...) __attribute__((noreturn)) +void early_panic(const char *fmt, ...) noreturn __attribute__((format (printf, 1, 2))); #else @@ -35,7 +35,7 @@ static inline __attribute__((format (printf, 1, 2))) void early_printk(const char *fmt, ...) {} -static inline void __attribute__((noreturn)) +static inline void noreturn __attribute__((format (printf, 1, 2))) early_panic(const char *fmt, ...) {while(1);} diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h index 7d6805c..c80398d 100644 --- a/xen/include/xen/compiler.h +++ b/xen/include/xen/compiler.h @@ -14,6 +14,8 @@ #define always_inline __inline__ __attribute__ ((always_inline)) #define noinline __attribute__((noinline)) +#define noreturn __attribute__((noreturn)) + #if (!defined(__clang__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 5)) #define unreachable() do {} while (1) #else diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h index 5b258fd..814fcb4 100644 --- a/xen/include/xen/lib.h +++ b/xen/include/xen/lib.h @@ -8,7 +8,7 @@ #include <xen/string.h> #include <asm/bug.h> -void __bug(char *file, int line) __attribute__((noreturn)); +void __bug(char *file, int line) noreturn; void __warn(char *file, int line); #define BUG_ON(p) do { if (unlikely(p)) BUG(); } while (0) diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index cbdf377..0d2a442 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -578,7 +578,7 @@ void __domain_crash(struct domain *d); * Mark current domain as crashed and synchronously deschedule from the local * processor. This function never returns. */ -void __domain_crash_synchronous(void) __attribute__((noreturn)); +void __domain_crash_synchronous(void) noreturn; #define domain_crash_synchronous() do { \ printk("domain_crash_sync called from %s:%d\n", __FILE__, __LINE__); \ __domain_crash_synchronous(); \ @@ -589,7 +589,7 @@ void __domain_crash_synchronous(void) __attribute__((noreturn)); * the crash occured. If addr is 0, look up address from last extable * redirection. */ -void asm_domain_crash_synchronous(unsigned long addr) __attribute__((noreturn)); +void asm_domain_crash_synchronous(unsigned long addr) noreturn; #define set_current_state(_s) do { current->state = (_s); } while (0) void scheduler_init(void); -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |