From ac46e45f6efc82caee5261221e4ffe632bc11b7d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 3 Apr 2019 12:51:10 +0200 Subject: [PATCH] Kernel: Remove unneeded kassert.h. --- AK/Assertions.h | 2 +- Kernel/Assertions.h | 14 +++++++++++++- Kernel/kassert.h | 14 -------------- 3 files changed, 14 insertions(+), 16 deletions(-) delete mode 100644 Kernel/kassert.h diff --git a/AK/Assertions.h b/AK/Assertions.h index fcc1f692a7..0898b79a17 100644 --- a/AK/Assertions.h +++ b/AK/Assertions.h @@ -1,7 +1,7 @@ #pragma once #ifdef KERNEL -#include +#include #else #include #endif diff --git a/Kernel/Assertions.h b/Kernel/Assertions.h index 29eb1b7b34..e40b26deb6 100644 --- a/Kernel/Assertions.h +++ b/Kernel/Assertions.h @@ -1,2 +1,14 @@ #pragma once -#include "kassert.h" + +#include "kprintf.h" +#include "i386.h" + +[[noreturn]] void __assertion_failed(const char* msg, const char* file, unsigned line, const char* func); + +#define ASSERT(expr) (static_cast(expr) ? (void)0 : __assertion_failed(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__)) +#define CRASH() do { asm volatile("ud2"); } while(0) +#define RELEASE_ASSERT(x) do { if (!(x)) CRASH(); } while(0) +//#define ASSERT RELEASE_ASSERT +#define ASSERT_NOT_REACHED() ASSERT(false) +#define ASSERT_INTERRUPTS_DISABLED() ASSERT(!(cpu_flags() & 0x200)) +#define ASSERT_INTERRUPTS_ENABLED() ASSERT(cpu_flags() & 0x200) diff --git a/Kernel/kassert.h b/Kernel/kassert.h deleted file mode 100644 index e40b26deb6..0000000000 --- a/Kernel/kassert.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include "kprintf.h" -#include "i386.h" - -[[noreturn]] void __assertion_failed(const char* msg, const char* file, unsigned line, const char* func); - -#define ASSERT(expr) (static_cast(expr) ? (void)0 : __assertion_failed(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__)) -#define CRASH() do { asm volatile("ud2"); } while(0) -#define RELEASE_ASSERT(x) do { if (!(x)) CRASH(); } while(0) -//#define ASSERT RELEASE_ASSERT -#define ASSERT_NOT_REACHED() ASSERT(false) -#define ASSERT_INTERRUPTS_DISABLED() ASSERT(!(cpu_flags() & 0x200)) -#define ASSERT_INTERRUPTS_ENABLED() ASSERT(cpu_flags() & 0x200)