Skip to contentSkip to conversation

sh: mark end of BUG() implementation as unreachable

PATCH Applied Kees Cook 1 participant 1 message Jun 27, 2017 SuperH

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 sh: mark end of BUG() implementation as unreachable

When building the sh architecture, the compiler doesn't realize that BUG() doesn't return, so it will complain about functions using BUG() that are marked with the noreturn attribute:

lib/string.c: In function 'fortify_panic':

Quoted 1 line
Quoted 1 line

lib/string.c:986:1: warning: 'noreturn' function does return

    }
    ^
Cc Yoshinori Sato <[email protected]>
Cc Rich Felker <[email protected]>
Cc Daniel Micay <[email protected]>
---
 arch/sh/include/asm/bug.h | 1 +
 1 file changed, 1 insertion(+)
arch/sh/include/asm/bug.h +1 -0
index 1b77f068be2b..c9828f785ca0 100644
@@ -48,6 +48,7 @@ do {							\
 		   "i" (__FILE__),			\
 		   "i" (__LINE__), "i" (0),		\
 		   "i" (sizeof(struct bug_entry)));	\
+	unreachable();					\
 } while (0)
 
 #define __WARN_FLAGS(flags)				\
Signature · 6 lines
2.7.4


-- 
Kees Cook
Pixel Security