linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josh Triplett <josh@joshtriplett.org>
To: Nick Krause <xerofoiify@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	"open list:GENERIC INCLUDE/A..." <linux-arch@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] bug: Add unreachable() to generic BUG() to silence warnings
Date: Wed, 6 Aug 2014 22:06:54 -0700	[thread overview]
Message-ID: <20140807050654.GA2340@thin> (raw)
In-Reply-To: <1407374021-20682-1-git-send-email-xerofoiify@gmail.com>

On Thu, Aug 07, 2014 at 03:13:41AM +0200, Nick Krause wrote:
> Architectures which use generic BUG() have warnings like 
> 
> kernel/sched/core.c:2692:1: warning: control reaches end of non-void function [-Wreturn-type]
> net/core/ethtool.c:236:1: warning: control reaches end of non-void function [-Wreturn-type]
> 
> Other BUG() implementations
> have added unreachable() at end but generic does not. I guess
> that is why
> it showing these errors. We can silence them using unreachable().
> 
> Signed-off-by: Nick Krause <xerofoify@gmail.com>

You shouldn't see those warnings.  panic() has __noreturn set, which
should have exactly the same effect.

>  include/asm-generic/bug.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
> index 630dd23..effcc82 100644
> --- a/include/asm-generic/bug.h
> +++ b/include/asm-generic/bug.h
> @@ -48,6 +48,7 @@ struct bug_entry {
>  #define BUG() do { \
>  	printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \
>  	panic("BUG!"); \
> +	unreachable(); \
>  } while (0)
>  #endif
>  
> -- 
> 2.0.1
> 

      reply	other threads:[~2014-08-07  5:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-07  1:13 [PATCH 1/1] bug: Add unreachable() to generic BUG() to silence warnings Nick Krause
2014-08-07  5:06 ` Josh Triplett [this message]

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=20140807050654.GA2340@thin \
    --to=josh@joshtriplett.org \
    --cc=arnd@arndb.de \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xerofoiify@gmail.com \
    /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).