Message ID | 1393253572-7157-6-git-send-email-julien.grall@linaro.org |
---|---|
State | Rejected, archived |
Headers | show |
On 02/24/2014 03:24 PM, Jan Beulich wrote: >>>> On 24.02.14 at 15:52, Julien Grall <julien.grall@linaro.org> wrote: >> -void panic(const char *fmt, ...) >> +void __attribute__((noreturn)) panic(const char *fmt, ...) >> { >> va_list args; >> unsigned long flags; >> @@ -1085,6 +1085,8 @@ void panic(const char *fmt, ...) >> watchdog_disable(); >> machine_restart(5000); >> } >> + >> + while ( 1 ); > > The canonical thing here would be "for ( ; ; );", since there are > compilers warning about the literal 1 in what you propose. With Andrew's patch series I don't need this patch anymore. I will drop it.
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c index cdf23f1..f17848b 100644 --- a/xen/drivers/char/console.c +++ b/xen/drivers/char/console.c @@ -1042,7 +1042,7 @@ __initcall(debugtrace_init); * ************************************************************** */ -void panic(const char *fmt, ...) +void __attribute__((noreturn)) panic(const char *fmt, ...) { va_list args; unsigned long flags; @@ -1085,6 +1085,8 @@ void panic(const char *fmt, ...) watchdog_disable(); machine_restart(5000); } + + while ( 1 ); } void __bug(char *file, int line) diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h index 5b258fd..9c3a242 100644 --- a/xen/include/xen/lib.h +++ b/xen/include/xen/lib.h @@ -88,7 +88,7 @@ extern void printk(const char *format, ...) extern void guest_printk(const struct domain *d, const char *format, ...) __attribute__ ((format (printf, 2, 3))); extern void panic(const char *format, ...) - __attribute__ ((format (printf, 1, 2))); + __attribute__ ((format (printf, 1, 2))) __attribute__ ((noreturn)); extern long vm_assist(struct domain *, unsigned int, unsigned int); extern int __printk_ratelimit(int ratelimit_ms, int ratelimit_burst); extern int printk_ratelimit(void);
Panic function will never return. Without this attribute, gcc may output warnings in call function. Cc: Keir Fraser <keir@xen.org> Signed-off-by: Julien Grall <julien.grall@linaro.org> --- xen/drivers/char/console.c | 4 +++- xen/include/xen/lib.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-)