mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] cris: bug: add unreachable() to silence warnings
@ 2014-08-07  4:01 Nick Krause
       [not found] ` <53E32982.6010409@redhat.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Nick Krause @ 2014-08-07  4:01 UTC (permalink / raw)
  To: Mikael Starvik, Jesper Nilsson, GitAuthor: Nick Krause,
	open list:CRIS PORT, open list

Cris BUG() have warnings like

drivers/memstick/core/ms_block.c:677:1: warning: control reaches end of non-void function 
drivers/memstick/core/ms_block.c:720:1: warning: control reaches end of non-void function 
drivers/memstick/core/ms_block.c:654:1: warning: control reaches end of non-void function 
drivers/memstick/core/ms_block.c:465:1: warning: control reaches end of non-void function 
drivers/memstick/core/mspro_block.c:663:1: warning: control reaches end of non-void function 

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/cris/include/arch-v10/arch/bug.h | 5 ++++-
 arch/cris/include/arch-v32/arch/bug.h | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/cris/include/arch-v10/arch/bug.h b/arch/cris/include/arch-v10/arch/bug.h
index 3485d6b..40e65ad 100644
--- a/arch/cris/include/arch-v10/arch/bug.h
+++ b/arch/cris/include/arch-v10/arch/bug.h
@@ -43,12 +43,15 @@ struct bug_frame {
  * not be used like this with newer versions of gcc.
  */
 #define BUG()								\
+do {									\
 	__asm__ __volatile__ ("clear.d [" __stringify(BUG_MAGIC) "]\n\t"\
 			      "movu.w " __stringify(__LINE__) ",$r0\n\t"\
 			      "jump 0f\n\t"				\
 			      ".section .rodata\n"			\
 			      "0:\t.string \"" __FILE__ "\"\n\t"	\
-			      ".previous")
+			      ".previous");				\
+	unreachable();							\
+} while (0)
 #endif
 
 #else
diff --git a/arch/cris/include/arch-v32/arch/bug.h b/arch/cris/include/arch-v32/arch/bug.h
index 0f211e1..55350a3 100644
--- a/arch/cris/include/arch-v32/arch/bug.h
+++ b/arch/cris/include/arch-v32/arch/bug.h
@@ -10,6 +10,7 @@
  * All other stuff is done out-of-band with exception handlers.
  */
 #define BUG()								\
+do {									\
 	__asm__ __volatile__ ("0: break 14\n\t"				\
 			      ".section .fixup,\"ax\"\n"		\
 			      "1:\n\t"					\
@@ -21,7 +22,9 @@
 			      ".section __ex_table,\"a\"\n\t"		\
 			      ".dword 0b, 1b\n\t"			\
 			      ".previous\n\t"				\
-			      : : "ri" (__FILE__), "i" (__LINE__))
+			      : : "ri" (__FILE__), "i" (__LINE__));	\
+	unreachable();
+} while (0)
 #else
 #define BUG() __asm__ __volatile__ ("break 14\n\t")
 #endif
-- 
2.0.1


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

* RE: [PATCH] cris: bug: add unreachable() to silence warnings
       [not found] ` <53E32982.6010409@redhat.com>
@ 2014-08-11  5:36   ` Mikael Starvik
  0 siblings, 0 replies; 2+ messages in thread
From: Mikael Starvik @ 2014-08-11  5:36 UTC (permalink / raw)
  To: Maurizio Lombardi, Nick Krause, Jesper Nilsson, open, list@, open list

Agreed. If you include that, I will ack it

-----Original Message-----
From: Maurizio Lombardi [mailto:mlombard@redhat.com] 
Sent: den 7 augusti 2014 09:24
To: Nick Krause; Mikael Starvik; Jesper Nilsson; open@axis.com; list@; open list
Subject: Re: [PATCH] cris: bug: add unreachable() to silence warnings



On 08/07/2014 06:01 AM, Nick Krause wrote:
>  			      ".previous\n\t"				\
> -			      : : "ri" (__FILE__), "i" (__LINE__))
> +			      : : "ri" (__FILE__), "i" (__LINE__));	\
> +	unreachable();
> +} while (0)

Does this code compile?
There should be a trailing '\' character after "unreachable()".

Regards,
Maurizio Lombardi

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-07  4:01 [PATCH] cris: bug: add unreachable() to silence warnings Nick Krause
     [not found] ` <53E32982.6010409@redhat.com>
2014-08-11  5:36   ` Mikael Starvik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome