* [PATCH 1/1] bug: Add unreachable() to generic BUG() to silence warnings
@ 2014-08-07 1:13 Nick Krause
2014-08-07 5:06 ` Josh Triplett
0 siblings, 1 reply; 2+ messages in thread
From: Nick Krause @ 2014-08-07 1:13 UTC (permalink / raw)
To: Arnd Bergmann, open list:GENERIC INCLUDE/A..., open list; +Cc: josh
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>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] bug: Add unreachable() to generic BUG() to silence warnings
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
0 siblings, 0 replies; 2+ messages in thread
From: Josh Triplett @ 2014-08-07 5:06 UTC (permalink / raw)
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 <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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-08-07 5:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).