Skip to content

Commit 892c104

Browse files
committed
Compiler: Remove empty fallback definition for LLVM_BUILTIN_UNREACHABLE
`llvm_unreachable()` and `LLVM_ASSUME_ALIGNED` use `defined(LLVM_BUILTIN_UNREACHABLE)` to check whether it has a definition. Remove the fallback added in 2682733 (as a drive-by when updating the GCC logic) and add a comment to prevent future mistakes. Differential Revision: https://reviews.llvm.org/D122167
1 parent 1844054 commit 892c104

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

llvm/include/llvm/Support/Compiler.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,12 +321,14 @@
321321
/// LLVM_BUILTIN_UNREACHABLE - On compilers which support it, expands
322322
/// to an expression which states that it is undefined behavior for the
323323
/// compiler to reach this point. Otherwise is not defined.
324+
///
325+
/// '#else' is intentionally left out so that other macro logic (e.g.,
326+
/// LLVM_ASSUME_ALIGNED and llvm_unreachable()) can detect whether
327+
/// LLVM_BUILTIN_UNREACHABLE has a definition.
324328
#if __has_builtin(__builtin_unreachable) || defined(__GNUC__)
325329
# define LLVM_BUILTIN_UNREACHABLE __builtin_unreachable()
326330
#elif defined(_MSC_VER)
327331
# define LLVM_BUILTIN_UNREACHABLE __assume(false)
328-
#else
329-
# define LLVM_BUILTIN_UNREACHABLE
330332
#endif
331333

332334
/// LLVM_BUILTIN_TRAP - On compilers which support it, expands to an expression

0 commit comments

Comments
 (0)