Thread (7 messages) 7 messages, 2 authors, 2021-10-17
STALE1809d

[PATCH] asm-generic: bug.h: add unreachable() in BUG() for CONFIG_BUG not set

From: Randy Dunlap <rdunlap@infradead.org>
Date: 2021-10-17 17:49:13
Also in: linux-m68k, lkml

When CONFIG_BUG is not set/enabled, there is a warning
on ARCH=m68k, gcc version 11.1.0-nolibc from Arnd's crosstools:

../fs/afs/dir.c: In function 'afs_dir_set_page_dirty':
../fs/afs/dir.c:51:1: error: no return statement in function returning non-void [-Werror=return-type]

Adding "unreachable()" in the BUG() macro silences the warning.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-arch@vger.kernel.org
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org
---
 include/asm-generic/bug.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--- linux-next-20211015.orig/include/asm-generic/bug.h
+++ linux-next-20211015/include/asm-generic/bug.h
@@ -154,7 +154,7 @@ void __warn(const char *file, int line,
 
 #else /* !CONFIG_BUG */
 #ifndef HAVE_ARCH_BUG
-#define BUG() do {} while (1)
+#define BUG() do {unreachable();} while (1)
 #endif
 
 #ifndef HAVE_ARCH_BUG_ON
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help