All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sh: bug: add unreachable() to silence warnings
@ 2014-08-07  1:42 ` Nick Krause
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Krause @ 2014-08-07  1:42 UTC (permalink / raw)
  To: Magnus Damm, Geert Uytterhoeven, Simon Horman,
	GitAuthor: Nick Krause, open list:SUPERH, open list
  Cc: josh

SuperH 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 becuase of which I guess
it does not showthese errors. We can silence them using unreachable().

Signed-off-by: Nick Krause <xerofoify@gmail.com>
---
 arch/sh/include/asm/bug.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/sh/include/asm/bug.h b/arch/sh/include/asm/bug.h
index dcf2780..1ae948f 100644
--- a/arch/sh/include/asm/bug.h
+++ b/arch/sh/include/asm/bug.h
@@ -48,6 +48,7 @@ do {							\
 		   "i" (__FILE__),			\
 		   "i" (__LINE__), "i" (0),		\
 		   "i" (sizeof(struct bug_entry)));	\
+	unreachable();					\
 } while (0)
 
 #define __WARN_TAINT(taint)				\
-- 
2.0.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] sh: bug: add unreachable() to silence warnings
@ 2014-08-07  1:42 ` Nick Krause
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Krause @ 2014-08-07  1:42 UTC (permalink / raw)
  To: Magnus Damm, Geert Uytterhoeven, Simon Horman,
	GitAuthor: Nick Krause, open list:SUPERH, open list
  Cc: josh

SuperH 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 becuase of which I guess
it does not showthese errors. We can silence them using unreachable().

Signed-off-by: Nick Krause <xerofoify@gmail.com>
---
 arch/sh/include/asm/bug.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/sh/include/asm/bug.h b/arch/sh/include/asm/bug.h
index dcf2780..1ae948f 100644
--- a/arch/sh/include/asm/bug.h
+++ b/arch/sh/include/asm/bug.h
@@ -48,6 +48,7 @@ do {							\
 		   "i" (__FILE__),			\
 		   "i" (__LINE__), "i" (0),		\
 		   "i" (sizeof(struct bug_entry)));	\
+	unreachable();					\
 } while (0)
 
 #define __WARN_TAINT(taint)				\
-- 
2.0.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] sh: bug: add unreachable() to silence warnings
  2014-08-07  1:42 ` Nick Krause
@ 2014-08-07  5:10   ` Josh Triplett
  -1 siblings, 0 replies; 4+ messages in thread
From: Josh Triplett @ 2014-08-07  5:10 UTC (permalink / raw)
  To: Nick Krause
  Cc: Magnus Damm, Geert Uytterhoeven, Simon Horman, open list:SUPERH,
	open list

On Thu, Aug 07, 2014 at 03:42:20AM +0200, Nick Krause wrote:
> SuperH 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 becuase of which I guess
> it does not showthese errors. We can silence them using unreachable().
> 
> Signed-off-by: Nick Krause <xerofoify@gmail.com>

This change seems reasonable to me.  Unlike the generic version of
BUG(), this one doesn't call panic() or anything else flagged as
__noreturn, so it seems reasonable to add a call to unreachable() here
to tell the compiler that the assembly will trap and not return.

Reviewed-by: Josh Triplett <josh@joshtriplett.org>

>  arch/sh/include/asm/bug.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/sh/include/asm/bug.h b/arch/sh/include/asm/bug.h
> index dcf2780..1ae948f 100644
> --- a/arch/sh/include/asm/bug.h
> +++ b/arch/sh/include/asm/bug.h
> @@ -48,6 +48,7 @@ do {							\
>  		   "i" (__FILE__),			\
>  		   "i" (__LINE__), "i" (0),		\
>  		   "i" (sizeof(struct bug_entry)));	\
> +	unreachable();					\
>  } while (0)
>  
>  #define __WARN_TAINT(taint)				\
> -- 
> 2.0.1
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] sh: bug: add unreachable() to silence warnings
@ 2014-08-07  5:10   ` Josh Triplett
  0 siblings, 0 replies; 4+ messages in thread
From: Josh Triplett @ 2014-08-07  5:10 UTC (permalink / raw)
  To: Nick Krause
  Cc: Magnus Damm, Geert Uytterhoeven, Simon Horman, open list:SUPERH,
	open list

On Thu, Aug 07, 2014 at 03:42:20AM +0200, Nick Krause wrote:
> SuperH 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 becuase of which I guess
> it does not showthese errors. We can silence them using unreachable().
> 
> Signed-off-by: Nick Krause <xerofoify@gmail.com>

This change seems reasonable to me.  Unlike the generic version of
BUG(), this one doesn't call panic() or anything else flagged as
__noreturn, so it seems reasonable to add a call to unreachable() here
to tell the compiler that the assembly will trap and not return.

Reviewed-by: Josh Triplett <josh@joshtriplett.org>

>  arch/sh/include/asm/bug.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/sh/include/asm/bug.h b/arch/sh/include/asm/bug.h
> index dcf2780..1ae948f 100644
> --- a/arch/sh/include/asm/bug.h
> +++ b/arch/sh/include/asm/bug.h
> @@ -48,6 +48,7 @@ do {							\
>  		   "i" (__FILE__),			\
>  		   "i" (__LINE__), "i" (0),		\
>  		   "i" (sizeof(struct bug_entry)));	\
> +	unreachable();					\
>  } while (0)
>  
>  #define __WARN_TAINT(taint)				\
> -- 
> 2.0.1
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-08-07  5:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-07  1:42 [PATCH] sh: bug: add unreachable() to silence warnings Nick Krause
2014-08-07  1:42 ` Nick Krause
2014-08-07  5:10 ` Josh Triplett
2014-08-07  5:10   ` Josh Triplett

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.