From: David Blaikie Date: Tue, 21 Aug 2012 18:54:21 +0000 (+0000) Subject: Provide a portability macro for __builtin_trap. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=74169b293f2fc8767db3c659fde6b001b7d5075f;p=oota-llvm.git Provide a portability macro for __builtin_trap. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162300 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Support/Compiler.h b/include/llvm/Support/Compiler.h index 4469ae31de0..ea0a4da27f1 100644 --- a/include/llvm/Support/Compiler.h +++ b/include/llvm/Support/Compiler.h @@ -187,4 +187,13 @@ # define LLVM_BUILTIN_UNREACHABLE __builtin_unreachable() #endif +// LLVM_BUILTIN_TRAP - On compilers which support it, expands to an expression +// which causes the program to exit abnormally. +#if defined(__clang__) || (__GNUC__ > 4) \ + || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +# define LLVM_BUILTIN_TRAP __builtin_trap() +#else +# define LLVM_BUILTIN_TRAP *(volatile int*)0x11 = 0 +#endif + #endif