From 9a3286ad571d75905ce7603b14b1657a3c1c730e Mon Sep 17 00:00:00 2001 From: Bananymous Date: Wed, 20 Sep 2023 19:55:27 +0300 Subject: [PATCH] Kernel: Add constexpr conditional debug prints --- kernel/include/kernel/Debug.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/kernel/include/kernel/Debug.h b/kernel/include/kernel/Debug.h index 086f0f37..13721edd 100644 --- a/kernel/include/kernel/Debug.h +++ b/kernel/include/kernel/Debug.h @@ -29,6 +29,24 @@ Debug::DebugLock::unlock(); \ } while(false) +#define dprintln_if(cond, ...) \ + do { \ + if constexpr(cond) \ + dprintln(__VA_ARGS__); \ + } while(false) + +#define dwarnln_if(cond, ...) \ + do { \ + if constexpr(cond) \ + dwarnln(__VA_ARGS__); \ + } while(false) + +#define derrorln_if(cond, ...) \ + do { \ + if constexpr(cond) \ + derrorln(__VA_ARGS__); \ + } while(false) + #define BOCHS_BREAK() asm volatile("xchgw %bx, %bx") namespace Debug