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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
Cc: Arnd Bergmann <arnd@xxxxxxxx>
Cc: linux-arch@xxxxxxxxxxxxxxx
Cc: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Cc: linux-m68k@xxxxxxxxxxxxxxxxxxxx
---
 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



[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux