]> git.baikalelectronics.ru Git - kernel.git/commit
MIPS: Make BUG() __noreturn.
authorDavid Daney <ddaney@caviumnetworks.com>
Fri, 21 Nov 2008 01:26:36 +0000 (17:26 -0800)
committerRalf Baechle <ralf@linux-mips.org>
Mon, 24 Nov 2008 16:35:07 +0000 (16:35 +0000)
commit3640ad159d2da8104818ce6737e1dbad0c4ea4d5
tree77615c090cec2a726a31618e66aaac7dd10a33b1
parent6a7f399dc7dd413e6c12303f3fa8e11caf2c9817
MIPS: Make BUG() __noreturn.

Often we do things like put BUG() in the default clause of a case
statement.  Since it was not declared __noreturn, this could sometimes
lead to bogus compiler warnings that variables were used
uninitialized.

There is a small problem in that we have to put a magic while(1); loop to
fool GCC into really thinking it is noreturn.  This makes the new
BUG() function 3 instructions long instead of just 1, but I think it
is worth it as it is now unnecessary to do extra work to silence the
'used uninitialized' warnings.

I also re-wrote BUG_ON so that if it is given a constant condition, it
just does BUG() instead of loading a constant value in to a register
and testing it.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/include/asm/bug.h