kernel/debug: Add ASSERT_UNREACHABLE.
Under KDEBUG it panics, under non-KDEBUG it's __builtin_unreachable, allowing the compiler to optimize things a little more.
This commit is contained in:
@@ -64,9 +64,11 @@
|
|||||||
#if KDEBUG
|
#if KDEBUG
|
||||||
# define ASSERT(x) ASSERT_ALWAYS(x)
|
# define ASSERT(x) ASSERT_ALWAYS(x)
|
||||||
# define ASSERT_PRINT(x, format, args...) ASSERT_ALWAYS_PRINT(x, format, args)
|
# define ASSERT_PRINT(x, format, args...) ASSERT_ALWAYS_PRINT(x, format, args)
|
||||||
|
# define ASSERT_UNREACHABLE() panic("ASSERT UNREACHABLE (%s:%d)", __FILE__, __LINE__)
|
||||||
#else
|
#else
|
||||||
# define ASSERT(x) do { } while(0)
|
# define ASSERT(x) do { } while(0)
|
||||||
# define ASSERT_PRINT(x, format, args...) do { } while(0)
|
# define ASSERT_PRINT(x, format, args...) do { } while(0)
|
||||||
|
# define ASSERT_UNREACHABLE() __builtin_unreachable()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __GNUC__ >= 5 && !defined(__cplusplus)
|
#if __GNUC__ >= 5 && !defined(__cplusplus)
|
||||||
|
|||||||
Reference in New Issue
Block a user