Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MN10300: Stop gcc from generating uninitialised variable warnings after BUG()

Stop gcc from generating uninitialised variable warnings after BUG(). The
problem is that MN10300's implementation of BUG() invokes system call 15 which
doesn't return - but there's no way to tell the compiler that and also emit the
bug table element with the correct file and line data.

So instead, we make the do...while wrapper in _debug_bug_trap() an endless loop
from which there's no escape.

Also, while we're at it, (1) get rid of _debug_bug_trap() and just implement
directly as BUG(), and (2) make the implementation of BUG() contingent on
CONFIG_BUG=y.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

David Howells and committed by
Linus Torvalds
616df135 76d320a5

+6 -4
+6 -4
arch/mn10300/include/asm/bug.h
··· 11 11 #ifndef _ASM_BUG_H 12 12 #define _ASM_BUG_H 13 13 14 + #ifdef CONFIG_BUG 15 + 14 16 /* 15 17 * Tell the user there is some problem. 16 18 */ 17 - #define _debug_bug_trap() \ 19 + #define BUG() \ 18 20 do { \ 19 21 asm volatile( \ 20 22 " syscall 15 \n" \ ··· 27 25 : \ 28 26 : "i"(__FILE__), "i"(__LINE__) \ 29 27 ); \ 30 - } while (0) 31 - 32 - #define BUG() _debug_bug_trap() 28 + } while (1) 33 29 34 30 #define HAVE_ARCH_BUG 31 + #endif /* CONFIG_BUG */ 32 + 35 33 #include <asm-generic/bug.h> 36 34 37 35 #endif /* _ASM_BUG_H */