summaryrefslogtreecommitdiffstats
path: root/include/utils.h
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2025-10-22 15:38:21 +0200
committerPhil Sutter <phil@nwl.cc>2025-10-30 17:34:40 +0100
commitf42ffcda1d730c8326cdc97b602394d7dae2c39b (patch)
tree86d5d101c337b57db7b2e7634a4b5cea0a7ac2f2 /include/utils.h
parent8720428253d2ee35f59a1d7921da6d2468877257 (diff)
utils: Cover for missing newline after BUG() messages
Relieve callers from having to suffix their messages with a newline escape sequence, have the macro append it to the format string instead. This is mostly a fix for (the many) calls to BUG() without a newline suffix. Adjust the previously correct ones since they emit an extra newline now. Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'include/utils.h')
-rw-r--r--include/utils.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/utils.h b/include/utils.h
index 16b94264..6a0e4946 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -32,7 +32,7 @@
#define __must_check __attribute__((warn_unused_result))
#define __noreturn __attribute__((__noreturn__))
-#define BUG(fmt, arg...) ({ fprintf(stderr, "BUG: " fmt, ##arg); assert(0); abort(); })
+#define BUG(fmt, arg...) ({ fprintf(stderr, "BUG: " fmt "\n", ##arg); assert(0); abort(); })
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
#define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1)