From 9cc3304614f9ea28a870f9e94e1e449c6d7de1fc Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Thu, 14 Mar 2024 12:11:11 -0700 Subject: [PATCH] add line number to debug traces --- lib/common/debug.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/common/debug.h b/lib/common/debug.h index 8049e4b5d..a16b69e57 100644 --- a/lib/common/debug.h +++ b/lib/common/debug.h @@ -92,10 +92,14 @@ extern int g_debuglevel; /* the variable is only declared, } \ } while (0) +#define STRINGIFY(x) #x +#define TOSTRING(x) STRINGIFY(x) +#define LINE_AS_STRING TOSTRING(__LINE__) + # define DEBUGLOG(l, ...) \ do { \ if (l<=g_debuglevel) { \ - ZSTD_DEBUG_PRINT(__FILE__ ": " __VA_ARGS__); \ + ZSTD_DEBUG_PRINT(__FILE__ ":" LINE_AS_STRING ": " __VA_ARGS__); \ ZSTD_DEBUG_PRINT(" \n"); \ } \ } while (0) -- 2.47.2