xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Julien Grall <julien.grall@linaro.org>, xen-devel@lists.xenproject.org
Cc: tim@xen.org, patches@linaro.org, Keir Fraser <keir@xen.org>,
	ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com
Subject: Re: [RFC 5/6] xen/console: Add noreturn attribute to panic function
Date: Sun, 5 Jan 2014 22:44:04 +0000	[thread overview]
Message-ID: <52C9E034.1020707@citrix.com> (raw)
In-Reply-To: <1388957191-10337-6-git-send-email-julien.grall@linaro.org>

On 05/01/2014 21:26, Julien Grall wrote:
> 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>

I have a longer series doing rather more noreturn'ing than just this, if
you can wait until the 4.5 dev window opens up again.

~Andrew

> ---
>  xen/drivers/char/console.c | 4 +++-
>  xen/include/xen/lib.h      | 2 +-
>  2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
> index f83c92e..229d48a 100644
> --- a/xen/drivers/char/console.c
> +++ b/xen/drivers/char/console.c
> @@ -1049,7 +1049,7 @@ __initcall(debugtrace_init);
>   * **************************************************************
>   */
>  
> -void panic(const char *fmt, ...)
> +void __attribute__((noreturn)) panic(const char *fmt, ...)
>  {
>      va_list args;
>      unsigned long flags;
> @@ -1092,6 +1092,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);

  reply	other threads:[~2014-01-05 22:44 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-05 21:26 [RFC 0/6] xen/arm: Merge early_printk function in console code Julien Grall
2014-01-05 21:26 ` [RFC 1/6] xen/arm: earlyprintk: move early_flush in early_puts Julien Grall
2014-02-19 11:13   ` Ian Campbell
2014-01-05 21:26 ` [RFC 2/6] xen/arm: earlyprintk: export early_puts Julien Grall
2014-02-19 11:14   ` Ian Campbell
2014-01-05 21:26 ` [RFC 3/6] xen/arm: Rename EARLY_PRINTK compile option to CONFIG_EARLY_PRINTK Julien Grall
2014-02-19 11:16   ` Ian Campbell
2014-01-05 21:26 ` [RFC 4/6] xen/console: Add support for early printk Julien Grall
2014-02-19 11:19   ` Ian Campbell
2014-02-20 16:38     ` Julien Grall
2014-01-05 21:26 ` [RFC 5/6] xen/console: Add noreturn attribute to panic function Julien Grall
2014-01-05 22:44   ` Andrew Cooper [this message]
2014-01-06 11:39     ` Julien Grall
2014-01-06 11:42       ` Andrew Cooper
2014-01-06 11:46         ` Julien Grall
2014-01-05 21:26 ` [RFC 6/6] xen/arm: Replace early_printk call to printk call Julien Grall
2014-02-19 11:20   ` Ian Campbell
2014-02-19 17:56     ` Julien Grall
2014-02-20  9:04       ` Ian Campbell
2014-02-20 11:01         ` Julien Grall
2014-02-20 11:05           ` Ian Campbell
2014-02-20 11:14             ` Julien Grall
2014-02-20 11:20               ` Ian Campbell
2014-02-20 11:37                 ` Julien Grall
2014-02-20 13:02                   ` Ian Campbell
2014-02-19 12:33   ` Ian Campbell
2014-03-05  7:53     ` Julien Grall

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=52C9E034.1020707@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=julien.grall@linaro.org \
    --cc=keir@xen.org \
    --cc=patches@linaro.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xenproject.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).