Add an unreachable() macro function that panics if reached
This commit is contained in:
parent
a89ae9bed7
commit
23d405bbda
@ -1,5 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <luna/Attributes.h>
|
|
||||||
|
|
||||||
[[noreturn]] extern bool __check_failed(const char* file, const char* line, const char* func, const char* expr);
|
[[noreturn]] extern bool __check_failed(const char* file, const char* line, const char* func, const char* expr);
|
||||||
|
|
||||||
@ -23,3 +22,6 @@
|
|||||||
__check_failed(__FILE__, STRINGIZE_VALUE_OF(__LINE__), __PRETTY_FUNCTION__, #expr); \
|
__check_failed(__FILE__, STRINGIZE_VALUE_OF(__LINE__), __PRETTY_FUNCTION__, #expr); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#define unreachable() \
|
||||||
|
__check_failed(__FILE__, STRINGIZE_VALUE_OF(__LINE__), __PRETTY_FUNCTION__, "Reached unreachable code")
|
||||||
|
Loading…
Reference in New Issue
Block a user