aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/asm-x86
diff options
context:
space:
mode:
authorTim Deegan <tim@xen.org>2013-09-19 15:38:09 +0100
committerTim Deegan <tim@xen.org>2013-09-19 16:17:57 +0100
commitd2fd6f2b01ed0e1dad93ee1970233e7b54507b26 (patch)
treecf9f920bdce2fcafbf771170d7511a6d75ec2272 /xen/include/asm-x86
parentdad7e45bf44c0569546a3ed7d0fa4182a4a73f0a (diff)
downloadxen-d2fd6f2b01ed0e1dad93ee1970233e7b54507b26.tar.gz
xen-d2fd6f2b01ed0e1dad93ee1970233e7b54507b26.tar.bz2
xen-d2fd6f2b01ed0e1dad93ee1970233e7b54507b26.zip
x86: mark BUG()s and assertion failures as terminal.
This helps avoid static analysis false-positives, and might lead to better code density as the compiler knows it doesn't have to restore spilled state &c. Signed-off-by: Tim Deegan <tim@xen.org> Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/include/asm-x86')
-rw-r--r--xen/include/asm-x86/bug.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/xen/include/asm-x86/bug.h b/xen/include/asm-x86/bug.h
index e5dd559407..956bfd231f 100644
--- a/xen/include/asm-x86/bug.h
+++ b/xen/include/asm-x86/bug.h
@@ -46,12 +46,17 @@ struct bug_frame {
#define WARN() BUG_FRAME(BUGFRAME_warn, __LINE__, __FILE__, 0, NULL)
-#define BUG() BUG_FRAME(BUGFRAME_bug, __LINE__, __FILE__, 0, NULL)
+#define BUG() do { \
+ BUG_FRAME(BUGFRAME_bug, __LINE__, __FILE__, 0, NULL); \
+ unreachable(); \
+} while (0)
#define run_in_exception_handler(fn) BUG_FRAME(BUGFRAME_run_fn, 0, fn, 0, NULL)
-#define assert_failed(msg) \
- BUG_FRAME(BUGFRAME_assert, __LINE__, __FILE__, 1, msg)
+#define assert_failed(msg) do { \
+ BUG_FRAME(BUGFRAME_assert, __LINE__, __FILE__, 1, msg); \
+ unreachable(); \
+} while (0)
extern const struct bug_frame __start_bug_frames[],
__stop_bug_frames_0[],