Remove the old debug macro and impl

This should make calling `debug()` impossible. Some of the other
bits remain, to be removed later.
This commit is contained in:
Fabian Homborg 2020-11-15 11:26:59 +01:00
parent b32540f346
commit 95e86cf2d2
2 changed files with 0 additions and 36 deletions

View file

@ -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,

View file

@ -166,11 +166,6 @@ extern std::atomic<int> 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);