From 95e86cf2d2fdfad3caad23a235333a5b81ec2244 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sun, 15 Nov 2020 11:26:59 +0100 Subject: [PATCH] Remove the old debug macro and impl This should make calling `debug()` impossible. Some of the other bits remain, to be removed later. --- src/common.cpp | 31 ------------------------------- src/common.h | 5 ----- 2 files changed, 36 deletions(-) diff --git a/src/common.cpp b/src/common.cpp index 1bfdced5d..ce797f7c3 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -601,37 +601,6 @@ static void debug_shared(const wchar_t level, const wcstring &msg) { } } -static const wchar_t level_char[] = {L'E', L'W', L'2', L'3', L'4', L'5'}; -[[gnu::noinline]] void debug_impl(int level, const wchar_t *msg, ...) { - int errno_old = errno; - va_list va; - va_start(va, msg); - wcstring local_msg = vformat_string(msg, va); - va_end(va); - const wchar_t msg_level = level <= 5 ? level_char[level] : L'9'; - debug_shared(msg_level, local_msg); - if (debug_stack_frames > 0) { - show_stackframe(msg_level, debug_stack_frames, 1); - } - errno = errno_old; -} - -[[gnu::noinline]] void debug_impl(int level, const char *msg, ...) { - if (!should_debug(level)) return; - int errno_old = errno; - char local_msg[512]; - va_list va; - va_start(va, msg); - vsnprintf(local_msg, sizeof local_msg, msg, va); - va_end(va); - const wchar_t msg_level = level <= 5 ? level_char[level] : L'9'; - debug_shared(msg_level, str2wcstring(local_msg)); - if (debug_stack_frames > 0) { - show_stackframe(msg_level, debug_stack_frames, 1); - } - errno = errno_old; -} - void debug_safe(int level, const char *msg, const char *param1, const char *param2, const char *param3, const char *param4, const char *param5, const char *param6, const char *param7, const char *param8, const char *param9, const char *param10, diff --git a/src/common.h b/src/common.h index 433a9aaf2..88abd478d 100644 --- a/src/common.h +++ b/src/common.h @@ -166,11 +166,6 @@ extern std::atomic debug_level; inline bool should_debug(int level) { return level <= debug_level.load(std::memory_order_relaxed); } -#define debug(level, ...) \ - do { \ - if (should_debug((level))) debug_impl((level), __VA_ARGS__); \ - } while (0) - /// Exits without invoking destructors (via _exit), useful for code after fork. [[noreturn]] void exit_without_destructors(int code);