[PATCH] cris: bug: add unreachable() to silence warnings

From: Nick Krause
Date: Thu Aug 07 2014 - 00:01:52 EST


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@xxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/