mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Adds solidity::util::unreachable() helper function.
This commit is contained in:
parent
87f5865fb0
commit
927da20ce4
@ -40,6 +40,28 @@ namespace solidity::util
|
|||||||
#define ETH_FUNC __func__
|
#define ETH_FUNC __func__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
// GCC 4.8+, Clang, Intel and other compilers compatible with GCC (-std=c++0x or above)
|
||||||
|
[[noreturn]] inline __attribute__((always_inline)) void unreachable()
|
||||||
|
{
|
||||||
|
__builtin_unreachable();
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(_MSC_VER) // MSVC
|
||||||
|
|
||||||
|
[[noreturn]] __forceinline void unreachable()
|
||||||
|
{
|
||||||
|
__assume(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
[[noreturn]] inline void unreachable()
|
||||||
|
{
|
||||||
|
solThrow(Exception, "Unreachable");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace assertions
|
namespace assertions
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user