Skip to contentSkip to conversation

cris: bug: add unreachable() to silence warnings

PATCH In review Nick Krause 2 participants 2 messages Aug 7, 2014 – Aug 11, 2014 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cris: bug: add unreachable() to silence warnings

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().

---
 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(-)
arch/cris/include/arch-v10/arch/bug.h +4 -1
index 3485d6b..40e65ad 100644
@@ -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
arch/cris/include/arch-v32/arch/bug.h +4 -1
index 0f211e1..55350a3 100644
@@ -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
Signature · 1 line
2.0.1

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Agreed. If you include that, I will ack it

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

arch/cris/include/arch-v32/arch/bug.h line 27

Quoted 5 lines · Nick Krause
arch/cris/include/arch-v32/arch/bug.h +3 -1
 			      ".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