From mboxrd@z Thu Jan 1 00:00:00 1970 From: Josh Triplett Subject: Re: [PATCH 1/1] bug: Add unreachable() to generic BUG() to silence warnings Date: Wed, 6 Aug 2014 22:06:54 -0700 Message-ID: <20140807050654.GA2340@thin> References: <1407374021-20682-1-git-send-email-xerofoiify@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from relay6-d.mail.gandi.net ([217.70.183.198]:44296 "EHLO relay6-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757252AbaHGFHE (ORCPT ); Thu, 7 Aug 2014 01:07:04 -0400 Content-Disposition: inline In-Reply-To: <1407374021-20682-1-git-send-email-xerofoiify@gmail.com> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Nick Krause Cc: Arnd Bergmann , "open list:GENERIC INCLUDE/A..." , open list 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 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 >