mirror of
https://github.com/abseil/abseil-cpp.git
synced 2026-06-04 12:07:05 +08:00
Use ABSL_UNREACHABLE() instead of equivalent
PiperOrigin-RevId: 643024432 Change-Id: Id07aa18d186291442f7b6f3c68ef8dd6cc20b434
This commit is contained in:
committed by
Copybara-Service
parent
7c17d8bc53
commit
7c03b80ef2
@@ -273,20 +273,7 @@ struct UnreachableSwitchCase {
|
||||
template <class Op>
|
||||
[[noreturn]] static VisitIndicesResultT<Op, std::size_t> Run(
|
||||
Op&& /*ignored*/) {
|
||||
#if ABSL_HAVE_BUILTIN(__builtin_unreachable) || \
|
||||
(defined(__GNUC__) && !defined(__clang__))
|
||||
__builtin_unreachable();
|
||||
#elif defined(_MSC_VER)
|
||||
__assume(false);
|
||||
#else
|
||||
// Try to use assert of false being identified as an unreachable intrinsic.
|
||||
// NOTE: We use assert directly to increase chances of exploiting an assume
|
||||
// intrinsic.
|
||||
assert(false); // NOLINT
|
||||
|
||||
// Hack to silence potential no return warning -- cause an infinite loop.
|
||||
return Run(std::forward<Op>(op));
|
||||
#endif // Checks for __builtin_unreachable
|
||||
ABSL_UNREACHABLE();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user