summaryrefslogtreecommitdiffstats
path: root/src/diag.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-02-29 13:16:14 -0500
committerTavian Barnes <tavianator@tavianator.com>2024-02-29 13:25:24 -0500
commita228788769d7e3c71154606609a13eafb03a5fc2 (patch)
treed78e7495df29767f5cf3a044bbe4271eaf0a6af7 /src/diag.h
parente6d80d04d6928c452b48eae717373bf6a943e355 (diff)
downloadbfs-a228788769d7e3c71154606609a13eafb03a5fc2.tar.xz
diag: New bfs_diag() macro
Diffstat (limited to 'src/diag.h')
-rw-r--r--src/diag.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/diag.h b/src/diag.h
index 791c065..4054c48 100644
--- a/src/diag.h
+++ b/src/diag.h
@@ -42,6 +42,19 @@ struct bfs_loc {
#endif
/**
+ * Print a low-level diagnostic message to standard error, formatted like
+ *
+ * bfs: func@src/file.c:0: Message
+ */
+attr(printf(2, 3))
+void bfs_diagf(const struct bfs_loc *loc, const char *format, ...);
+
+/**
+ * Unconditional diagnostic message.
+ */
+#define bfs_diag(...) bfs_diagf(bfs_location(), __VA_ARGS__)
+
+/**
* Print a message to standard error and abort.
*/
attr(cold, printf(2, 3))