summaryrefslogtreecommitdiff
path: root/main.h
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2020-06-16 13:36:06 +0200
committerDavid Härdeman <david@hardeman.nu>2020-06-16 13:36:06 +0200
commit2aea45f0c9ffc0dcc9857478f086142ccf7811f0 (patch)
tree35ff73ed74cbc99da9500554d164055983836bee /main.h
parent9eeffbeab84e71bd0a4cc0855cb1f72ad1849ba6 (diff)
Add all and list debug options, convert announce to use debugging
Diffstat (limited to 'main.h')
-rw-r--r--main.h8
1 files changed, 5 insertions, 3 deletions
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)));