Skip to content

Commit f412705

Browse files
committed
BOOST_LEAF_UNREACHABLE
1 parent 8d16b41 commit f412705

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

include/boost/leaf/config.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,14 @@
238238

239239
////////////////////////////////////////
240240

241+
#ifdef _MSC_VER
242+
# define BOOST_LEAF_UNREACHABLE __assume(0)
243+
#else
244+
# define BOOST_LEAF_UNREACHABLE __builtin_unreachable()
245+
#endif
246+
247+
////////////////////////////////////////
248+
241249
namespace boost
242250
{
243251
[[noreturn]] void throw_exception( std::exception const & ); // user defined

include/boost/leaf/config/tls_win32.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ namespace detail
4848
rec.ExceptionCode = status;
4949
rec.ExceptionFlags = EXCEPTION_NONCONTINUABLE;
5050
RaiseFailFastException(&rec, nullptr, 0);
51-
__assume(0);
51+
BOOST_LEAF_UNREACHABLE;
5252
}
5353

5454
template <class T, class... Args>
@@ -58,7 +58,7 @@ namespace detail
5858
if (!mem)
5959
{
6060
raise_fail_fast(STATUS_NO_MEMORY);
61-
__assume(0);
61+
BOOST_LEAF_UNREACHABLE;
6262
}
6363
return new (mem) T(static_cast<Args &&>(args)...);
6464
}
@@ -93,7 +93,7 @@ namespace detail
9393
if (void * p = HeapAlloc(GetProcessHeap(), 0, n * sizeof(T)))
9494
return static_cast<T *>(p);
9595
raise_fail_fast(STATUS_NO_MEMORY);
96-
__assume(0);
96+
BOOST_LEAF_UNREACHABLE;
9797
}
9898

9999
void deallocate(T * p, std::size_t) noexcept

0 commit comments

Comments
 (0)