From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [PATCH v5 2/5] xen/compiler: Replace opencoded __attribute__((noreturn))
Date: Fri, 28 Feb 2014 18:07:51 +0000 [thread overview]
Message-ID: <1393610874-27492-3-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1393610874-27492-1-git-send-email-andrew.cooper3@citrix.com>
Make a formal define for noreturn in compiler.h, and fix up opencoded uses of
__attribute__((noreturn)). This includes removing redundant uses with
function definitions which have a public declaration.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Reviewed-by: Jan Beulich <JBeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
---
xen/arch/arm/early_printk.c | 2 +-
xen/arch/x86/efi/boot.c | 4 ++--
xen/arch/x86/shutdown.c | 2 +-
xen/include/asm-arm/early_printk.h | 4 ++--
xen/include/asm-x86/processor.h | 2 +-
xen/include/xen/compiler.h | 2 ++
xen/include/xen/lib.h | 2 +-
xen/include/xen/sched.h | 4 ++--
8 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/xen/arch/arm/early_printk.c b/xen/arch/arm/early_printk.c
index 41938bb..2870a30 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 __init
early_panic(const char *fmt, ...)
{
va_list args;
diff --git a/xen/arch/x86/efi/boot.c b/xen/arch/x86/efi/boot.c
index 0dd935c..a26e0af 100644
--- a/xen/arch/x86/efi/boot.c
+++ b/xen/arch/x86/efi/boot.c
@@ -183,7 +183,7 @@ static bool_t __init match_guid(const EFI_GUID *guid1, const EFI_GUID *guid2)
!memcmp(guid1->Data4, guid2->Data4, sizeof(guid1->Data4));
}
-static void __init __attribute__((__noreturn__)) blexit(const CHAR16 *str)
+static void __init noreturn blexit(const CHAR16 *str)
{
if ( str )
PrintStr((CHAR16 *)str);
@@ -762,7 +762,7 @@ static void __init relocate_trampoline(unsigned long phys)
*(u16 *)(*trampoline_ptr + (long)trampoline_ptr) = phys >> 4;
}
-void EFIAPI __init __attribute__((__noreturn__))
+void EFIAPI __init noreturn
efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
{
static EFI_GUID __initdata loaded_image_guid = LOADED_IMAGE_PROTOCOL;
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..8047141 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 noreturn early_panic(const char *fmt, ...)
__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/asm-x86/processor.h b/xen/include/asm-x86/processor.h
index 4629b32..4da545e 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -550,7 +550,7 @@ DECLARE_TRAP_HANDLER(spurious_interrupt_bug);
void trap_nop(void);
void enable_nmis(void);
-void __attribute__((noreturn)) do_nmi_crash(struct cpu_user_regs *regs);
+void noreturn do_nmi_crash(struct cpu_user_regs *regs);
void syscall_enter(void);
void sysenter_entry(void);
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..0d1a5d3 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 noreturn __bug(char *file, int line);
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 fb8bd36..00f0eba 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -580,7 +580,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 noreturn __domain_crash_synchronous(void);
#define domain_crash_synchronous() do { \
printk("domain_crash_sync called from %s:%d\n", __FILE__, __LINE__); \
__domain_crash_synchronous(); \
@@ -591,7 +591,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 noreturn asm_domain_crash_synchronous(unsigned long addr);
#define set_current_state(_s) do { current->state = (_s); } while (0)
void scheduler_init(void);
--
1.7.10.4
next prev parent reply other threads:[~2014-02-28 18:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-28 18:07 [PATCH v5 0/5] Improvements with noreturn Andrew Cooper
2014-02-28 18:07 ` [PATCH v5 1/5] x86/crash: Fix up declaration of do_nmi_crash() Andrew Cooper
2014-02-28 18:07 ` Andrew Cooper [this message]
2014-02-28 18:07 ` [PATCH v5 3/5] xen: Identify panic and reboot/halt functions as noreturn Andrew Cooper
2014-03-11 11:13 ` Ian Campbell
2014-02-28 18:07 ` [PATCH v5 4/5] xen: Misc cleanup as a result of the previous patches Andrew Cooper
2014-02-28 18:07 ` [PATCH v5 5/5] xen/x86: Identify reset_stack_and_jump() as noreturn Andrew Cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1393610874-27492-3-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).