summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-02-11 14:36:47 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2026-02-11 14:36:47 -0800
commitdb9571a66156bfbc0273e66e5c77923869bda547 (patch)
tree513e6592025b36c461e30f84d10c1aed9982d308 /lib
parent148f95f75c513936d466bcc7e6bf73298da2212b (diff)
parent9abbecf408cba09d73d14f044e1bc12ab7776da0 (diff)
Merge tag 'printk-for-7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux
Pull printk updates from Petr Mladek: - Check all mandatory callbacks when registering nbcon consoles - Fix some compiler warnings * tag 'printk-for-7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux: vsnprintf: drop __printf() attributes on binary printing functions printf: convert test_hashed into macro printk: nbcon: Check for device_{lock,unlock} callbacks
Diffstat (limited to 'lib')
-rw-r--r--lib/tests/printf_kunit.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/tests/printf_kunit.c b/lib/tests/printf_kunit.c
index 7617e5b8b02c..f6f21b445ece 100644
--- a/lib/tests/printf_kunit.c
+++ b/lib/tests/printf_kunit.c
@@ -266,15 +266,17 @@ hash_pointer(struct kunit *kunittest)
KUNIT_EXPECT_MEMNEQ(kunittest, buf, PTR_STR, PTR_WIDTH);
}
-static void
-test_hashed(struct kunit *kunittest, const char *fmt, const void *p)
-{
- char buf[PLAIN_BUF_SIZE];
-
- plain_hash_to_buffer(kunittest, p, buf, PLAIN_BUF_SIZE);
-
- test(buf, fmt, p);
-}
+/*
+ * This is a macro so that the compiler can compare its arguments to the
+ * __printf() attribute on __test(). This cannot be a function with a __printf()
+ * attribute because GCC requires __printf() functions to be variadic.
+ */
+#define test_hashed(kunittest, fmt, p) \
+ do { \
+ char buf[PLAIN_BUF_SIZE]; \
+ plain_hash_to_buffer(kunittest, p, buf, PLAIN_BUF_SIZE); \
+ test(buf, fmt, p); \
+ } while (0)
/*
* NULL pointers aren't hashed.