[llvm-commits] [llvm] r171455 - /llvm/trunk/include/llvm/Support/Compiler.h

NAKAMURA Takumi geek4civic at gmail.com
Wed Jan 2 19:30:23 PST 2013


Author: chapuni
Date: Wed Jan  2 21:30:22 2013
New Revision: 171455

URL: http://llvm.org/viewvc/llvm-project?rev=171455&view=rev
Log:
Compiler.h: Leave LLVM_BUILTIN_UNREACHABLE undefined if it is unavailable in host compiler.

Users of LLVM_BUILTIN_UNREACHABLE should be responsible in the case when LLVM_BUILTIN_UNREACHABLE is undefined.

Actually, (0, (p)) in LLVM_ASSUME_ALIGNED(p, a) caused thousands of warnings on g++-4.4. It was a motivation in this commit.

Modified:
    llvm/trunk/include/llvm/Support/Compiler.h

Modified: llvm/trunk/include/llvm/Support/Compiler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Compiler.h?rev=171455&r1=171454&r2=171455&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Compiler.h (original)
+++ llvm/trunk/include/llvm/Support/Compiler.h Wed Jan  2 21:30:22 2013
@@ -225,8 +225,6 @@
 # define LLVM_BUILTIN_UNREACHABLE __builtin_unreachable()
 #elif defined(_MSC_VER)
 # define LLVM_BUILTIN_UNREACHABLE __assume(false)
-#else
-# define LLVM_BUILTIN_UNREACHABLE 0
 #endif
 
 /// LLVM_BUILTIN_TRAP - On compilers which support it, expands to an expression
@@ -244,9 +242,11 @@
  || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
 // FIXME: Enable on clang when it supports it.
 # define LLVM_ASSUME_ALIGNED(p, a) __builtin_assume_aligned(p, a)
-#else
+#elif defined(LLVM_BUILTIN_UNREACHABLE)
 # define LLVM_ASSUME_ALIGNED(p, a) \
            (((uintptr_t(p) % (a)) == 0) ? (p) : (LLVM_BUILTIN_UNREACHABLE, (p)))
+#else
+# define LLVM_ASSUME_ALIGNED(p, a) (p)
 #endif
 
 #endif





More information about the llvm-commits mailing list