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:
Augustin Cavalier
2024-09-02 14:16:40 -04:00
parent b973a1b377
commit b33f369dde
+2
View File
@@ -64,9 +64,11 @@
#if KDEBUG
# define ASSERT(x) ASSERT_ALWAYS(x)
# define ASSERT_PRINT(x, format, args...) ASSERT_ALWAYS_PRINT(x, format, args)
# define ASSERT_UNREACHABLE() panic("ASSERT UNREACHABLE (%s:%d)", __FILE__, __LINE__)
#else
# define ASSERT(x) do { } while(0)
# define ASSERT_PRINT(x, format, args...) do { } while(0)
# define ASSERT_UNREACHABLE() __builtin_unreachable()
#endif
#if __GNUC__ >= 5 && !defined(__cplusplus)