Skip to contentSkip to conversation

CRISv32: add unreachable() to BUG()

PATCH Applied Rabin Vincent 2 participants 4 messages May 14, 2015 – May 17, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 CRISv32: add unreachable() to BUG()

Add an unreachable() in the BUG() implementations, to get rid of several warnings similar to the one below:

kernel/sched/core.c: In function 'pick_next_task':
kernel/sched/core.c:2690:1: warning: control reaches end of non-void function [-Wreturn-type]

---
 arch/cris/include/arch-v32/arch/bug.h | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
arch/cris/include/arch-v32/arch/bug.h +9 -2
index 0f211e1..fb59faa 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,9 +22,15 @@
 			      ".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")
+#define BUG() 					\
+do {						\
+	__asm__ __volatile__ ("break 14\n\t");	\
+	unreachable();				\
+} while (0)
 #endif
 
 #define HAVE_ARCH_BUG
Signature · 1 line
2.1.4
#1 lore raw

PATCH 2/2 CRISv32: allow CONFIG_DEBUG_BUGVERBOSE

Support for verbose BUG reporting already exists, but the HAVE flag that allows the option to be enabled is missing.

---
 arch/cris/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/cris/Kconfig +1 -0
index 0314e32..b202b82 100644
@@ -58,6 +58,7 @@ config CRIS
 	select CLKSRC_MMIO if ETRAX_ARCH_V32
 	select GENERIC_CLOCKEVENTS if ETRAX_ARCH_V32
 	select GENERIC_SCHED_CLOCK if ETRAX_ARCH_V32
+	select HAVE_DEBUG_BUGVERBOSE if ETRAX_ARCH_V32
 
 config HZ
 	int
Signature · 1 line
2.1.4
#2 lore raw

Re: [PATCH 2/2] CRISv32: allow CONFIG_DEBUG_BUGVERBOSE

Quoted 2 lines · Rabin Vincent

Support for verbose BUG reporting already exists, but the HAVE flag that allows the option to be enabled is missing.

Thanks, applied!

/^JN - Jesper Nilsson

Signature · 1 line
               Jesper Nilsson -- [email protected]
#3 lore raw
In reply to Rabin Vincent
Quoted 5 lines · Rabin Vincent

Add an unreachable() in the BUG() implementations, to get rid of several warnings similar to the one below:

kernel/sched/core.c: In function 'pick_next_task':
kernel/sched/core.c:2690:1: warning: control reaches end of non-void function [-Wreturn-type]

Thanks, applied!

/^JN - Jesper Nilsson

Signature · 1 line
               Jesper Nilsson -- [email protected]