aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/compiler.h
diff options
context:
space:
mode:
authorDavid Daney <ddaney@caviumnetworks.com>2009-12-04 20:44:50 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-05 12:10:12 -0500
commit38938c879eb0c39edf85d5164aa0cffe2874304c (patch)
treefdcc22972a02219dcb385dae868f6e708523dfe7 /include/linux/compiler.h
parent22763c5cf3690a681551162c15d34d935308c8d7 (diff)
Add support for GCC-4.5's __builtin_unreachable() to compiler.h (v2)
Starting with version 4.5, GCC has a new built-in function __builtin_unreachable() that can be used in places like the kernel's BUG() where inline assembly is used to transfer control flow. This eliminated the need for an endless loop in these places. The patch adds a new macro 'unreachable()' that will expand to either __builtin_unreachable() or an endless loop depending on the compiler version. Change from v1: Simplify unreachable() for non-GCC 4.5 case. Signed-off-by: David Daney <ddaney@caviumnetworks.com> Acked-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/compiler.h')
-rw-r--r--include/linux/compiler.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 04fb5135b4e1..59f208926d13 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -144,6 +144,11 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
144# define barrier() __memory_barrier() 144# define barrier() __memory_barrier()
145#endif 145#endif
146 146
147/* Unreachable code */
148#ifndef unreachable
149# define unreachable() do { } while (1)
150#endif
151
147#ifndef RELOC_HIDE 152#ifndef RELOC_HIDE
148# define RELOC_HIDE(ptr, off) \ 153# define RELOC_HIDE(ptr, off) \
149 ({ unsigned long __ptr; \ 154 ({ unsigned long __ptr; \