diff options
author | Yann Collet <Cyan4973@users.noreply.github.com> | 2024-03-21 15:05:51 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-21 15:05:51 -0700 |
commit | 794ea1b0afca0f020f4e57b6732332231fb23c70 (patch) | |
tree | 1d0c369da267aca0921dfe2f16dfee5404abe20b /lib/common/debug.h | |
parent | 63779c798237346c2b245c546c40b72a5a5913fe (diff) | |
parent | 78f732cfdd65bccc76d7da2ae103e141e5ca5742 (diff) | |
download | zstd-794ea1b0afca0f020f4e57b6732332231fb23c70.tar.gz |
Merge pull request #3984 from facebook/devupstream-release
v1.5.6
Diffstat (limited to 'lib/common/debug.h')
-rw-r--r-- | lib/common/debug.h | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/lib/common/debug.h b/lib/common/debug.h index 0e9817ea..a16b69e5 100644 --- a/lib/common/debug.h +++ b/lib/common/debug.h @@ -85,18 +85,27 @@ extern int g_debuglevel; /* the variable is only declared, It's useful when enabling very verbose levels on selective conditions (such as position in src) */ -# define RAWLOG(l, ...) { \ - if (l<=g_debuglevel) { \ - ZSTD_DEBUG_PRINT(__VA_ARGS__); \ - } } -# define DEBUGLOG(l, ...) { \ - if (l<=g_debuglevel) { \ - ZSTD_DEBUG_PRINT(__FILE__ ": " __VA_ARGS__); \ - ZSTD_DEBUG_PRINT(" \n"); \ - } } +# define RAWLOG(l, ...) \ + do { \ + if (l<=g_debuglevel) { \ + ZSTD_DEBUG_PRINT(__VA_ARGS__); \ + } \ + } 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__ ":" LINE_AS_STRING ": " __VA_ARGS__); \ + ZSTD_DEBUG_PRINT(" \n"); \ + } \ + } while (0) #else -# define RAWLOG(l, ...) {} /* disabled */ -# define DEBUGLOG(l, ...) {} /* disabled */ +# define RAWLOG(l, ...) do { } while (0) /* disabled */ +# define DEBUGLOG(l, ...) do { } while (0) /* disabled */ #endif |