From 2aea45f0c9ffc0dcc9857478f086142ccf7811f0 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Tue, 16 Jun 2020 13:36:06 +0200 Subject: Add all and list debug options, convert announce to use debugging --- main.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'main.h') diff --git a/main.h b/main.h index a794f6b..9710d23 100644 --- a/main.h +++ b/main.h @@ -19,6 +19,7 @@ enum debug_category { DBG_CFG = (0x1 << 4), DBG_REF = (0x1 << 5), DBG_MALLOC = (0x1 << 6), + DBG_ANN = (0x1 << 7), }; static inline bool @@ -35,11 +36,12 @@ void __debug(enum debug_category category, const char *fmt, ...) __attribute__(( __debug((c), fmt __VA_OPT__(,) __VA_ARGS__); \ } while (0) -#define debug(c, fmt, ...) __ifdebug((c), "%s:%i: " fmt, __func__, \ - __LINE__, __VA_ARGS__) +#define debug(c, fmt, ...) __ifdebug((c), "%s:%i: " fmt, __func__, \ + __LINE__ __VA_OPT__(,) __VA_ARGS__) #define verbose(fmt, ...) __ifdebug(DBG_VERBOSE, fmt, __VA_ARGS__) #define info(fmt, ...) __ifdebug(DBG_ERROR, fmt, __VA_ARGS__) -#define error(fmt, ...) __ifdebug(DBG_ERROR, fmt, __VA_ARGS__) +#define error(fmt, ...) __ifdebug(DBG_ERROR, "%s: " fmt, \ + __func__ __VA_OPT__(,) __VA_ARGS__) void __die(const char *fmt, ...) __attribute__((format(printf, 1, 2))); -- cgit v1.2.3