Skip to content

Commit

Permalink
MN10300: Stop gcc from generating uninitialised variable warnings aft…
Browse files Browse the repository at this point in the history
…er 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>
  • Loading branch information
David Howells authored and Linus Torvalds committed Apr 15, 2009
1 parent 76d320a commit 616df13
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions arch/mn10300/include/asm/bug.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
#ifndef _ASM_BUG_H
#define _ASM_BUG_H

#ifdef CONFIG_BUG

/*
* Tell the user there is some problem.
*/
#define _debug_bug_trap() \
#define BUG() \
do { \
asm volatile( \
" syscall 15 \n" \
Expand All @@ -25,11 +27,11 @@ do { \
: \
: "i"(__FILE__), "i"(__LINE__) \
); \
} while (0)

#define BUG() _debug_bug_trap()
} while (1)

#define HAVE_ARCH_BUG
#endif /* CONFIG_BUG */

#include <asm-generic/bug.h>

#endif /* _ASM_BUG_H */

0 comments on commit 616df13

Please sign in to comment.