Compiler: Remove empty fallback definition for LLVM_BUILTIN_UNREACHABLE
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 21 Mar 2022 18:43:00 +0000 (11:43 -0700)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 21 Mar 2022 18:52:24 +0000 (11:52 -0700)
`llvm_unreachable()` and `LLVM_ASSUME_ALIGNED` use
`defined(LLVM_BUILTIN_UNREACHABLE)` to check whether it has a
definition. Remove the fallback added in 26827337dff26ba3 (as a drive-by
when updating the GCC logic) and add a comment to prevent future
mistakes.

Differential Revision: https://reviews.llvm.org/D122167

llvm/include/llvm/Support/Compiler.h

index e97da6b..262eca0 100644 (file)
 /// LLVM_BUILTIN_UNREACHABLE - On compilers which support it, expands
 /// to an expression which states that it is undefined behavior for the
 /// compiler to reach this point.  Otherwise is not defined.
+///
+/// '#else' is intentionally left out so that other macro logic (e.g.,
+/// LLVM_ASSUME_ALIGNED and llvm_unreachable()) can detect whether
+/// LLVM_BUILTIN_UNREACHABLE has a definition.
 #if __has_builtin(__builtin_unreachable) || defined(__GNUC__)
 # define LLVM_BUILTIN_UNREACHABLE __builtin_unreachable()
 #elif defined(_MSC_VER)
 # define LLVM_BUILTIN_UNREACHABLE __assume(false)
-#else
-# define LLVM_BUILTIN_UNREACHABLE
 #endif
 
 /// LLVM_BUILTIN_TRAP - On compilers which support it, expands to an expression