From f42ffcda1d730c8326cdc97b602394d7dae2c39b Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Wed, 22 Oct 2025 15:38:21 +0200 Subject: 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 --- include/utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/utils.h') 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) -- cgit v1.2.3