From a228788769d7e3c71154606609a13eafb03a5fc2 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 29 Feb 2024 13:16:14 -0500 Subject: diag: New bfs_diag() macro --- src/diag.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/diag.h') diff --git a/src/diag.h b/src/diag.h index 791c065..4054c48 100644 --- a/src/diag.h +++ b/src/diag.h @@ -41,6 +41,19 @@ struct bfs_loc { # define bfs_location() (&(const struct bfs_loc)BFS_LOC_INIT) #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. */ -- cgit v1.2.3