linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] asm-generic: bug.h: add unreachable() in BUG() for CONFIG_BUG not set
@ 2021-10-17 17:49 Randy Dunlap
  2021-10-17 19:09 ` Arnd Bergmann
  0 siblings, 1 reply; 7+ messages in thread
From: Randy Dunlap @ 2021-10-17 17:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Randy Dunlap, Arnd Bergmann, linux-arch, Geert Uytterhoeven,
	linux-m68k

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-10-17 20:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-17 17:49 [PATCH] asm-generic: bug.h: add unreachable() in BUG() for CONFIG_BUG not set Randy Dunlap
2021-10-17 19:09 ` Arnd Bergmann
2021-10-17 19:17   ` Randy Dunlap
2021-10-17 19:24     ` Arnd Bergmann
2021-10-17 19:27       ` Randy Dunlap
2021-10-17 19:38         ` Arnd Bergmann
2021-10-17 20:16           ` Randy Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).