From b2e43dd96f385e275c08ad531cd1c6bb65e2011f Mon Sep 17 00:00:00 2001 From: dzwdz Date: Tue, 3 Aug 2021 17:38:12 +0200 Subject: put the NUM2STR macro in util.h i'll use it outside of panic.h --- src/kernel/panic.h | 7 ++----- src/kernel/util.h | 3 +++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/kernel/panic.h b/src/kernel/panic.h index ea2cef5..3f48c22 100644 --- a/src/kernel/panic.h +++ b/src/kernel/panic.h @@ -1,13 +1,10 @@ #pragma once #include - -// dumb c shit -#define panic_tostr2(x) #x -#define panic_tostr(x) panic_tostr2(x) +#include #define panic() do { \ log_const(" PANIC! at the "); \ log_const(__func__); \ - log_const(" (" __FILE__ ":" panic_tostr(__LINE__) ") "); \ + log_const(" (" __FILE__ ":" NUM2STR(__LINE__) ") "); \ halt_cpu(); \ } while (0) diff --git a/src/kernel/util.h b/src/kernel/util.h index 4bd7c31..39301d6 100644 --- a/src/kernel/util.h +++ b/src/kernel/util.h @@ -1,5 +1,8 @@ #pragma once #include +#define __NUM2STR(x) #x +#define NUM2STR(x) __NUM2STR(x) + void *memcpy(void *dest, const void *src, size_t n); void *memset(void *s, int c, size_t n); -- cgit v1.2.3