Skip to contentSkip to conversation

scanf: convert self-test to KUnit

PATCH Superseded Tamir Duberstein 4 participants 25 messages Feb 14, 2025 – Mar 6, 2025

Subsystems (4)

v8 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v8 cover scanf: convert self-test to KUnit

This is one of just 3 remaining "Test Module" kselftests (the others being bitmap and printf), the rest having been converted to KUnit. In addition to the enclosed patch, please consider this an RFC on the removal of the "Test Module" kselftest machinery.

I tested this using:

$ tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 scanf

Failure output before this series:

  [  383.100048] test_scanf: vsscanf("1574 9 64ca 935b 7 142d ff58 0", "%4hx %1hx %4hx %4hx %1hx %4hx %4hx %1hx", ...) expected 2472240330 got 1690959881
  [  383.102843] test_scanf: vsscanf("f12:2:d:2:c166:1:36b:1906", "%3hx:%1hx:%1hx:%1hx:%4hx:%1hx:%3hx:%4hx", ...) expected 131085 got 851970
  [  383.105376] test_scanf: vsscanf("4,b2fe,3,593,6,0,3bde,0", "%1hx,%4hx,%1hx,%3hx,%1hx,%1hx,%4hx,%1hx", ...) expected 93519875 got 242430
  [  383.105659] test_scanf: vsscanf("6-1-2-1-d9e6-f-93e-e567", "%1hx-%1hx-%1hx-%1hx-%4hx-%1hx-%3hx-%4hx", ...) expected 65538 got 131073
  [  383.106127] test_scanf: vsscanf("72d6/35/e88d/1/0/6c8c/7/1", "%4hx/%2hx/%4hx/%1hx/%1hx/%4hx/%1hx/%1hx", ...) expected 125069 got 3901554741
  [  383.106235] test_scanf: vsscanf("c9bea1b8122113e9a168df573", "%4hx%4hx%1hx%4hx%4hx%1hx%4hx%3hx", ...) expected 571539457 got 106936
  ...
  [  383.106398] test_scanf: failed 6 out of 2545 tests

Failure output after this series:
# numbers_list_field_width_val_width: ASSERTION FAILED at lib/scanf_kunit.c:94
lib/scanf_kunit.c:555: vsscanf("0 1e 3e43 31f0 0 0 5797 9c70", "%1hx %2hx %4hx %4hx %1hx %1hx %4hx %4hx", ...) expected 837828163 got 1044578334
not ok 1 " "
# numbers_list_field_width_val_width: ASSERTION FAILED at lib/scanf_kunit.c:94
lib/scanf_kunit.c:555: vsscanf("dc2:1c:0:3531:2621:5172:1:7", "%3hx:%2hx:%1hx:%4hx:%4hx:%4hx:%1hx:%1hx", ...) expected 892403712 got 28
not ok 2 ":"
# numbers_list_field_width_val_width: ASSERTION FAILED at lib/scanf_kunit.c:94
lib/scanf_kunit.c:555: vsscanf("e083,8f6e,b,70ca,1,1,aab1,10e4", "%4hx,%4hx,%1hx,%4hx,%1hx,%1hx,%4hx,%4hx", ...) expected 1892286475 got 757614
not ok 3 ","
# numbers_list_field_width_val_width: ASSERTION FAILED at lib/scanf_kunit.c:94
lib/scanf_kunit.c:555: vsscanf("2e72-8435-1-2fc-7cbd-c2f1-7158-2b41", "%4hx-%4hx-%1hx-%3hx-%4hx-%4hx-%4hx-%4hx", ...) expected 50069505 got 99381
not ok 4 "-"
# numbers_list_field_width_val_width: ASSERTION FAILED at lib/scanf_kunit.c:94
lib/scanf_kunit.c:555: vsscanf("403/0/17/1/11e7/1/1fe8/34ba", "%3hx/%1hx/%2hx/%1hx/%4hx/%1hx/%4hx/%4hx", ...) expected 65559 got 1507328

          not ok 5 "/"

---
Changes in v8:
- Expand "scanf: remove redundant debug logs" commit message. (Andy
Shevchenko)
- Add patch "implicate test line in failure messages".
- Rebase on linux-next, move scanf_kunit.c into lib/tests/.
- Link to v7: https://lore.kernel.org/r/[email protected]

Changes in v7:
- Remove redundant debug logs. (Petr Mladek)
- Drop Petr's Acked-by.
- Use original test assertions as KUNIT_*_EQ_MSG produces hard-to-parse messages. The new failure output is:
- Link to v6: https://lore.kernel.org/r/[email protected]

Changes in v6:
- s/at boot/at runtime/ for consistency with the printf series.
- Go back to kmalloc. (Geert Uytterhoeven)
- Link to v5: https://lore.kernel.org/r/[email protected]

Changes in v5:
- Remove extraneous trailing newlines from failure messages.
- Replace pr_debug with kunit_printk.
- Use static char arrays instead of kmalloc.
- Drop KUnit boilerplate from CONFIG_SCANF_KUNIT_TEST help text.
- Drop arch changes.
- Link to v4: https://lore.kernel.org/r/[email protected]

Changes in v4:
- Bake test into various macros, greatly reducing diff noise.
- Revert control flow changes.
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Reduce diff noise in lib/Makefile. (Petr Mladek)
- Split scanf_test into a few test cases. New output:
: =================== scanf (10 subtests) ====================
: [PASSED] numbers_simple
: ====================== numbers_list =======================
: [PASSED] delim=" "
: [PASSED] delim=":"
: [PASSED] delim=","
: [PASSED] delim="-"
: [PASSED] delim="/"
: ================== [PASSED] numbers_list ===================
: ============ numbers_list_field_width_typemax =============
: [PASSED] delim=" "
: [PASSED] delim=":"
: [PASSED] delim=","
: [PASSED] delim="-"
: [PASSED] delim="/"
: ======== [PASSED] numbers_list_field_width_typemax =========
: =========== numbers_list_field_width_val_width ============
: [PASSED] delim=" "
: [PASSED] delim=":"
: [PASSED] delim=","
: [PASSED] delim="-"
: [PASSED] delim="/"
: ======= [PASSED] numbers_list_field_width_val_width ========
: [PASSED] numbers_slice
: [PASSED] numbers_prefix_overflow
: [PASSED] test_simple_strtoull
: [PASSED] test_simple_strtoll
: [PASSED] test_simple_strtoul
: [PASSED] test_simple_strtol
: ====================== [PASSED] scanf ======================
: ============================================================
: Testing complete. Ran 22 tests: passed: 22
: Elapsed time: 5.517s total, 0.001s configuring, 5.440s building, 0.067s running
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Rename lib/{test_scanf.c => scanf_kunit.c}. (Andy Shevchenko)
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Tamir Duberstein (4):
scanf: implicate test line in failure messages
scanf: remove redundant debug logs
scanf: convert self-test to KUnit
scanf: break kunit into test cases

 MAINTAINERS                               |   2 +-
 lib/Kconfig.debug                         |  12 +-
 lib/Makefile                              |   1 -
 lib/tests/Makefile                        |   1 +
 lib/{test_scanf.c => tests/scanf_kunit.c} | 299 +++++++++++++++---------------
 tools/testing/selftests/lib/Makefile      |   2 +-
 tools/testing/selftests/lib/config        |   1 -
 tools/testing/selftests/lib/scanf.sh      |   4 -
 8 files changed, 160 insertions(+), 162 deletions(-)

---
base-commit: 7b7a883c7f4de1ee5040bd1c32aabaafde54d209
change-id: 20250131-scanf-kunit-convert-f70dc33bb34c

Best regards,

Signature · 1 line
Tamir Duberstein <[email protected]>
#1 lore raw

PATCH v8 1/4 scanf: implicate test line in failure messages

This improves the failure output by pointing to the failing line at the top level of the test.

---
 lib/test_scanf.c | 66 ++++++++++++++++++++++++++++----------------------------
 1 file changed, 33 insertions(+), 33 deletions(-)
lib/test_scanf.c +33 -33
index 44f8508c9d88..d1664e0d0138 100644
@@ -24,12 +24,12 @@ static char *test_buffer __initdata;
 static char *fmt_buffer __initdata;
 static struct rnd_state rnd_state __initdata;
 
-typedef int (*check_fn)(const void *check_data, const char *string,
-			const char *fmt, int n_args, va_list ap);
+typedef int (*check_fn)(const char *file, const int line, const void *check_data,
+			const char *string, const char *fmt, int n_args, va_list ap);
 
-static void __scanf(4, 6) __init
-_test(check_fn fn, const void *check_data, const char *string, const char *fmt,
-	int n_args, ...)
+static void __scanf(6, 0) __init
+_test(const char *file, const int line, check_fn fn, const void *check_data, const char *string,
+	const char *fmt, int n_args, ...)
 {
 	va_list ap, ap_copy;
 	int ret;
@@ -42,12 +42,12 @@ _test(check_fn fn, const void *check_data, const char *string, const char *fmt,
 	va_end(ap_copy);
 
 	if (ret != n_args) {
-		pr_warn("vsscanf(\"%s\", \"%s\", ...) returned %d expected %d\n",
-			string, fmt, ret, n_args);
+		pr_warn("%s:%d: vsscanf(\"%s\", \"%s\", ...) returned %d expected %d\n",
+			file, line, string, fmt, ret, n_args);
 		goto fail;
 	}
 
-	ret = (*fn)(check_data, string, fmt, n_args, ap);
+	ret = (*fn)(file, line, check_data, string, fmt, n_args, ap);
 	if (ret)
 		goto fail;
 
@@ -67,88 +67,88 @@ do {										\
 		typeof(*expect) got = *va_arg(ap, typeof(expect));		\
 		pr_debug("\t" arg_fmt "\n", got);				\
 		if (got != *expect) {						\
-			pr_warn("vsscanf(\"%s\", \"%s\", ...) expected " arg_fmt " got " arg_fmt "\n", \
-				str, fmt, *expect, got);			\
+			pr_warn("%s:%d, vsscanf(\"%s\", \"%s\", ...) expected " arg_fmt " got " arg_fmt "\n", \
+				file, line, str, fmt, *expect, got);		\
 			return 1;						\
 		}								\
 	}									\
 	return 0;								\
 } while (0)
 
-static int __init check_ull(const void *check_data, const char *string,
-			    const char *fmt, int n_args, va_list ap)
+static int __init check_ull(const char *file, const int line, const void *check_data,
+			    const char *string, const char *fmt, int n_args, va_list ap)
 {
 	const unsigned long long *pval = check_data;
 
 	_check_numbers_template("%llu", pval, string, fmt, n_args, ap);
 }
 
-static int __init check_ll(const void *check_data, const char *string,
-			   const char *fmt, int n_args, va_list ap)
+static int __init check_ll(const char *file, const int line, const void *check_data,
+			   const char *string, const char *fmt, int n_args, va_list ap)
 {
 	const long long *pval = check_data;
 
 	_check_numbers_template("%lld", pval, string, fmt, n_args, ap);
 }
 
-static int __init check_ulong(const void *check_data, const char *string,
-			   const char *fmt, int n_args, va_list ap)
+static int __init check_ulong(const char *file, const int line, const void *check_data,
+			      const char *string, const char *fmt, int n_args, va_list ap)
 {
 	const unsigned long *pval = check_data;
 
 	_check_numbers_template("%lu", pval, string, fmt, n_args, ap);
 }
 
-static int __init check_long(const void *check_data, const char *string,
-			  const char *fmt, int n_args, va_list ap)
+static int __init check_long(const char *file, const int line, const void *check_data,
+			     const char *string, const char *fmt, int n_args, va_list ap)
 {
 	const long *pval = check_data;
 
 	_check_numbers_template("%ld", pval, string, fmt, n_args, ap);
 }
 
-static int __init check_uint(const void *check_data, const char *string,
-			     const char *fmt, int n_args, va_list ap)
+static int __init check_uint(const char *file, const int line, const void *check_data,
+			     const char *string, const char *fmt, int n_args, va_list ap)
 {
 	const unsigned int *pval = check_data;
 
 	_check_numbers_template("%u", pval, string, fmt, n_args, ap);
 }
 
-static int __init check_int(const void *check_data, const char *string,
-			    const char *fmt, int n_args, va_list ap)
+static int __init check_int(const char *file, const int line, const void *check_data,
+			    const char *string, const char *fmt, int n_args, va_list ap)
 {
 	const int *pval = check_data;
 
 	_check_numbers_template("%d", pval, string, fmt, n_args, ap);
 }
 
-static int __init check_ushort(const void *check_data, const char *string,
-			       const char *fmt, int n_args, va_list ap)
+static int __init check_ushort(const char *file, const int line, const void *check_data,
+			       const char *string, const char *fmt, int n_args, va_list ap)
 {
 	const unsigned short *pval = check_data;
 
 	_check_numbers_template("%hu", pval, string, fmt, n_args, ap);
 }
 
-static int __init check_short(const void *check_data, const char *string,
-			       const char *fmt, int n_args, va_list ap)
+static int __init check_short(const char *file, const int line, const void *check_data,
+			      const char *string, const char *fmt, int n_args, va_list ap)
 {
 	const short *pval = check_data;
 
 	_check_numbers_template("%hd", pval, string, fmt, n_args, ap);
 }
 
-static int __init check_uchar(const void *check_data, const char *string,
-			       const char *fmt, int n_args, va_list ap)
+static int __init check_uchar(const char *file, const int line, const void *check_data,
+			      const char *string, const char *fmt, int n_args, va_list ap)
 {
 	const unsigned char *pval = check_data;
 
 	_check_numbers_template("%hhu", pval, string, fmt, n_args, ap);
 }
 
-static int __init check_char(const void *check_data, const char *string,
-			       const char *fmt, int n_args, va_list ap)
+static int __init check_char(const char *file, const int line, const void *check_data,
+			     const char *string, const char *fmt, int n_args, va_list ap)
 {
 	const signed char *pval = check_data;
 
@@ -196,7 +196,7 @@ do {									\
 	T result = ~expect_val; /* should be overwritten */		\
 									\
 	snprintf(test_buffer, BUF_SIZE, gen_fmt, expect_val);		\
-	_test(fn, &expect_val, test_buffer, "%" scan_fmt, 1, &result);	\
+	_test(__FILE__, __LINE__, fn, &expect_val, test_buffer, "%" scan_fmt, 1, &result);	\
 } while (0)
 
 #define simple_numbers_loop(T, gen_fmt, scan_fmt, fn)			\
@@ -344,7 +344,7 @@ static void __init append_delim(char *str_buf, int *str_buf_pos, int str_buf_len
 #define test_array_8(fn, check_data, string, fmt, arr)				\
 do {										\
 	BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);					\
-	_test(fn, check_data, string, fmt, 8,					\
+	_test(__FILE__, __LINE__, fn, check_data, string, fmt, 8,		\
 		&(arr)[0], &(arr)[1], &(arr)[2], &(arr)[3],			\
 		&(arr)[4], &(arr)[5], &(arr)[6], &(arr)[7]);			\
 } while (0)
@@ -608,7 +608,7 @@ do {										\
 	const T expect[2] = { expect0, expect1 };				\
 	T result[2] = { (T)~expect[0], (T)~expect[1] };				\
 										\
-	_test(fn, &expect, str, scan_fmt, n_args, &result[0], &result[1]);	\
+	_test(__FILE__, __LINE__, fn, &expect, str, scan_fmt, n_args, &result[0], &result[1]);	\
 } while (0)
 
 /*
Signature · 1 line
2.48.1
maintainer
#3 lore raw

Re: [PATCH v8 1/4] scanf: implicate test line in failure messages

In reply to Tamir Duberstein
Quoted 15 lines · Tamir Duberstein

This improves the failure output by pointing to the failing line at the top level of the test.

---
 lib/test_scanf.c | 66 ++++++++++++++++++++++++++++----------------------------
 1 file changed, 33 insertions(+), 33 deletions(-)
lib/test_scanf.c +0 -0
index 44f8508c9d88..d1664e0d0138 100644
@@ -24,12 +24,12 @@ static char *test_buffer __initdata;
 static char *fmt_buffer __initdata;
 static struct rnd_state rnd_state __initdata;

lib/test_scanf.c static char *test_buffer __initdata; · line 30

Quoted 10 lines
lib/test_scanf.c +3 -5
 
-typedef int (*check_fn)(const void *check_data, const char *string,
-			const char *fmt, int n_args, va_list ap);
+typedef int (*check_fn)(const char *file, const int line, const void *check_data,
+			const char *string, const char *fmt, int n_args, va_list ap);
 
-static void __scanf(4, 6) __init
-_test(check_fn fn, const void *check_data, const char *string, const char *fmt,
-	int n_args, ...)
+static void __scanf(6, 0) __init

This should be:

static void __scanf(6, 8) __init

The zero (0) is used when the parameters are passed via the va_list. The value must be the position of the first parameter when they are passed via the variable list of parameters, aka (...).

Otherwise, it triggers the warnings reported by the [email protected] kernel test robot, see
https://lore.kernel.org/r/[email protected]

Best Regards,
Petr

#4 lore raw

Re: [PATCH v8 1/4] scanf: implicate test line in failure messages

Quoted 36 lines · Petr Mladek
Quoted 15 lines · Tamir Duberstein

This improves the failure output by pointing to the failing line at the top level of the test.

---
 lib/test_scanf.c | 66 ++++++++++++++++++++++++++++----------------------------
 1 file changed, 33 insertions(+), 33 deletions(-)
lib/test_scanf.c +0 -0
index 44f8508c9d88..d1664e0d0138 100644
@@ -24,12 +24,12 @@ static char *test_buffer __initdata;
 static char *fmt_buffer __initdata;
 static struct rnd_state rnd_state __initdata;

lib/test_scanf.c static char *test_buffer __initdata; · line 30

Quoted 10 lines
lib/test_scanf.c +3 -5
 
-typedef int (*check_fn)(const void *check_data, const char *string,
-                     const char *fmt, int n_args, va_list ap);
+typedef int (*check_fn)(const char *file, const int line, const void *check_data,
+                     const char *string, const char *fmt, int n_args, va_list ap);
 
-static void __scanf(4, 6) __init
-_test(check_fn fn, const void *check_data, const char *string, const char *fmt,
-     int n_args, ...)
+static void __scanf(6, 0) __init

This should be:

static void __scanf(6, 8) __init

The zero (0) is used when the parameters are passed via the va_list. The value must be the position of the first parameter when they are passed via the variable list of parameters, aka (...).

Quoted 6 lines

Otherwise, it triggers the warnings reported by the [email protected] kernel test robot, see
https://lore.kernel.org/r/[email protected]

Best Regards,
Petr

Thanks for explaining!

#5 lore raw

PATCH v8 2/4 scanf: remove redundant debug logs

In reply to Tamir Duberstein

Remove pr_debug calls which emit information already contained in pr_warn calls that occur on test failure. This reduces unhelpful test verbosity.

Note that a pr_debug removed from _check_numbers_template appears to have been the only guard against silent false positives, but in fact this condition is handled in _test; it is only possible for n_args to be 0 in _check_numbers_template if the test explicitly expects it *and* vsscanf returns 0, matching the expectation.

---
 lib/test_scanf.c | 3 ---
 1 file changed, 3 deletions(-)
lib/test_scanf.c +0 -3
index d1664e0d0138..efdde6f498d9 100644
@@ -62,10 +62,8 @@ _test(const char *file, const int line, check_fn fn, const void *check_data, con
 
 #define _check_numbers_template(arg_fmt, expect, str, fmt, n_args, ap)		\
 do {										\
-	pr_debug("\"%s\", \"%s\" ->\n", str, fmt);				\
 	for (; n_args > 0; n_args--, expect++) {				\
 		typeof(*expect) got = *va_arg(ap, typeof(expect));		\
-		pr_debug("\t" arg_fmt "\n", got);				\
 		if (got != *expect) {						\
 			pr_warn("%s:%d, vsscanf(\"%s\", \"%s\", ...) expected " arg_fmt " got " arg_fmt "\n", \
 				file, line, str, fmt, *expect, got);		\
@@ -689,7 +687,6 @@ do {										\
 	total_tests++;								\
 	len = snprintf(test_buffer, BUF_SIZE, gen_fmt, expect);			\
 	got = (fn)(test_buffer, &endp, base);					\
-	pr_debug(#fn "(\"%s\", %d) -> " gen_fmt "\n", test_buffer, base, got);	\
 	if (got != (expect)) {							\
 		fail = true;							\
 		pr_warn(#fn "(\"%s\", %d): got " gen_fmt " expected " gen_fmt "\n", \
Signature · 1 line
2.48.1
maintainer Reviewed-by on v8 2/4
#6 lore raw

Re: [PATCH v8 2/4] scanf: remove redundant debug logs

Quoted 11 lines · Tamir Duberstein

Remove pr_debug calls which emit information already contained in pr_warn calls that occur on test failure. This reduces unhelpful test verbosity.

Note that a pr_debug removed from _check_numbers_template appears to have been the only guard against silent false positives, but in fact this condition is handled in _test; it is only possible for n_args to be 0 in _check_numbers_template if the test explicitly expects it *and* vsscanf returns 0, matching the expectation.

I am fine with the change. The debug messages have been obsoleted by the 1st patch. The file:line information is more convenient to find the failing test.

Best Regards,
Petr

#7 lore raw

PATCH v8 3/4 scanf: convert self-test to KUnit

In reply to Tamir Duberstein

Convert the scanf() self-test to a KUnit test.

In the interest of keeping the patch reasonably-sized this doesn't refactor the tests into proper parameterized tests - it's all one big test case.

---
 MAINTAINERS                               |   2 +-
 lib/Kconfig.debug                         |  12 +-
 lib/Makefile                              |   1 -
 lib/tests/Makefile                        |   1 +
 lib/{test_scanf.c => tests/scanf_kunit.c} | 251 +++++++++++++++---------------
 tools/testing/selftests/lib/Makefile      |   2 +-
 tools/testing/selftests/lib/config        |   1 -
 tools/testing/selftests/lib/scanf.sh      |   4 -
 8 files changed, 134 insertions(+), 140 deletions(-)
MAINTAINERS +1 -1
index 92fc0eca7061..8dc8f597596d 100644
@@ -25466,8 +25466,8 @@ R:	Sergey Senozhatsky <[email protected]>
 S:	Maintained
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git
 F:	Documentation/core-api/printk-formats.rst
+F:	lib/tests/scanf_kunit.c
 F:	lib/test_printf.c
-F:	lib/test_scanf.c
 F:	lib/vsprintf.c
 
 VT1211 HARDWARE MONITOR DRIVER
lib/Kconfig.debug +9 -3
index 85b95d645b10..bf3b8999a2ac 100644
@@ -2436,6 +2436,15 @@ config ASYNC_RAID6_TEST
 config TEST_HEXDUMP
 	tristate "Test functions located in the hexdump module at runtime"
 
+config SCANF_KUNIT_TEST
+	tristate "KUnit test scanf() family of functions at runtime" if !KUNIT_ALL_TESTS
+	depends on KUNIT
+	default KUNIT_ALL_TESTS
+	help
+	  Enable this option to test the scanf functions at runtime.
+
+	  If unsure, say N.
+
 config STRING_KUNIT_TEST
 	tristate "KUnit test string functions at runtime" if !KUNIT_ALL_TESTS
 	depends on KUNIT
@@ -2452,9 +2461,6 @@ config TEST_KSTRTOX
 config TEST_PRINTF
 	tristate "Test printf() family of functions at runtime"
 
-config TEST_SCANF
-	tristate "Test scanf() family of functions at runtime"
-
 config TEST_BITMAP
 	tristate "Test bitmap_*() family of functions at runtime"
 	help
lib/Makefile +0 -1
index 961aef91d493..459ca67825f4 100644
@@ -78,7 +78,6 @@ obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_keys.o
 obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_key_base.o
 obj-$(CONFIG_TEST_DYNAMIC_DEBUG) += test_dynamic_debug.o
 obj-$(CONFIG_TEST_PRINTF) += test_printf.o
-obj-$(CONFIG_TEST_SCANF) += test_scanf.o
 
 obj-$(CONFIG_TEST_BITMAP) += test_bitmap.o
 ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_KASAN),yy)
lib/tests/Makefile +1 -0
index 8961fbcff7a4..db9b685f2d88 100644
@@ -30,6 +30,7 @@ obj-$(CONFIG_LINEAR_RANGES_TEST) += test_linear_ranges.o
 obj-$(CONFIG_MEMCPY_KUNIT_TEST) += memcpy_kunit.o
 CFLAGS_overflow_kunit.o = $(call cc-disable-warning, tautological-constant-out-of-range-compare)
 obj-$(CONFIG_OVERFLOW_KUNIT_TEST) += overflow_kunit.o
+obj-$(CONFIG_SCANF_KUNIT_TEST) += scanf_kunit.o
 obj-$(CONFIG_SIPHASH_KUNIT_TEST) += siphash_kunit.o
 obj-$(CONFIG_SLUB_KUNIT_TEST) += slub_kunit.o
 obj-$(CONFIG_TEST_SORT) += test_sort.o
lib/tests/scanf_kunit.c renamed from lib/test_scanf.c +122 -129

588 lines not on this page · raw message

tools/testing/selftests/lib/Makefile +1 -1
index c52fe3ad8e98..4afda556151f 100644
@@ -4,5 +4,5 @@
 # No binaries, but make sure arg-less "make" doesn't trigger "run_tests"
 all:
 
-TEST_PROGS := printf.sh bitmap.sh prime_numbers.sh scanf.sh
+TEST_PROGS := printf.sh bitmap.sh prime_numbers.sh
 include ../lib.mk
tools/testing/selftests/lib/config +0 -1
index 306a3d4dca98..1d17fa85de8f 100644
@@ -1,4 +1,3 @@
 CONFIG_TEST_PRINTF=m
-CONFIG_TEST_SCANF=m
 CONFIG_TEST_BITMAP=m
 CONFIG_TEST_BITOPS=m
tools/testing/selftests/lib/scanf.sh deleted +0 -4
deleted file mode 100755
index b59b8ba561c3..000000000000
@@ -1,4 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0
-# Tests the scanf infrastructure using test_scanf kernel module.
-$(dirname $0)/../kselftest/module.sh "scanf" test_scanf
Signature · 1 line
2.48.1
#8 lore raw
kernel test robot noticed the following build warnings:

Hi Tamir,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 7b7a883c7f4de1ee5040bd1c32aabaafde54d209]

url:    https://github.com/intel-lab-lkp/linux/commits/Tamir-Duberstein/scanf-implicate-test-line-in-failure-messages/20250215-002302
base:   7b7a883c7f4de1ee5040bd1c32aabaafde54d209
patch link:    https://lore.kernel.org/r/20250214-scanf-kunit-convert-v8-3-5ea50f95f83c%40gmail.com
patch subject: [PATCH v8 3/4] scanf: convert self-test to KUnit
config: sh-randconfig-002-20250216 (https://download.01.org/0day-ci/archive/20250216/[email protected]/config)
compiler: sh4-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250216/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from <command-line>:
lib/tests/scanf_kunit.c: In function 'numbers_list_ll':

>> include/linux/compiler.h:197:61: warning: function 'numbers_list_ll' might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                             ^
   include/linux/compiler_types.h:522:23: note: in definition of macro '__compiletime_assert'
     522 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:542:9: note: in expansion of macro '_compiletime_assert'
     542 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:9: note: in expansion of macro 'BUILD_BUG_ON'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |         ^~~~~~~~~~~~
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:22: note: in expansion of macro 'ARRAY_SIZE'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |                      ^~~~~~~~~~
   lib/tests/scanf_kunit.c:356:9: note: in expansion of macro 'test_array_8'
     356 |         test_array_8(fn, expect, test_buffer, fmt_buffer, result);              \
         |         ^~~~~~~~~~~~
   lib/tests/scanf_kunit.c:390:9: note: in expansion of macro 'numbers_list_8'
     390 |         numbers_list_8(unsigned long long, "%llu",   delim, "llu", check_ull);
         |         ^~~~~~~~~~~~~~
>> include/linux/compiler.h:197:61: warning: function 'numbers_list_ll' might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                             ^
   include/linux/compiler_types.h:522:23: note: in definition of macro '__compiletime_assert'
     522 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:542:9: note: in expansion of macro '_compiletime_assert'
     542 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:9: note: in expansion of macro 'BUILD_BUG_ON'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |         ^~~~~~~~~~~~
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:22: note: in expansion of macro 'ARRAY_SIZE'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |                      ^~~~~~~~~~
   lib/tests/scanf_kunit.c:356:9: note: in expansion of macro 'test_array_8'
     356 |         test_array_8(fn, expect, test_buffer, fmt_buffer, result);              \
         |         ^~~~~~~~~~~~
   lib/tests/scanf_kunit.c:391:9: note: in expansion of macro 'numbers_list_8'
     391 |         numbers_list_8(long long,          "%lld",   delim, "lld", check_ll);
         |         ^~~~~~~~~~~~~~
>> include/linux/compiler.h:197:61: warning: function 'numbers_list_ll' might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                             ^
   include/linux/compiler_types.h:522:23: note: in definition of macro '__compiletime_assert'
     522 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:542:9: note: in expansion of macro '_compiletime_assert'
     542 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:9: note: in expansion of macro 'BUILD_BUG_ON'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |         ^~~~~~~~~~~~
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:22: note: in expansion of macro 'ARRAY_SIZE'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |                      ^~~~~~~~~~
   lib/tests/scanf_kunit.c:356:9: note: in expansion of macro 'test_array_8'
     356 |         test_array_8(fn, expect, test_buffer, fmt_buffer, result);              \
         |         ^~~~~~~~~~~~
   lib/tests/scanf_kunit.c:392:9: note: in expansion of macro 'numbers_list_8'
     392 |         numbers_list_8(long long,          "%lld",   delim, "lli", check_ll);
         |         ^~~~~~~~~~~~~~
>> include/linux/compiler.h:197:61: warning: function 'numbers_list_ll' might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                             ^
   include/linux/compiler_types.h:522:23: note: in definition of macro '__compiletime_assert'
     522 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:542:9: note: in expansion of macro '_compiletime_assert'
     542 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:9: note: in expansion of macro 'BUILD_BUG_ON'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |         ^~~~~~~~~~~~
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:22: note: in expansion of macro 'ARRAY_SIZE'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |                      ^~~~~~~~~~
   lib/tests/scanf_kunit.c:356:9: note: in expansion of macro 'test_array_8'
     356 |         test_array_8(fn, expect, test_buffer, fmt_buffer, result);              \
         |         ^~~~~~~~~~~~
   lib/tests/scanf_kunit.c:393:9: note: in expansion of macro 'numbers_list_8'
     393 |         numbers_list_8(unsigned long long, "%llx",   delim, "llx", check_ull);
         |         ^~~~~~~~~~~~~~
>> include/linux/compiler.h:197:61: warning: function 'numbers_list_ll' might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                             ^
   include/linux/compiler_types.h:522:23: note: in definition of macro '__compiletime_assert'
     522 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:542:9: note: in expansion of macro '_compiletime_assert'
     542 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:9: note: in expansion of macro 'BUILD_BUG_ON'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |         ^~~~~~~~~~~~
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:22: note: in expansion of macro 'ARRAY_SIZE'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |                      ^~~~~~~~~~
   lib/tests/scanf_kunit.c:356:9: note: in expansion of macro 'test_array_8'
     356 |         test_array_8(fn, expect, test_buffer, fmt_buffer, result);              \
         |         ^~~~~~~~~~~~
   lib/tests/scanf_kunit.c:394:9: note: in expansion of macro 'numbers_list_8'
     394 |         numbers_list_8(unsigned long long, "0x%llx", delim, "llx", check_ull);
         |         ^~~~~~~~~~~~~~
>> include/linux/compiler.h:197:61: warning: function 'numbers_list_ll' might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                             ^
   include/linux/compiler_types.h:522:23: note: in definition of macro '__compiletime_assert'
     522 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:542:9: note: in expansion of macro '_compiletime_assert'
     542 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:9: note: in expansion of macro 'BUILD_BUG_ON'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |         ^~~~~~~~~~~~
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:22: note: in expansion of macro 'ARRAY_SIZE'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |                      ^~~~~~~~~~
   lib/tests/scanf_kunit.c:356:9: note: in expansion of macro 'test_array_8'
     356 |         test_array_8(fn, expect, test_buffer, fmt_buffer, result);              \
         |         ^~~~~~~~~~~~
   lib/tests/scanf_kunit.c:395:9: note: in expansion of macro 'numbers_list_8'
     395 |         numbers_list_8(long long,          "0x%llx", delim, "lli", check_ll);
         |         ^~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c: In function 'numbers_list_l':
>> include/linux/compiler.h:197:61: warning: function 'numbers_list_l' might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                             ^
   include/linux/compiler_types.h:522:23: note: in definition of macro '__compiletime_assert'
     522 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:542:9: note: in expansion of macro '_compiletime_assert'
     542 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:9: note: in expansion of macro 'BUILD_BUG_ON'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |         ^~~~~~~~~~~~
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:22: note: in expansion of macro 'ARRAY_SIZE'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |                      ^~~~~~~~~~
   lib/tests/scanf_kunit.c:356:9: note: in expansion of macro 'test_array_8'
     356 |         test_array_8(fn, expect, test_buffer, fmt_buffer, result);              \
         |         ^~~~~~~~~~~~
   lib/tests/scanf_kunit.c:400:9: note: in expansion of macro 'numbers_list_8'
     400 |         numbers_list_8(unsigned long,      "%lu",    delim, "lu", check_ulong);
         |         ^~~~~~~~~~~~~~
>> include/linux/compiler.h:197:61: warning: function 'numbers_list_l' might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                             ^
   include/linux/compiler_types.h:522:23: note: in definition of macro '__compiletime_assert'
     522 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:542:9: note: in expansion of macro '_compiletime_assert'
     542 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:9: note: in expansion of macro 'BUILD_BUG_ON'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |         ^~~~~~~~~~~~
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:22: note: in expansion of macro 'ARRAY_SIZE'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |                      ^~~~~~~~~~
   lib/tests/scanf_kunit.c:356:9: note: in expansion of macro 'test_array_8'
     356 |         test_array_8(fn, expect, test_buffer, fmt_buffer, result);              \
         |         ^~~~~~~~~~~~
   lib/tests/scanf_kunit.c:401:9: note: in expansion of macro 'numbers_list_8'
     401 |         numbers_list_8(long,               "%ld",    delim, "ld", check_long);
         |         ^~~~~~~~~~~~~~
>> include/linux/compiler.h:197:61: warning: function 'numbers_list_l' might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                             ^
   include/linux/compiler_types.h:522:23: note: in definition of macro '__compiletime_assert'
     522 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:542:9: note: in expansion of macro '_compiletime_assert'
     542 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:9: note: in expansion of macro 'BUILD_BUG_ON'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |         ^~~~~~~~~~~~
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:22: note: in expansion of macro 'ARRAY_SIZE'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |                      ^~~~~~~~~~
   lib/tests/scanf_kunit.c:356:9: note: in expansion of macro 'test_array_8'
     356 |         test_array_8(fn, expect, test_buffer, fmt_buffer, result);              \
         |         ^~~~~~~~~~~~
   lib/tests/scanf_kunit.c:402:9: note: in expansion of macro 'numbers_list_8'
     402 |         numbers_list_8(long,               "%ld",    delim, "li", check_long);
         |         ^~~~~~~~~~~~~~
>> include/linux/compiler.h:197:61: warning: function 'numbers_list_l' might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                             ^
   include/linux/compiler_types.h:522:23: note: in definition of macro '__compiletime_assert'
     522 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:542:9: note: in expansion of macro '_compiletime_assert'
     542 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:9: note: in expansion of macro 'BUILD_BUG_ON'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |         ^~~~~~~~~~~~
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:22: note: in expansion of macro 'ARRAY_SIZE'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |                      ^~~~~~~~~~
   lib/tests/scanf_kunit.c:356:9: note: in expansion of macro 'test_array_8'
     356 |         test_array_8(fn, expect, test_buffer, fmt_buffer, result);              \
         |         ^~~~~~~~~~~~
   lib/tests/scanf_kunit.c:403:9: note: in expansion of macro 'numbers_list_8'
     403 |         numbers_list_8(unsigned long,      "%lx",    delim, "lx", check_ulong);
         |         ^~~~~~~~~~~~~~
>> include/linux/compiler.h:197:61: warning: function 'numbers_list_l' might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                             ^
   include/linux/compiler_types.h:522:23: note: in definition of macro '__compiletime_assert'
     522 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:542:9: note: in expansion of macro '_compiletime_assert'
     542 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:9: note: in expansion of macro 'BUILD_BUG_ON'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |         ^~~~~~~~~~~~
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:22: note: in expansion of macro 'ARRAY_SIZE'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |                      ^~~~~~~~~~
   lib/tests/scanf_kunit.c:356:9: note: in expansion of macro 'test_array_8'
     356 |         test_array_8(fn, expect, test_buffer, fmt_buffer, result);              \
         |         ^~~~~~~~~~~~
   lib/tests/scanf_kunit.c:404:9: note: in expansion of macro 'numbers_list_8'
     404 |         numbers_list_8(unsigned long,      "0x%lx",  delim, "lx", check_ulong);
         |         ^~~~~~~~~~~~~~
>> include/linux/compiler.h:197:61: warning: function 'numbers_list_l' might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                             ^
   include/linux/compiler_types.h:522:23: note: in definition of macro '__compiletime_assert'
     522 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:542:9: note: in expansion of macro '_compiletime_assert'
     542 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:9: note: in expansion of macro 'BUILD_BUG_ON'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |         ^~~~~~~~~~~~
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:22: note: in expansion of macro 'ARRAY_SIZE'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |                      ^~~~~~~~~~
   lib/tests/scanf_kunit.c:356:9: note: in expansion of macro 'test_array_8'
     356 |         test_array_8(fn, expect, test_buffer, fmt_buffer, result);              \
         |         ^~~~~~~~~~~~
   lib/tests/scanf_kunit.c:405:9: note: in expansion of macro 'numbers_list_8'
     405 |         numbers_list_8(long,               "0x%lx",  delim, "li", check_long);
         |         ^~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c: In function 'numbers_list_d':
>> include/linux/compiler.h:197:61: warning: function 'numbers_list_d' might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                             ^
   include/linux/compiler_types.h:522:23: note: in definition of macro '__compiletime_assert'
     522 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:542:9: note: in expansion of macro '_compiletime_assert'
     542 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:9: note: in expansion of macro 'BUILD_BUG_ON'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |         ^~~~~~~~~~~~
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:22: note: in expansion of macro 'ARRAY_SIZE'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |                      ^~~~~~~~~~
   lib/tests/scanf_kunit.c:356:9: note: in expansion of macro 'test_array_8'
     356 |         test_array_8(fn, expect, test_buffer, fmt_buffer, result);              \
         |         ^~~~~~~~~~~~
   lib/tests/scanf_kunit.c:410:9: note: in expansion of macro 'numbers_list_8'
     410 |         numbers_list_8(unsigned int,       "%u",     delim, "u", check_uint);
         |         ^~~~~~~~~~~~~~
>> include/linux/compiler.h:197:61: warning: function 'numbers_list_d' might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                             ^
   include/linux/compiler_types.h:522:23: note: in definition of macro '__compiletime_assert'
     522 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:542:9: note: in expansion of macro '_compiletime_assert'
     542 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:9: note: in expansion of macro 'BUILD_BUG_ON'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |         ^~~~~~~~~~~~
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:22: note: in expansion of macro 'ARRAY_SIZE'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |                      ^~~~~~~~~~
   lib/tests/scanf_kunit.c:356:9: note: in expansion of macro 'test_array_8'
     356 |         test_array_8(fn, expect, test_buffer, fmt_buffer, result);              \
         |         ^~~~~~~~~~~~
   lib/tests/scanf_kunit.c:411:9: note: in expansion of macro 'numbers_list_8'
     411 |         numbers_list_8(int,                "%d",     delim, "d", check_int);
         |         ^~~~~~~~~~~~~~
>> include/linux/compiler.h:197:61: warning: function 'numbers_list_d' might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                             ^
   include/linux/compiler_types.h:522:23: note: in definition of macro '__compiletime_assert'
     522 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:542:9: note: in expansion of macro '_compiletime_assert'
     542 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:9: note: in expansion of macro 'BUILD_BUG_ON'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |         ^~~~~~~~~~~~
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:22: note: in expansion of macro 'ARRAY_SIZE'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |                      ^~~~~~~~~~
   lib/tests/scanf_kunit.c:356:9: note: in expansion of macro 'test_array_8'
     356 |         test_array_8(fn, expect, test_buffer, fmt_buffer, result);              \
         |         ^~~~~~~~~~~~
   lib/tests/scanf_kunit.c:412:9: note: in expansion of macro 'numbers_list_8'
     412 |         numbers_list_8(int,                "%d",     delim, "i", check_int);
         |         ^~~~~~~~~~~~~~
>> include/linux/compiler.h:197:61: warning: function 'numbers_list_d' might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                             ^
   include/linux/compiler_types.h:522:23: note: in definition of macro '__compiletime_assert'
     522 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:542:9: note: in expansion of macro '_compiletime_assert'
     542 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:9: note: in expansion of macro 'BUILD_BUG_ON'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |         ^~~~~~~~~~~~
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:22: note: in expansion of macro 'ARRAY_SIZE'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |                      ^~~~~~~~~~
   lib/tests/scanf_kunit.c:356:9: note: in expansion of macro 'test_array_8'
     356 |         test_array_8(fn, expect, test_buffer, fmt_buffer, result);              \
         |         ^~~~~~~~~~~~
   lib/tests/scanf_kunit.c:413:9: note: in expansion of macro 'numbers_list_8'
     413 |         numbers_list_8(unsigned int,       "%x",     delim, "x", check_uint);
         |         ^~~~~~~~~~~~~~
>> include/linux/compiler.h:197:61: warning: function 'numbers_list_d' might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                             ^
   include/linux/compiler_types.h:522:23: note: in definition of macro '__compiletime_assert'
     522 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:542:9: note: in expansion of macro '_compiletime_assert'
     542 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:9: note: in expansion of macro 'BUILD_BUG_ON'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |         ^~~~~~~~~~~~
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:22: note: in expansion of macro 'ARRAY_SIZE'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |                      ^~~~~~~~~~
   lib/tests/scanf_kunit.c:356:9: note: in expansion of macro 'test_array_8'
     356 |         test_array_8(fn, expect, test_buffer, fmt_buffer, result);              \
         |         ^~~~~~~~~~~~
   lib/tests/scanf_kunit.c:414:9: note: in expansion of macro 'numbers_list_8'
     414 |         numbers_list_8(unsigned int,       "0x%x",   delim, "x", check_uint);
         |         ^~~~~~~~~~~~~~
>> include/linux/compiler.h:197:61: warning: function 'numbers_list_d' might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                             ^
   include/linux/compiler_types.h:522:23: note: in definition of macro '__compiletime_assert'
     522 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:542:9: note: in expansion of macro '_compiletime_assert'
     542 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:9: note: in expansion of macro 'BUILD_BUG_ON'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |         ^~~~~~~~~~~~
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:22: note: in expansion of macro 'ARRAY_SIZE'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |                      ^~~~~~~~~~
   lib/tests/scanf_kunit.c:356:9: note: in expansion of macro 'test_array_8'
     356 |         test_array_8(fn, expect, test_buffer, fmt_buffer, result);              \
         |         ^~~~~~~~~~~~
   lib/tests/scanf_kunit.c:415:9: note: in expansion of macro 'numbers_list_8'
     415 |         numbers_list_8(int,                "0x%x",   delim, "i", check_int);
         |         ^~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c: In function 'numbers_list_h':
>> include/linux/compiler.h:197:61: warning: function 'numbers_list_h' might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                             ^
   include/linux/compiler_types.h:522:23: note: in definition of macro '__compiletime_assert'
     522 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:542:9: note: in expansion of macro '_compiletime_assert'
     542 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:9: note: in expansion of macro 'BUILD_BUG_ON'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |         ^~~~~~~~~~~~
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:22: note: in expansion of macro 'ARRAY_SIZE'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |                      ^~~~~~~~~~
   lib/tests/scanf_kunit.c:356:9: note: in expansion of macro 'test_array_8'
     356 |         test_array_8(fn, expect, test_buffer, fmt_buffer, result);              \
         |         ^~~~~~~~~~~~
   lib/tests/scanf_kunit.c:420:9: note: in expansion of macro 'numbers_list_8'
     420 |         numbers_list_8(unsigned short,     "%hu",    delim, "hu", check_ushort);
         |         ^~~~~~~~~~~~~~
>> include/linux/compiler.h:197:61: warning: function 'numbers_list_h' might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                             ^
   include/linux/compiler_types.h:522:23: note: in definition of macro '__compiletime_assert'
     522 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:542:9: note: in expansion of macro '_compiletime_assert'
     542 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:9: note: in expansion of macro 'BUILD_BUG_ON'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |         ^~~~~~~~~~~~
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:22: note: in expansion of macro 'ARRAY_SIZE'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |                      ^~~~~~~~~~
   lib/tests/scanf_kunit.c:356:9: note: in expansion of macro 'test_array_8'
     356 |         test_array_8(fn, expect, test_buffer, fmt_buffer, result);              \
         |         ^~~~~~~~~~~~
   lib/tests/scanf_kunit.c:421:9: note: in expansion of macro 'numbers_list_8'
     421 |         numbers_list_8(short,              "%hd",    delim, "hd", check_short);
         |         ^~~~~~~~~~~~~~
   include/linux/compiler.h:197:61: warning: function 'numbers_list_h' might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                             ^
   include/linux/compiler_types.h:522:23: note: in definition of macro '__compiletime_assert'
     522 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:542:9: note: in expansion of macro '_compiletime_assert'
     542 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:9: note: in expansion of macro 'BUILD_BUG_ON'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |         ^~~~~~~~~~~~
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:22: note: in expansion of macro 'ARRAY_SIZE'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |                      ^~~~~~~~~~
   lib/tests/scanf_kunit.c:356:9: note: in expansion of macro 'test_array_8'
     356 |         test_array_8(fn, expect, test_buffer, fmt_buffer, result);              \
         |         ^~~~~~~~~~~~
   lib/tests/scanf_kunit.c:422:9: note: in expansion of macro 'numbers_list_8'
     422 |         numbers_list_8(short,              "%hd",    delim, "hi", check_short);
         |         ^~~~~~~~~~~~~~
   include/linux/compiler.h:197:61: warning: function 'numbers_list_h' might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                             ^
   include/linux/compiler_types.h:522:23: note: in definition of macro '__compiletime_assert'
     522 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:542:9: note: in expansion of macro '_compiletime_assert'
     542 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:9: note: in expansion of macro 'BUILD_BUG_ON'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |         ^~~~~~~~~~~~
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/tests/scanf_kunit.c:333:22: note: in expansion of macro 'ARRAY_SIZE'
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);                                     \
         |                      ^~~~~~~~~~
   lib/tests/scanf_kunit.c:356:9: note: in expansion of macro 'test_array_8'
     356 |         test_array_8(fn, expect, test_buffer, fmt_buffer, result);              \
         |         ^~~~~~~~~~~~
   lib/tests/scanf_kunit.c:423:9: note: in expansion of macro 'numbers_list_8'
     423 |         numbers_list_8(unsigned short,     "%hx",    delim, "hx", check_ushort);
         |         ^~~~~~~~~~~~~~
   include/linux/compiler.h:197:61: warning: function 'numbers_list_h' might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))

vim +197 include/linux/compiler.h

230fa253df6352a Christian Borntraeger 2014-11-25  193  
cb7380de9e4cbc9 Kees Cook             2025-02-05  194  #ifdef __CHECKER__
cb7380de9e4cbc9 Kees Cook             2025-02-05  195  #define __BUILD_BUG_ON_ZERO_MSG(e, msg) (0)
cb7380de9e4cbc9 Kees Cook             2025-02-05  196  #else /* __CHECKER__ */
cb7380de9e4cbc9 Kees Cook             2025-02-05 @197  #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
cb7380de9e4cbc9 Kees Cook             2025-02-05  198  #endif /* __CHECKER__ */
cb7380de9e4cbc9 Kees Cook             2025-02-05  199  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#9 lore raw
Quoted 8 lines · kernel test robot

Hi Tamir,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 7b7a883c7f4de1ee5040bd1c32aabaafde54d209]

url:

https://github.com/intel-lab-lkp/linux/commits/Tamir-Duberstein/scanf-implicate-test-line-in-failure-messages/20250215-002302

Quoted 2 lines

base: 7b7a883c7f4de1ee5040bd1c32aabaafde54d209
patch link:

https://lore.kernel.org/r/20250214-scanf-kunit-convert-v8-3-5ea50f95f83c%40gmail.com

Quoted 2 lines

patch subject: [PATCH v8 3/4] scanf: convert self-test to KUnit
config: sh-randconfig-002-20250216 (

https://download.01.org/0day-ci/archive/20250216/[email protected]/config
)

Quoted 2 lines

compiler: sh4-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (

https://download.01.org/0day-ci/archive/20250216/[email protected]/reproduce
)

Quoted 2 lines

If you fix the issue in a separate patch/commit (i.e. not just a new

version of

Quoted 3 lines

the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes:

https://lore.kernel.org/oe-kbuild-all/[email protected]/

Quoted 6 lines

All warnings (new ones prefixed by >>):

In file included from <command-line>:
lib/tests/scanf_kunit.c: In function 'numbers_list_ll':

Quoted 1 line
Quoted 1 line

include/linux/compiler.h:197:61: warning: function 'numbers_list_ll'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

Quoted 1 line
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct

{_Static_assert(!(e), msg);}))

Quoted 2 lines

| ^
include/linux/compiler_types.h:522:23: note: in definition of macro

'__compiletime_assert'

Quoted 1 line

522 | if (!(condition))

         \
Quoted 2 lines
         |                       ^~~~~~~~~

include/linux/compiler_types.h:542:9: note: in expansion of macro

'_compiletime_assert'

Quoted 1 line

542 | _compiletime_assert(condition, msg,

__compiletime_assert_, __COUNTER__)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:39:37: note: in expansion of macro

'compiletime_assert'

Quoted 1 line

39 | #define BUILD_BUG_ON_MSG(cond, msg)

compiletime_assert(!(cond), msg)

Quoted 2 lines
         |                                     ^~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:50:9: note: in expansion of macro

'BUILD_BUG_ON_MSG'

Quoted 1 line

50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "

#condition)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~

lib/tests/scanf_kunit.c:333:9: note: in expansion of macro

'BUILD_BUG_ON'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |         ^~~~~~~~~~~~

include/linux/compiler.h:202:33: note: in expansion of macro

'__BUILD_BUG_ON_ZERO_MSG'

Quoted 1 line
     202 | #define __must_be_array(a)

__BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \

Quoted 2 lines
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~

include/linux/array_size.h:11:59: note: in expansion of macro

'__must_be_array'

Quoted 1 line
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +

__must_be_array(arr))

Quoted 1 line
         |

^~~~~~~~~~~~~~~

Quoted 1 line

lib/tests/scanf_kunit.c:333:22: note: in expansion of macro

'ARRAY_SIZE'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |                      ^~~~~~~~~~

lib/tests/scanf_kunit.c:356:9: note: in expansion of macro

'test_array_8'

Quoted 1 line

356 | test_array_8(fn, expect, test_buffer, fmt_buffer,

result); \

Quoted 2 lines
         |         ^~~~~~~~~~~~

lib/tests/scanf_kunit.c:390:9: note: in expansion of macro

'numbers_list_8'

Quoted 1 line

390 | numbers_list_8(unsigned long long, "%llu", delim,

"llu", check_ull);

Quoted 2 lines
         |         ^~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

include/linux/compiler.h:197:61: warning: function 'numbers_list_ll'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

Quoted 1 line
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct

{_Static_assert(!(e), msg);}))

Quoted 2 lines

| ^
include/linux/compiler_types.h:522:23: note: in definition of macro

'__compiletime_assert'

Quoted 1 line

522 | if (!(condition))

         \
Quoted 2 lines
         |                       ^~~~~~~~~

include/linux/compiler_types.h:542:9: note: in expansion of macro

'_compiletime_assert'

Quoted 1 line

542 | _compiletime_assert(condition, msg,

__compiletime_assert_, __COUNTER__)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:39:37: note: in expansion of macro

'compiletime_assert'

Quoted 1 line

39 | #define BUILD_BUG_ON_MSG(cond, msg)

compiletime_assert(!(cond), msg)

Quoted 2 lines
         |                                     ^~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:50:9: note: in expansion of macro

'BUILD_BUG_ON_MSG'

Quoted 1 line

50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "

#condition)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~

lib/tests/scanf_kunit.c:333:9: note: in expansion of macro

'BUILD_BUG_ON'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |         ^~~~~~~~~~~~

include/linux/compiler.h:202:33: note: in expansion of macro

'__BUILD_BUG_ON_ZERO_MSG'

Quoted 1 line
     202 | #define __must_be_array(a)

__BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \

Quoted 2 lines
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~

include/linux/array_size.h:11:59: note: in expansion of macro

'__must_be_array'

Quoted 1 line
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +

__must_be_array(arr))

Quoted 1 line
         |

^~~~~~~~~~~~~~~

Quoted 1 line

lib/tests/scanf_kunit.c:333:22: note: in expansion of macro

'ARRAY_SIZE'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |                      ^~~~~~~~~~

lib/tests/scanf_kunit.c:356:9: note: in expansion of macro

'test_array_8'

Quoted 1 line

356 | test_array_8(fn, expect, test_buffer, fmt_buffer,

result); \

Quoted 2 lines
         |         ^~~~~~~~~~~~

lib/tests/scanf_kunit.c:391:9: note: in expansion of macro

'numbers_list_8'

Quoted 1 line

391 | numbers_list_8(long long, "%lld", delim,

"lld", check_ll);

Quoted 2 lines
         |         ^~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

include/linux/compiler.h:197:61: warning: function 'numbers_list_ll'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

Quoted 1 line
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct

{_Static_assert(!(e), msg);}))

Quoted 2 lines

| ^
include/linux/compiler_types.h:522:23: note: in definition of macro

'__compiletime_assert'

Quoted 1 line

522 | if (!(condition))

         \
Quoted 2 lines
         |                       ^~~~~~~~~

include/linux/compiler_types.h:542:9: note: in expansion of macro

'_compiletime_assert'

Quoted 1 line

542 | _compiletime_assert(condition, msg,

__compiletime_assert_, __COUNTER__)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:39:37: note: in expansion of macro

'compiletime_assert'

Quoted 1 line

39 | #define BUILD_BUG_ON_MSG(cond, msg)

compiletime_assert(!(cond), msg)

Quoted 2 lines
         |                                     ^~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:50:9: note: in expansion of macro

'BUILD_BUG_ON_MSG'

Quoted 1 line

50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "

#condition)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~

lib/tests/scanf_kunit.c:333:9: note: in expansion of macro

'BUILD_BUG_ON'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |         ^~~~~~~~~~~~

include/linux/compiler.h:202:33: note: in expansion of macro

'__BUILD_BUG_ON_ZERO_MSG'

Quoted 1 line
     202 | #define __must_be_array(a)

__BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \

Quoted 2 lines
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~

include/linux/array_size.h:11:59: note: in expansion of macro

'__must_be_array'

Quoted 1 line
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +

__must_be_array(arr))

Quoted 1 line
         |

^~~~~~~~~~~~~~~

Quoted 1 line

lib/tests/scanf_kunit.c:333:22: note: in expansion of macro

'ARRAY_SIZE'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |                      ^~~~~~~~~~

lib/tests/scanf_kunit.c:356:9: note: in expansion of macro

'test_array_8'

Quoted 1 line

356 | test_array_8(fn, expect, test_buffer, fmt_buffer,

result); \

Quoted 2 lines
         |         ^~~~~~~~~~~~

lib/tests/scanf_kunit.c:392:9: note: in expansion of macro

'numbers_list_8'

Quoted 1 line

392 | numbers_list_8(long long, "%lld", delim,

"lli", check_ll);

Quoted 2 lines
         |         ^~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

include/linux/compiler.h:197:61: warning: function 'numbers_list_ll'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

Quoted 1 line
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct

{_Static_assert(!(e), msg);}))

Quoted 2 lines

| ^
include/linux/compiler_types.h:522:23: note: in definition of macro

'__compiletime_assert'

Quoted 1 line

522 | if (!(condition))

         \
Quoted 2 lines
         |                       ^~~~~~~~~

include/linux/compiler_types.h:542:9: note: in expansion of macro

'_compiletime_assert'

Quoted 1 line

542 | _compiletime_assert(condition, msg,

__compiletime_assert_, __COUNTER__)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:39:37: note: in expansion of macro

'compiletime_assert'

Quoted 1 line

39 | #define BUILD_BUG_ON_MSG(cond, msg)

compiletime_assert(!(cond), msg)

Quoted 2 lines
         |                                     ^~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:50:9: note: in expansion of macro

'BUILD_BUG_ON_MSG'

Quoted 1 line

50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "

#condition)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~

lib/tests/scanf_kunit.c:333:9: note: in expansion of macro

'BUILD_BUG_ON'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |         ^~~~~~~~~~~~

include/linux/compiler.h:202:33: note: in expansion of macro

'__BUILD_BUG_ON_ZERO_MSG'

Quoted 1 line
     202 | #define __must_be_array(a)

__BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \

Quoted 2 lines
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~

include/linux/array_size.h:11:59: note: in expansion of macro

'__must_be_array'

Quoted 1 line
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +

__must_be_array(arr))

Quoted 1 line
         |

^~~~~~~~~~~~~~~

Quoted 1 line

lib/tests/scanf_kunit.c:333:22: note: in expansion of macro

'ARRAY_SIZE'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |                      ^~~~~~~~~~

lib/tests/scanf_kunit.c:356:9: note: in expansion of macro

'test_array_8'

Quoted 1 line

356 | test_array_8(fn, expect, test_buffer, fmt_buffer,

result); \

Quoted 2 lines
         |         ^~~~~~~~~~~~

lib/tests/scanf_kunit.c:393:9: note: in expansion of macro

'numbers_list_8'

Quoted 1 line

393 | numbers_list_8(unsigned long long, "%llx", delim,

"llx", check_ull);

Quoted 2 lines
         |         ^~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

include/linux/compiler.h:197:61: warning: function 'numbers_list_ll'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

Quoted 1 line
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct

{_Static_assert(!(e), msg);}))

Quoted 2 lines

| ^
include/linux/compiler_types.h:522:23: note: in definition of macro

'__compiletime_assert'

Quoted 1 line

522 | if (!(condition))

         \
Quoted 2 lines
         |                       ^~~~~~~~~

include/linux/compiler_types.h:542:9: note: in expansion of macro

'_compiletime_assert'

Quoted 1 line

542 | _compiletime_assert(condition, msg,

__compiletime_assert_, __COUNTER__)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:39:37: note: in expansion of macro

'compiletime_assert'

Quoted 1 line

39 | #define BUILD_BUG_ON_MSG(cond, msg)

compiletime_assert(!(cond), msg)

Quoted 2 lines
         |                                     ^~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:50:9: note: in expansion of macro

'BUILD_BUG_ON_MSG'

Quoted 1 line

50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "

#condition)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~

lib/tests/scanf_kunit.c:333:9: note: in expansion of macro

'BUILD_BUG_ON'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |         ^~~~~~~~~~~~

include/linux/compiler.h:202:33: note: in expansion of macro

'__BUILD_BUG_ON_ZERO_MSG'

Quoted 1 line
     202 | #define __must_be_array(a)

__BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \

Quoted 2 lines
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~

include/linux/array_size.h:11:59: note: in expansion of macro

'__must_be_array'

Quoted 1 line
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +

__must_be_array(arr))

Quoted 1 line
         |

^~~~~~~~~~~~~~~

Quoted 1 line

lib/tests/scanf_kunit.c:333:22: note: in expansion of macro

'ARRAY_SIZE'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |                      ^~~~~~~~~~

lib/tests/scanf_kunit.c:356:9: note: in expansion of macro

'test_array_8'

Quoted 1 line

356 | test_array_8(fn, expect, test_buffer, fmt_buffer,

result); \

Quoted 2 lines
         |         ^~~~~~~~~~~~

lib/tests/scanf_kunit.c:394:9: note: in expansion of macro

'numbers_list_8'

Quoted 1 line
     394 |         numbers_list_8(unsigned long long, "0x%llx", delim,

"llx", check_ull);

Quoted 2 lines
         |         ^~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

include/linux/compiler.h:197:61: warning: function 'numbers_list_ll'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

Quoted 1 line
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct

{_Static_assert(!(e), msg);}))

Quoted 2 lines

| ^
include/linux/compiler_types.h:522:23: note: in definition of macro

'__compiletime_assert'

Quoted 1 line

522 | if (!(condition))

         \
Quoted 2 lines
         |                       ^~~~~~~~~

include/linux/compiler_types.h:542:9: note: in expansion of macro

'_compiletime_assert'

Quoted 1 line

542 | _compiletime_assert(condition, msg,

__compiletime_assert_, __COUNTER__)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:39:37: note: in expansion of macro

'compiletime_assert'

Quoted 1 line

39 | #define BUILD_BUG_ON_MSG(cond, msg)

compiletime_assert(!(cond), msg)

Quoted 2 lines
         |                                     ^~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:50:9: note: in expansion of macro

'BUILD_BUG_ON_MSG'

Quoted 1 line

50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "

#condition)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~

lib/tests/scanf_kunit.c:333:9: note: in expansion of macro

'BUILD_BUG_ON'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |         ^~~~~~~~~~~~

include/linux/compiler.h:202:33: note: in expansion of macro

'__BUILD_BUG_ON_ZERO_MSG'

Quoted 1 line
     202 | #define __must_be_array(a)

__BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \

Quoted 2 lines
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~

include/linux/array_size.h:11:59: note: in expansion of macro

'__must_be_array'

Quoted 1 line
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +

__must_be_array(arr))

Quoted 1 line
         |

^~~~~~~~~~~~~~~

Quoted 1 line

lib/tests/scanf_kunit.c:333:22: note: in expansion of macro

'ARRAY_SIZE'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |                      ^~~~~~~~~~

lib/tests/scanf_kunit.c:356:9: note: in expansion of macro

'test_array_8'

Quoted 1 line

356 | test_array_8(fn, expect, test_buffer, fmt_buffer,

result); \

Quoted 2 lines
         |         ^~~~~~~~~~~~

lib/tests/scanf_kunit.c:395:9: note: in expansion of macro

'numbers_list_8'

Quoted 1 line
     395 |         numbers_list_8(long long,          "0x%llx", delim,

"lli", check_ll);

Quoted 3 lines
         |         ^~~~~~~~~~~~~~

lib/tests/scanf_kunit.c: In function 'numbers_list_l':

Quoted 1 line
Quoted 1 line

include/linux/compiler.h:197:61: warning: function 'numbers_list_l'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

Quoted 1 line
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct

{_Static_assert(!(e), msg);}))

Quoted 2 lines

| ^
include/linux/compiler_types.h:522:23: note: in definition of macro

'__compiletime_assert'

Quoted 1 line

522 | if (!(condition))

         \
Quoted 2 lines
         |                       ^~~~~~~~~

include/linux/compiler_types.h:542:9: note: in expansion of macro

'_compiletime_assert'

Quoted 1 line

542 | _compiletime_assert(condition, msg,

__compiletime_assert_, __COUNTER__)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:39:37: note: in expansion of macro

'compiletime_assert'

Quoted 1 line

39 | #define BUILD_BUG_ON_MSG(cond, msg)

compiletime_assert(!(cond), msg)

Quoted 2 lines
         |                                     ^~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:50:9: note: in expansion of macro

'BUILD_BUG_ON_MSG'

Quoted 1 line

50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "

#condition)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~

lib/tests/scanf_kunit.c:333:9: note: in expansion of macro

'BUILD_BUG_ON'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |         ^~~~~~~~~~~~

include/linux/compiler.h:202:33: note: in expansion of macro

'__BUILD_BUG_ON_ZERO_MSG'

Quoted 1 line
     202 | #define __must_be_array(a)

__BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \

Quoted 2 lines
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~

include/linux/array_size.h:11:59: note: in expansion of macro

'__must_be_array'

Quoted 1 line
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +

__must_be_array(arr))

Quoted 1 line
         |

^~~~~~~~~~~~~~~

Quoted 1 line

lib/tests/scanf_kunit.c:333:22: note: in expansion of macro

'ARRAY_SIZE'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |                      ^~~~~~~~~~

lib/tests/scanf_kunit.c:356:9: note: in expansion of macro

'test_array_8'

Quoted 1 line

356 | test_array_8(fn, expect, test_buffer, fmt_buffer,

result); \

Quoted 2 lines
         |         ^~~~~~~~~~~~

lib/tests/scanf_kunit.c:400:9: note: in expansion of macro

'numbers_list_8'

Quoted 1 line

400 | numbers_list_8(unsigned long, "%lu", delim,

"lu", check_ulong);

Quoted 2 lines
         |         ^~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

include/linux/compiler.h:197:61: warning: function 'numbers_list_l'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

Quoted 1 line
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct

{_Static_assert(!(e), msg);}))

Quoted 2 lines

| ^
include/linux/compiler_types.h:522:23: note: in definition of macro

'__compiletime_assert'

Quoted 1 line

522 | if (!(condition))

         \
Quoted 2 lines
         |                       ^~~~~~~~~

include/linux/compiler_types.h:542:9: note: in expansion of macro

'_compiletime_assert'

Quoted 1 line

542 | _compiletime_assert(condition, msg,

__compiletime_assert_, __COUNTER__)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:39:37: note: in expansion of macro

'compiletime_assert'

Quoted 1 line

39 | #define BUILD_BUG_ON_MSG(cond, msg)

compiletime_assert(!(cond), msg)

Quoted 2 lines
         |                                     ^~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:50:9: note: in expansion of macro

'BUILD_BUG_ON_MSG'

Quoted 1 line

50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "

#condition)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~

lib/tests/scanf_kunit.c:333:9: note: in expansion of macro

'BUILD_BUG_ON'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |         ^~~~~~~~~~~~

include/linux/compiler.h:202:33: note: in expansion of macro

'__BUILD_BUG_ON_ZERO_MSG'

Quoted 1 line
     202 | #define __must_be_array(a)

__BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \

Quoted 2 lines
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~

include/linux/array_size.h:11:59: note: in expansion of macro

'__must_be_array'

Quoted 1 line
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +

__must_be_array(arr))

Quoted 1 line
         |

^~~~~~~~~~~~~~~

Quoted 1 line

lib/tests/scanf_kunit.c:333:22: note: in expansion of macro

'ARRAY_SIZE'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |                      ^~~~~~~~~~

lib/tests/scanf_kunit.c:356:9: note: in expansion of macro

'test_array_8'

Quoted 1 line

356 | test_array_8(fn, expect, test_buffer, fmt_buffer,

result); \

Quoted 2 lines
         |         ^~~~~~~~~~~~

lib/tests/scanf_kunit.c:401:9: note: in expansion of macro

'numbers_list_8'

Quoted 1 line

401 | numbers_list_8(long, "%ld", delim,

"ld", check_long);

Quoted 2 lines
         |         ^~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

include/linux/compiler.h:197:61: warning: function 'numbers_list_l'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

Quoted 1 line
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct

{_Static_assert(!(e), msg);}))

Quoted 2 lines

| ^
include/linux/compiler_types.h:522:23: note: in definition of macro

'__compiletime_assert'

Quoted 1 line

522 | if (!(condition))

         \
Quoted 2 lines
         |                       ^~~~~~~~~

include/linux/compiler_types.h:542:9: note: in expansion of macro

'_compiletime_assert'

Quoted 1 line

542 | _compiletime_assert(condition, msg,

__compiletime_assert_, __COUNTER__)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:39:37: note: in expansion of macro

'compiletime_assert'

Quoted 1 line

39 | #define BUILD_BUG_ON_MSG(cond, msg)

compiletime_assert(!(cond), msg)

Quoted 2 lines
         |                                     ^~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:50:9: note: in expansion of macro

'BUILD_BUG_ON_MSG'

Quoted 1 line

50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "

#condition)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~

lib/tests/scanf_kunit.c:333:9: note: in expansion of macro

'BUILD_BUG_ON'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |         ^~~~~~~~~~~~

include/linux/compiler.h:202:33: note: in expansion of macro

'__BUILD_BUG_ON_ZERO_MSG'

Quoted 1 line
     202 | #define __must_be_array(a)

__BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \

Quoted 2 lines
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~

include/linux/array_size.h:11:59: note: in expansion of macro

'__must_be_array'

Quoted 1 line
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +

__must_be_array(arr))

Quoted 1 line
         |

^~~~~~~~~~~~~~~

Quoted 1 line

lib/tests/scanf_kunit.c:333:22: note: in expansion of macro

'ARRAY_SIZE'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |                      ^~~~~~~~~~

lib/tests/scanf_kunit.c:356:9: note: in expansion of macro

'test_array_8'

Quoted 1 line

356 | test_array_8(fn, expect, test_buffer, fmt_buffer,

result); \

Quoted 2 lines
         |         ^~~~~~~~~~~~

lib/tests/scanf_kunit.c:402:9: note: in expansion of macro

'numbers_list_8'

Quoted 1 line

402 | numbers_list_8(long, "%ld", delim,

"li", check_long);

Quoted 2 lines
         |         ^~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

include/linux/compiler.h:197:61: warning: function 'numbers_list_l'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

Quoted 1 line
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct

{_Static_assert(!(e), msg);}))

Quoted 2 lines

| ^
include/linux/compiler_types.h:522:23: note: in definition of macro

'__compiletime_assert'

Quoted 1 line

522 | if (!(condition))

         \
Quoted 2 lines
         |                       ^~~~~~~~~

include/linux/compiler_types.h:542:9: note: in expansion of macro

'_compiletime_assert'

Quoted 1 line

542 | _compiletime_assert(condition, msg,

__compiletime_assert_, __COUNTER__)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:39:37: note: in expansion of macro

'compiletime_assert'

Quoted 1 line

39 | #define BUILD_BUG_ON_MSG(cond, msg)

compiletime_assert(!(cond), msg)

Quoted 2 lines
         |                                     ^~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:50:9: note: in expansion of macro

'BUILD_BUG_ON_MSG'

Quoted 1 line

50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "

#condition)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~

lib/tests/scanf_kunit.c:333:9: note: in expansion of macro

'BUILD_BUG_ON'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |         ^~~~~~~~~~~~

include/linux/compiler.h:202:33: note: in expansion of macro

'__BUILD_BUG_ON_ZERO_MSG'

Quoted 1 line
     202 | #define __must_be_array(a)

__BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \

Quoted 2 lines
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~

include/linux/array_size.h:11:59: note: in expansion of macro

'__must_be_array'

Quoted 1 line
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +

__must_be_array(arr))

Quoted 1 line
         |

^~~~~~~~~~~~~~~

Quoted 1 line

lib/tests/scanf_kunit.c:333:22: note: in expansion of macro

'ARRAY_SIZE'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |                      ^~~~~~~~~~

lib/tests/scanf_kunit.c:356:9: note: in expansion of macro

'test_array_8'

Quoted 1 line

356 | test_array_8(fn, expect, test_buffer, fmt_buffer,

result); \

Quoted 2 lines
         |         ^~~~~~~~~~~~

lib/tests/scanf_kunit.c:403:9: note: in expansion of macro

'numbers_list_8'

Quoted 1 line

403 | numbers_list_8(unsigned long, "%lx", delim,

"lx", check_ulong);

Quoted 2 lines
         |         ^~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

include/linux/compiler.h:197:61: warning: function 'numbers_list_l'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

Quoted 1 line
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct

{_Static_assert(!(e), msg);}))

Quoted 2 lines

| ^
include/linux/compiler_types.h:522:23: note: in definition of macro

'__compiletime_assert'

Quoted 1 line

522 | if (!(condition))

         \
Quoted 2 lines
         |                       ^~~~~~~~~

include/linux/compiler_types.h:542:9: note: in expansion of macro

'_compiletime_assert'

Quoted 1 line

542 | _compiletime_assert(condition, msg,

__compiletime_assert_, __COUNTER__)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:39:37: note: in expansion of macro

'compiletime_assert'

Quoted 1 line

39 | #define BUILD_BUG_ON_MSG(cond, msg)

compiletime_assert(!(cond), msg)

Quoted 2 lines
         |                                     ^~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:50:9: note: in expansion of macro

'BUILD_BUG_ON_MSG'

Quoted 1 line

50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "

#condition)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~

lib/tests/scanf_kunit.c:333:9: note: in expansion of macro

'BUILD_BUG_ON'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |         ^~~~~~~~~~~~

include/linux/compiler.h:202:33: note: in expansion of macro

'__BUILD_BUG_ON_ZERO_MSG'

Quoted 1 line
     202 | #define __must_be_array(a)

__BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \

Quoted 2 lines
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~

include/linux/array_size.h:11:59: note: in expansion of macro

'__must_be_array'

Quoted 1 line
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +

__must_be_array(arr))

Quoted 1 line
         |

^~~~~~~~~~~~~~~

Quoted 1 line

lib/tests/scanf_kunit.c:333:22: note: in expansion of macro

'ARRAY_SIZE'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |                      ^~~~~~~~~~

lib/tests/scanf_kunit.c:356:9: note: in expansion of macro

'test_array_8'

Quoted 1 line

356 | test_array_8(fn, expect, test_buffer, fmt_buffer,

result); \

Quoted 2 lines
         |         ^~~~~~~~~~~~

lib/tests/scanf_kunit.c:404:9: note: in expansion of macro

'numbers_list_8'

Quoted 1 line
     404 |         numbers_list_8(unsigned long,      "0x%lx",  delim,

"lx", check_ulong);

Quoted 2 lines
         |         ^~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

include/linux/compiler.h:197:61: warning: function 'numbers_list_l'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

Quoted 1 line
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct

{_Static_assert(!(e), msg);}))

Quoted 2 lines

| ^
include/linux/compiler_types.h:522:23: note: in definition of macro

'__compiletime_assert'

Quoted 1 line

522 | if (!(condition))

         \
Quoted 2 lines
         |                       ^~~~~~~~~

include/linux/compiler_types.h:542:9: note: in expansion of macro

'_compiletime_assert'

Quoted 1 line

542 | _compiletime_assert(condition, msg,

__compiletime_assert_, __COUNTER__)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:39:37: note: in expansion of macro

'compiletime_assert'

Quoted 1 line

39 | #define BUILD_BUG_ON_MSG(cond, msg)

compiletime_assert(!(cond), msg)

Quoted 2 lines
         |                                     ^~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:50:9: note: in expansion of macro

'BUILD_BUG_ON_MSG'

Quoted 1 line

50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "

#condition)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~

lib/tests/scanf_kunit.c:333:9: note: in expansion of macro

'BUILD_BUG_ON'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |         ^~~~~~~~~~~~

include/linux/compiler.h:202:33: note: in expansion of macro

'__BUILD_BUG_ON_ZERO_MSG'

Quoted 1 line
     202 | #define __must_be_array(a)

__BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \

Quoted 2 lines
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~

include/linux/array_size.h:11:59: note: in expansion of macro

'__must_be_array'

Quoted 1 line
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +

__must_be_array(arr))

Quoted 1 line
         |

^~~~~~~~~~~~~~~

Quoted 1 line

lib/tests/scanf_kunit.c:333:22: note: in expansion of macro

'ARRAY_SIZE'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |                      ^~~~~~~~~~

lib/tests/scanf_kunit.c:356:9: note: in expansion of macro

'test_array_8'

Quoted 1 line

356 | test_array_8(fn, expect, test_buffer, fmt_buffer,

result); \

Quoted 2 lines
         |         ^~~~~~~~~~~~

lib/tests/scanf_kunit.c:405:9: note: in expansion of macro

'numbers_list_8'

Quoted 1 line
     405 |         numbers_list_8(long,               "0x%lx",  delim,

"li", check_long);

Quoted 3 lines
         |         ^~~~~~~~~~~~~~

lib/tests/scanf_kunit.c: In function 'numbers_list_d':

Quoted 1 line
Quoted 1 line

include/linux/compiler.h:197:61: warning: function 'numbers_list_d'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

Quoted 1 line
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct

{_Static_assert(!(e), msg);}))

Quoted 2 lines

| ^
include/linux/compiler_types.h:522:23: note: in definition of macro

'__compiletime_assert'

Quoted 1 line

522 | if (!(condition))

         \
Quoted 2 lines
         |                       ^~~~~~~~~

include/linux/compiler_types.h:542:9: note: in expansion of macro

'_compiletime_assert'

Quoted 1 line

542 | _compiletime_assert(condition, msg,

__compiletime_assert_, __COUNTER__)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:39:37: note: in expansion of macro

'compiletime_assert'

Quoted 1 line

39 | #define BUILD_BUG_ON_MSG(cond, msg)

compiletime_assert(!(cond), msg)

Quoted 2 lines
         |                                     ^~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:50:9: note: in expansion of macro

'BUILD_BUG_ON_MSG'

Quoted 1 line

50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "

#condition)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~

lib/tests/scanf_kunit.c:333:9: note: in expansion of macro

'BUILD_BUG_ON'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |         ^~~~~~~~~~~~

include/linux/compiler.h:202:33: note: in expansion of macro

'__BUILD_BUG_ON_ZERO_MSG'

Quoted 1 line
     202 | #define __must_be_array(a)

__BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \

Quoted 2 lines
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~

include/linux/array_size.h:11:59: note: in expansion of macro

'__must_be_array'

Quoted 1 line
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +

__must_be_array(arr))

Quoted 1 line
         |

^~~~~~~~~~~~~~~

Quoted 1 line

lib/tests/scanf_kunit.c:333:22: note: in expansion of macro

'ARRAY_SIZE'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |                      ^~~~~~~~~~

lib/tests/scanf_kunit.c:356:9: note: in expansion of macro

'test_array_8'

Quoted 1 line

356 | test_array_8(fn, expect, test_buffer, fmt_buffer,

result); \

Quoted 2 lines
         |         ^~~~~~~~~~~~

lib/tests/scanf_kunit.c:410:9: note: in expansion of macro

'numbers_list_8'

Quoted 1 line

410 | numbers_list_8(unsigned int, "%u", delim,

"u", check_uint);

Quoted 2 lines
         |         ^~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

include/linux/compiler.h:197:61: warning: function 'numbers_list_d'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

Quoted 1 line
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct

{_Static_assert(!(e), msg);}))

Quoted 2 lines

| ^
include/linux/compiler_types.h:522:23: note: in definition of macro

'__compiletime_assert'

Quoted 1 line

522 | if (!(condition))

         \
Quoted 2 lines
         |                       ^~~~~~~~~

include/linux/compiler_types.h:542:9: note: in expansion of macro

'_compiletime_assert'

Quoted 1 line

542 | _compiletime_assert(condition, msg,

__compiletime_assert_, __COUNTER__)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:39:37: note: in expansion of macro

'compiletime_assert'

Quoted 1 line

39 | #define BUILD_BUG_ON_MSG(cond, msg)

compiletime_assert(!(cond), msg)

Quoted 2 lines
         |                                     ^~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:50:9: note: in expansion of macro

'BUILD_BUG_ON_MSG'

Quoted 1 line

50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "

#condition)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~

lib/tests/scanf_kunit.c:333:9: note: in expansion of macro

'BUILD_BUG_ON'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |         ^~~~~~~~~~~~

include/linux/compiler.h:202:33: note: in expansion of macro

'__BUILD_BUG_ON_ZERO_MSG'

Quoted 1 line
     202 | #define __must_be_array(a)

__BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \

Quoted 2 lines
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~

include/linux/array_size.h:11:59: note: in expansion of macro

'__must_be_array'

Quoted 1 line
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +

__must_be_array(arr))

Quoted 1 line
         |

^~~~~~~~~~~~~~~

Quoted 1 line

lib/tests/scanf_kunit.c:333:22: note: in expansion of macro

'ARRAY_SIZE'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |                      ^~~~~~~~~~

lib/tests/scanf_kunit.c:356:9: note: in expansion of macro

'test_array_8'

Quoted 1 line

356 | test_array_8(fn, expect, test_buffer, fmt_buffer,

result); \

Quoted 2 lines
         |         ^~~~~~~~~~~~

lib/tests/scanf_kunit.c:411:9: note: in expansion of macro

'numbers_list_8'

Quoted 1 line

411 | numbers_list_8(int, "%d", delim,

"d", check_int);

Quoted 2 lines
         |         ^~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

include/linux/compiler.h:197:61: warning: function 'numbers_list_d'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

Quoted 1 line
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct

{_Static_assert(!(e), msg);}))

Quoted 2 lines

| ^
include/linux/compiler_types.h:522:23: note: in definition of macro

'__compiletime_assert'

Quoted 1 line

522 | if (!(condition))

         \
Quoted 2 lines
         |                       ^~~~~~~~~

include/linux/compiler_types.h:542:9: note: in expansion of macro

'_compiletime_assert'

Quoted 1 line

542 | _compiletime_assert(condition, msg,

__compiletime_assert_, __COUNTER__)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:39:37: note: in expansion of macro

'compiletime_assert'

Quoted 1 line

39 | #define BUILD_BUG_ON_MSG(cond, msg)

compiletime_assert(!(cond), msg)

Quoted 2 lines
         |                                     ^~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:50:9: note: in expansion of macro

'BUILD_BUG_ON_MSG'

Quoted 1 line

50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "

#condition)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~

lib/tests/scanf_kunit.c:333:9: note: in expansion of macro

'BUILD_BUG_ON'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |         ^~~~~~~~~~~~

include/linux/compiler.h:202:33: note: in expansion of macro

'__BUILD_BUG_ON_ZERO_MSG'

Quoted 1 line
     202 | #define __must_be_array(a)

__BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \

Quoted 2 lines
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~

include/linux/array_size.h:11:59: note: in expansion of macro

'__must_be_array'

Quoted 1 line
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +

__must_be_array(arr))

Quoted 1 line
         |

^~~~~~~~~~~~~~~

Quoted 1 line

lib/tests/scanf_kunit.c:333:22: note: in expansion of macro

'ARRAY_SIZE'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |                      ^~~~~~~~~~

lib/tests/scanf_kunit.c:356:9: note: in expansion of macro

'test_array_8'

Quoted 1 line

356 | test_array_8(fn, expect, test_buffer, fmt_buffer,

result); \

Quoted 2 lines
         |         ^~~~~~~~~~~~

lib/tests/scanf_kunit.c:412:9: note: in expansion of macro

'numbers_list_8'

Quoted 1 line

412 | numbers_list_8(int, "%d", delim,

"i", check_int);

Quoted 2 lines
         |         ^~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

include/linux/compiler.h:197:61: warning: function 'numbers_list_d'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

Quoted 1 line
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct

{_Static_assert(!(e), msg);}))

Quoted 2 lines

| ^
include/linux/compiler_types.h:522:23: note: in definition of macro

'__compiletime_assert'

Quoted 1 line

522 | if (!(condition))

         \
Quoted 2 lines
         |                       ^~~~~~~~~

include/linux/compiler_types.h:542:9: note: in expansion of macro

'_compiletime_assert'

Quoted 1 line

542 | _compiletime_assert(condition, msg,

__compiletime_assert_, __COUNTER__)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:39:37: note: in expansion of macro

'compiletime_assert'

Quoted 1 line

39 | #define BUILD_BUG_ON_MSG(cond, msg)

compiletime_assert(!(cond), msg)

Quoted 2 lines
         |                                     ^~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:50:9: note: in expansion of macro

'BUILD_BUG_ON_MSG'

Quoted 1 line

50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "

#condition)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~

lib/tests/scanf_kunit.c:333:9: note: in expansion of macro

'BUILD_BUG_ON'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |         ^~~~~~~~~~~~

include/linux/compiler.h:202:33: note: in expansion of macro

'__BUILD_BUG_ON_ZERO_MSG'

Quoted 1 line
     202 | #define __must_be_array(a)

__BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \

Quoted 2 lines
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~

include/linux/array_size.h:11:59: note: in expansion of macro

'__must_be_array'

Quoted 1 line
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +

__must_be_array(arr))

Quoted 1 line
         |

^~~~~~~~~~~~~~~

Quoted 1 line

lib/tests/scanf_kunit.c:333:22: note: in expansion of macro

'ARRAY_SIZE'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |                      ^~~~~~~~~~

lib/tests/scanf_kunit.c:356:9: note: in expansion of macro

'test_array_8'

Quoted 1 line

356 | test_array_8(fn, expect, test_buffer, fmt_buffer,

result); \

Quoted 2 lines
         |         ^~~~~~~~~~~~

lib/tests/scanf_kunit.c:413:9: note: in expansion of macro

'numbers_list_8'

Quoted 1 line

413 | numbers_list_8(unsigned int, "%x", delim,

"x", check_uint);

Quoted 2 lines
         |         ^~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

include/linux/compiler.h:197:61: warning: function 'numbers_list_d'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

Quoted 1 line
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct

{_Static_assert(!(e), msg);}))

Quoted 2 lines

| ^
include/linux/compiler_types.h:522:23: note: in definition of macro

'__compiletime_assert'

Quoted 1 line

522 | if (!(condition))

         \
Quoted 2 lines
         |                       ^~~~~~~~~

include/linux/compiler_types.h:542:9: note: in expansion of macro

'_compiletime_assert'

Quoted 1 line

542 | _compiletime_assert(condition, msg,

__compiletime_assert_, __COUNTER__)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:39:37: note: in expansion of macro

'compiletime_assert'

Quoted 1 line

39 | #define BUILD_BUG_ON_MSG(cond, msg)

compiletime_assert(!(cond), msg)

Quoted 2 lines
         |                                     ^~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:50:9: note: in expansion of macro

'BUILD_BUG_ON_MSG'

Quoted 1 line

50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "

#condition)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~

lib/tests/scanf_kunit.c:333:9: note: in expansion of macro

'BUILD_BUG_ON'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |         ^~~~~~~~~~~~

include/linux/compiler.h:202:33: note: in expansion of macro

'__BUILD_BUG_ON_ZERO_MSG'

Quoted 1 line
     202 | #define __must_be_array(a)

__BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \

Quoted 2 lines
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~

include/linux/array_size.h:11:59: note: in expansion of macro

'__must_be_array'

Quoted 1 line
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +

__must_be_array(arr))

Quoted 1 line
         |

^~~~~~~~~~~~~~~

Quoted 1 line

lib/tests/scanf_kunit.c:333:22: note: in expansion of macro

'ARRAY_SIZE'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |                      ^~~~~~~~~~

lib/tests/scanf_kunit.c:356:9: note: in expansion of macro

'test_array_8'

Quoted 1 line

356 | test_array_8(fn, expect, test_buffer, fmt_buffer,

result); \

Quoted 2 lines
         |         ^~~~~~~~~~~~

lib/tests/scanf_kunit.c:414:9: note: in expansion of macro

'numbers_list_8'

Quoted 1 line
     414 |         numbers_list_8(unsigned int,       "0x%x",   delim,

"x", check_uint);

Quoted 2 lines
         |         ^~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

include/linux/compiler.h:197:61: warning: function 'numbers_list_d'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

Quoted 1 line
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct

{_Static_assert(!(e), msg);}))

Quoted 2 lines

| ^
include/linux/compiler_types.h:522:23: note: in definition of macro

'__compiletime_assert'

Quoted 1 line

522 | if (!(condition))

         \
Quoted 2 lines
         |                       ^~~~~~~~~

include/linux/compiler_types.h:542:9: note: in expansion of macro

'_compiletime_assert'

Quoted 1 line

542 | _compiletime_assert(condition, msg,

__compiletime_assert_, __COUNTER__)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:39:37: note: in expansion of macro

'compiletime_assert'

Quoted 1 line

39 | #define BUILD_BUG_ON_MSG(cond, msg)

compiletime_assert(!(cond), msg)

Quoted 2 lines
         |                                     ^~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:50:9: note: in expansion of macro

'BUILD_BUG_ON_MSG'

Quoted 1 line

50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "

#condition)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~

lib/tests/scanf_kunit.c:333:9: note: in expansion of macro

'BUILD_BUG_ON'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |         ^~~~~~~~~~~~

include/linux/compiler.h:202:33: note: in expansion of macro

'__BUILD_BUG_ON_ZERO_MSG'

Quoted 1 line
     202 | #define __must_be_array(a)

__BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \

Quoted 2 lines
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~

include/linux/array_size.h:11:59: note: in expansion of macro

'__must_be_array'

Quoted 1 line
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +

__must_be_array(arr))

Quoted 1 line
         |

^~~~~~~~~~~~~~~

Quoted 1 line

lib/tests/scanf_kunit.c:333:22: note: in expansion of macro

'ARRAY_SIZE'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |                      ^~~~~~~~~~

lib/tests/scanf_kunit.c:356:9: note: in expansion of macro

'test_array_8'

Quoted 1 line

356 | test_array_8(fn, expect, test_buffer, fmt_buffer,

result); \

Quoted 2 lines
         |         ^~~~~~~~~~~~

lib/tests/scanf_kunit.c:415:9: note: in expansion of macro

'numbers_list_8'

Quoted 1 line
     415 |         numbers_list_8(int,                "0x%x",   delim,

"i", check_int);

Quoted 3 lines
         |         ^~~~~~~~~~~~~~

lib/tests/scanf_kunit.c: In function 'numbers_list_h':

Quoted 1 line
Quoted 1 line

include/linux/compiler.h:197:61: warning: function 'numbers_list_h'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

Quoted 1 line
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct

{_Static_assert(!(e), msg);}))

Quoted 2 lines

| ^
include/linux/compiler_types.h:522:23: note: in definition of macro

'__compiletime_assert'

Quoted 1 line

522 | if (!(condition))

         \
Quoted 2 lines
         |                       ^~~~~~~~~

include/linux/compiler_types.h:542:9: note: in expansion of macro

'_compiletime_assert'

Quoted 1 line

542 | _compiletime_assert(condition, msg,

__compiletime_assert_, __COUNTER__)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:39:37: note: in expansion of macro

'compiletime_assert'

Quoted 1 line

39 | #define BUILD_BUG_ON_MSG(cond, msg)

compiletime_assert(!(cond), msg)

Quoted 2 lines
         |                                     ^~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:50:9: note: in expansion of macro

'BUILD_BUG_ON_MSG'

Quoted 1 line

50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "

#condition)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~

lib/tests/scanf_kunit.c:333:9: note: in expansion of macro

'BUILD_BUG_ON'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |         ^~~~~~~~~~~~

include/linux/compiler.h:202:33: note: in expansion of macro

'__BUILD_BUG_ON_ZERO_MSG'

Quoted 1 line
     202 | #define __must_be_array(a)

__BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \

Quoted 2 lines
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~

include/linux/array_size.h:11:59: note: in expansion of macro

'__must_be_array'

Quoted 1 line
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +

__must_be_array(arr))

Quoted 1 line
         |

^~~~~~~~~~~~~~~

Quoted 1 line

lib/tests/scanf_kunit.c:333:22: note: in expansion of macro

'ARRAY_SIZE'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |                      ^~~~~~~~~~

lib/tests/scanf_kunit.c:356:9: note: in expansion of macro

'test_array_8'

Quoted 1 line

356 | test_array_8(fn, expect, test_buffer, fmt_buffer,

result); \

Quoted 2 lines
         |         ^~~~~~~~~~~~

lib/tests/scanf_kunit.c:420:9: note: in expansion of macro

'numbers_list_8'

Quoted 1 line

420 | numbers_list_8(unsigned short, "%hu", delim,

"hu", check_ushort);

Quoted 2 lines
         |         ^~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

include/linux/compiler.h:197:61: warning: function 'numbers_list_h'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

Quoted 1 line
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct

{_Static_assert(!(e), msg);}))

Quoted 2 lines

| ^
include/linux/compiler_types.h:522:23: note: in definition of macro

'__compiletime_assert'

Quoted 1 line

522 | if (!(condition))

         \
Quoted 2 lines
         |                       ^~~~~~~~~

include/linux/compiler_types.h:542:9: note: in expansion of macro

'_compiletime_assert'

Quoted 1 line

542 | _compiletime_assert(condition, msg,

__compiletime_assert_, __COUNTER__)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:39:37: note: in expansion of macro

'compiletime_assert'

Quoted 1 line

39 | #define BUILD_BUG_ON_MSG(cond, msg)

compiletime_assert(!(cond), msg)

Quoted 2 lines
         |                                     ^~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:50:9: note: in expansion of macro

'BUILD_BUG_ON_MSG'

Quoted 1 line

50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "

#condition)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~

lib/tests/scanf_kunit.c:333:9: note: in expansion of macro

'BUILD_BUG_ON'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |         ^~~~~~~~~~~~

include/linux/compiler.h:202:33: note: in expansion of macro

'__BUILD_BUG_ON_ZERO_MSG'

Quoted 1 line
     202 | #define __must_be_array(a)

__BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \

Quoted 2 lines
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~

include/linux/array_size.h:11:59: note: in expansion of macro

'__must_be_array'

Quoted 1 line
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +

__must_be_array(arr))

Quoted 1 line
         |

^~~~~~~~~~~~~~~

Quoted 1 line

lib/tests/scanf_kunit.c:333:22: note: in expansion of macro

'ARRAY_SIZE'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |                      ^~~~~~~~~~

lib/tests/scanf_kunit.c:356:9: note: in expansion of macro

'test_array_8'

Quoted 1 line

356 | test_array_8(fn, expect, test_buffer, fmt_buffer,

result); \

Quoted 2 lines
         |         ^~~~~~~~~~~~

lib/tests/scanf_kunit.c:421:9: note: in expansion of macro

'numbers_list_8'

Quoted 1 line

421 | numbers_list_8(short, "%hd", delim,

"hd", check_short);

Quoted 2 lines
         |         ^~~~~~~~~~~~~~

include/linux/compiler.h:197:61: warning: function 'numbers_list_h'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

Quoted 1 line
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct

{_Static_assert(!(e), msg);}))

Quoted 2 lines

| ^
include/linux/compiler_types.h:522:23: note: in definition of macro

'__compiletime_assert'

Quoted 1 line

522 | if (!(condition))

         \
Quoted 2 lines
         |                       ^~~~~~~~~

include/linux/compiler_types.h:542:9: note: in expansion of macro

'_compiletime_assert'

Quoted 1 line

542 | _compiletime_assert(condition, msg,

__compiletime_assert_, __COUNTER__)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:39:37: note: in expansion of macro

'compiletime_assert'

Quoted 1 line

39 | #define BUILD_BUG_ON_MSG(cond, msg)

compiletime_assert(!(cond), msg)

Quoted 2 lines
         |                                     ^~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:50:9: note: in expansion of macro

'BUILD_BUG_ON_MSG'

Quoted 1 line

50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "

#condition)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~

lib/tests/scanf_kunit.c:333:9: note: in expansion of macro

'BUILD_BUG_ON'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |         ^~~~~~~~~~~~

include/linux/compiler.h:202:33: note: in expansion of macro

'__BUILD_BUG_ON_ZERO_MSG'

Quoted 1 line
     202 | #define __must_be_array(a)

__BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \

Quoted 2 lines
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~

include/linux/array_size.h:11:59: note: in expansion of macro

'__must_be_array'

Quoted 1 line
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +

__must_be_array(arr))

Quoted 1 line
         |

^~~~~~~~~~~~~~~

Quoted 1 line

lib/tests/scanf_kunit.c:333:22: note: in expansion of macro

'ARRAY_SIZE'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |                      ^~~~~~~~~~

lib/tests/scanf_kunit.c:356:9: note: in expansion of macro

'test_array_8'

Quoted 1 line

356 | test_array_8(fn, expect, test_buffer, fmt_buffer,

result); \

Quoted 2 lines
         |         ^~~~~~~~~~~~

lib/tests/scanf_kunit.c:422:9: note: in expansion of macro

'numbers_list_8'

Quoted 1 line

422 | numbers_list_8(short, "%hd", delim,

"hi", check_short);

Quoted 2 lines
         |         ^~~~~~~~~~~~~~

include/linux/compiler.h:197:61: warning: function 'numbers_list_h'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

Quoted 1 line
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct

{_Static_assert(!(e), msg);}))

Quoted 2 lines

| ^
include/linux/compiler_types.h:522:23: note: in definition of macro

'__compiletime_assert'

Quoted 1 line

522 | if (!(condition))

         \
Quoted 2 lines
         |                       ^~~~~~~~~

include/linux/compiler_types.h:542:9: note: in expansion of macro

'_compiletime_assert'

Quoted 1 line

542 | _compiletime_assert(condition, msg,

__compiletime_assert_, __COUNTER__)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:39:37: note: in expansion of macro

'compiletime_assert'

Quoted 1 line

39 | #define BUILD_BUG_ON_MSG(cond, msg)

compiletime_assert(!(cond), msg)

Quoted 2 lines
         |                                     ^~~~~~~~~~~~~~~~~~

include/linux/build_bug.h:50:9: note: in expansion of macro

'BUILD_BUG_ON_MSG'

Quoted 1 line

50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: "

#condition)

Quoted 2 lines
         |         ^~~~~~~~~~~~~~~~

lib/tests/scanf_kunit.c:333:9: note: in expansion of macro

'BUILD_BUG_ON'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |         ^~~~~~~~~~~~

include/linux/compiler.h:202:33: note: in expansion of macro

'__BUILD_BUG_ON_ZERO_MSG'

Quoted 1 line
     202 | #define __must_be_array(a)

__BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \

Quoted 2 lines
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~

include/linux/array_size.h:11:59: note: in expansion of macro

'__must_be_array'

Quoted 1 line
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +

__must_be_array(arr))

Quoted 1 line
         |

^~~~~~~~~~~~~~~

Quoted 1 line

lib/tests/scanf_kunit.c:333:22: note: in expansion of macro

'ARRAY_SIZE'

Quoted 1 line
     333 |         BUILD_BUG_ON(ARRAY_SIZE(arr) != 8);
                 \
Quoted 2 lines
         |                      ^~~~~~~~~~

lib/tests/scanf_kunit.c:356:9: note: in expansion of macro

'test_array_8'

Quoted 1 line

356 | test_array_8(fn, expect, test_buffer, fmt_buffer,

result); \

Quoted 2 lines
         |         ^~~~~~~~~~~~

lib/tests/scanf_kunit.c:423:9: note: in expansion of macro

'numbers_list_8'

Quoted 1 line

423 | numbers_list_8(unsigned short, "%hx", delim,

"hx", check_ushort);

Quoted 2 lines
         |         ^~~~~~~~~~~~~~

include/linux/compiler.h:197:61: warning: function 'numbers_list_h'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

Quoted 1 line
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct

{_Static_assert(!(e), msg);}))

Quoted 7 lines

vim +197 include/linux/compiler.h

230fa253df6352a Christian Borntraeger 2014-11-25  193
cb7380de9e4cbc9 Kees Cook             2025-02-05  194  #ifdef __CHECKER__
cb7380de9e4cbc9 Kees Cook             2025-02-05  195  #define

__BUILD_BUG_ON_ZERO_MSG(e, msg) (0)

Quoted 1 line

cb7380de9e4cbc9 Kees Cook 2025-02-05 196 #else /*

__CHECKER__ */

Quoted 1 line

cb7380de9e4cbc9 Kees Cook 2025-02-05 @197 #define

__BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))

Quoted 1 line

cb7380de9e4cbc9 Kees Cook 2025-02-05 198 #endif /*

__CHECKER__ */

Quoted 5 lines

cb7380de9e4cbc9 Kees Cook 2025-02-05 199

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

I am not able to reproduce these warnings with clang 19.1.7. They also don't obviously make sense to me.

#10 lore raw
Quoted 4 lines · Tamir Duberstein

On Sat, Feb 15, 2025 at 1:51 PM kernel test robot <[email protected]> wrote:

I am not able to reproduce these warnings with clang 19.1.7. They also don't obviously make sense to me.

Please, when reply, remove boielrplate stuff!
I have just wasted a couple of minutes to understand what's going on in the message that is 2700 lines of text as the reply to the bot message which was ~700 lines.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#11 lore raw
Quoted 5 lines · Andy Shevchenko

Please, when reply, remove boielrplate stuff!
I have just wasted a couple of minutes to understand what's going on in the message that is 2700 lines of text as the reply to the bot message which was ~700 lines.

My apologies. I forgot what a mess a mobile email client makes.

maintainer
#12 lore raw
In reply to Tamir Duberstein
Quoted 31 lines · Tamir Duberstein
Quoted 8 lines · kernel test robot

Hi Tamir,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 7b7a883c7f4de1ee5040bd1c32aabaafde54d209]

url:

https://github.com/intel-lab-lkp/linux/commits/Tamir-Duberstein/scanf-implicate-test-line-in-failure-messages/20250215-002302

Quoted 2 lines

base: 7b7a883c7f4de1ee5040bd1c32aabaafde54d209
patch link:

https://lore.kernel.org/r/20250214-scanf-kunit-convert-v8-3-5ea50f95f83c%40gmail.com

Quoted 2 lines

patch subject: [PATCH v8 3/4] scanf: convert self-test to KUnit
config: sh-randconfig-002-20250216 (

https://download.01.org/0day-ci/archive/20250216/[email protected]/config
)

Quoted 2 lines

compiler: sh4-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (

https://download.01.org/0day-ci/archive/20250216/[email protected]/reproduce
)

Quoted 2 lines

If you fix the issue in a separate patch/commit (i.e. not just a new

version of

Quoted 3 lines

the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes:

https://lore.kernel.org/oe-kbuild-all/[email protected]/

Quoted 3 lines

All warnings (new ones prefixed by >>):

Quoted 8 lines
Quoted 3 lines

In file included from <command-line>:
lib/tests/scanf_kunit.c: In function 'numbers_list_ll':

Quoted 1 line
Quoted 1 line

include/linux/compiler.h:197:61: warning: function 'numbers_list_ll'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

I am not able to reproduce these warnings with clang 19.1.7. They also don't obviously make sense to me.

I have reproduced the problem with gcc:

$> gcc --version
gcc (SUSE Linux) 14.2.1 20250220 [revision 9ffecde121af883b60bbe60d00425036bc873048]

$> make W=1 lib/test_scanf.ko
CALL scripts/checksyscalls.sh
DESCEND objtool
INSTALL libsubcmd_headers
CC [M] lib/test_scanf.o
In file included from <command-line>:
lib/test_scanf.c: In function ‘numbers_list_ll’:
./include/linux/compiler.h:197:61: warning: function ‘numbers_list_ll’ might be a candidate for ‘gnu_scanf’ format attribute [-Wsuggest-attribute=format]
197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
| ^
[...]

It seems that it is a regression introduced by the first patch of this patch set. And the fix is:

lib/test_scanf.c +1 -1
index d1664e0d0138..e65b10c3dc11 100644
@@ -27,7 +27,7 @@ static struct rnd_state rnd_state __initdata;
 typedef int (*check_fn)(const char *file, const int line, const void *check_data,
 			const char *string, const char *fmt, int n_args, va_list ap);
 
-static void __scanf(6, 0) __init
+static void __scanf(6, 8) __init
 _test(const char *file, const int line, check_fn fn, const void *check_data, const char *string,
 	const char *fmt, int n_args, ...)
 {

Best Regards,
Petr

#13 lore raw
Quoted 76 lines · Petr Mladek
Quoted 31 lines · Tamir Duberstein
Quoted 8 lines · kernel test robot

Hi Tamir,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 7b7a883c7f4de1ee5040bd1c32aabaafde54d209]

url:

https://github.com/intel-lab-lkp/linux/commits/Tamir-Duberstein/scanf-implicate-test-line-in-failure-messages/20250215-002302

Quoted 2 lines

base: 7b7a883c7f4de1ee5040bd1c32aabaafde54d209
patch link:

https://lore.kernel.org/r/20250214-scanf-kunit-convert-v8-3-5ea50f95f83c%40gmail.com

Quoted 2 lines

patch subject: [PATCH v8 3/4] scanf: convert self-test to KUnit
config: sh-randconfig-002-20250216 (

https://download.01.org/0day-ci/archive/20250216/[email protected]/config
)

Quoted 2 lines

compiler: sh4-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (

https://download.01.org/0day-ci/archive/20250216/[email protected]/reproduce
)

Quoted 2 lines

If you fix the issue in a separate patch/commit (i.e. not just a new

version of

Quoted 3 lines

the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes:

https://lore.kernel.org/oe-kbuild-all/[email protected]/

Quoted 3 lines

All warnings (new ones prefixed by >>):

Quoted 8 lines
Quoted 3 lines

In file included from <command-line>:
lib/tests/scanf_kunit.c: In function 'numbers_list_ll':

Quoted 1 line
Quoted 1 line

include/linux/compiler.h:197:61: warning: function 'numbers_list_ll'

might be a candidate for 'gnu_scanf' format attribute [-Wsuggest-attribute=format]

I am not able to reproduce these warnings with clang 19.1.7. They also don't obviously make sense to me.

I have reproduced the problem with gcc:

$> gcc --version
gcc (SUSE Linux) 14.2.1 20250220 [revision 9ffecde121af883b60bbe60d00425036bc873048]

$> make W=1 lib/test_scanf.ko
CALL scripts/checksyscalls.sh
DESCEND objtool
INSTALL libsubcmd_headers
CC [M] lib/test_scanf.o
In file included from <command-line>:
lib/test_scanf.c: In function ‘numbers_list_ll’:
./include/linux/compiler.h:197:61: warning: function ‘numbers_list_ll’ might be a candidate for ‘gnu_scanf’ format attribute [-Wsuggest-attribute=format]
197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
| ^
[...]

It seems that it is a regression introduced by the first patch of this patch set. And the fix is:

lib/test_scanf.c +1 -1
index d1664e0d0138..e65b10c3dc11 100644
@@ -27,7 +27,7 @@ static struct rnd_state rnd_state __initdata;
 typedef int (*check_fn)(const char *file, const int line, const void *check_data,
                        const char *string, const char *fmt, int n_args, va_list ap);
 
-static void __scanf(6, 0) __init
+static void __scanf(6, 8) __init
 _test(const char *file, const int line, check_fn fn, const void *check_data, const char *string,
        const char *fmt, int n_args, ...)
 {
Quoted 2 lines

Best Regards,
Petr

Thanks for the review! I'll respin later today unless you let me know otherwise.

Cheers.
Tamir

maintainer Reviewed-by Tested-by on v8 3/4
#14 lore raw
In reply to Tamir Duberstein
Quoted 24 lines · Tamir Duberstein

Convert the scanf() self-test to a KUnit test.

In the interest of keeping the patch reasonably-sized this doesn't refactor the tests into proper parameterized tests - it's all one big test case.

lib/tests/scanf_kunit.c renamed from lib/test_scanf.c +3 -6
@@ -15,48 +13,35 @@
 #include <linux/slab.h>
 #include <linux/string.h>
 
-#include "../tools/testing/selftests/kselftest_module.h"
-
 #define BUF_SIZE 1024
 
-KSTM_MODULE_GLOBALS();
-static char *test_buffer __initdata;
-static char *fmt_buffer __initdata;
-static struct rnd_state rnd_state __initdata;
+static char *test_buffer;
+static char *fmt_buffer;
+static struct rnd_state rnd_state;
 

lib/tests/scanf_kunit.c line 26

Quoted 10 lines
lib/tests/scanf_kunit.c renamed from lib/test_scanf.c +4 -5
-typedef int (*check_fn)(const char *file, const int line, const void *check_data,
-			const char *string, const char *fmt, int n_args, va_list ap);
+typedef void (*check_fn)(struct kunit *test, const char *file, const int line,
+			 const void *check_data, const char *string, const char *fmt, int n_args,
+			 va_list ap);
 
-static void __scanf(6, 0) __init
-_test(const char *file, const int line, check_fn fn, const void *check_data, const char *string,
-	const char *fmt, int n_args, ...)
+static void __scanf(7, 0)

This should be:

static void __scanf(7, 9)

Otherwise, the compilation with W=1 produces the warning reported by the [email protected] kernel test robot, see
https://lore.kernel.org/r/[email protected]

lib/tests/scanf_kunit.c line 31

Quoted 5 lines
lib/tests/scanf_kunit.c renamed from lib/test_scanf.c +2 -0
+_test(struct kunit *test, const char *file, const int line, check_fn fn, const void *check_data,
+	const char *string, const char *fmt, int n_args, ...)
 {
 	va_list ap, ap_copy;
 	int ret;

Otherwise, it looks good to me.

With the above fix:

Best Regards,
Petr

#15 lore raw

PATCH v8 4/4 scanf: break kunit into test cases

In reply to Tamir Duberstein

Use suite_init and move some tests into scanf_test_cases. This gives us nicer output in the event of a failure.

---
 lib/tests/scanf_kunit.c | 95 ++++++++++++++++++++++++++-----------------------
 1 file changed, 51 insertions(+), 44 deletions(-)
lib/tests/scanf_kunit.c +51 -44
index 3bbad9ebe437..fa215a7db366 100644
@@ -4,14 +4,10 @@
  */
 
 #include <kunit/test.h>
-#include <linux/bitops.h>
-#include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/overflow.h>
-#include <linux/printk.h>
 #include <linux/prandom.h>
 #include <linux/slab.h>
-#include <linux/string.h>
+#include <linux/sprintf.h>
 
 #define BUF_SIZE 1024
 
@@ -50,10 +46,9 @@ do {										\
 	for (; n_args > 0; n_args--, expect++) {				\
 		typeof(*expect) got = *va_arg(ap, typeof(expect));		\
 		if (got != *expect) {						\
-			KUNIT_FAIL(test,					\
-				   "%s:%d: vsscanf(\"%s\", \"%s\", ...) expected " arg_fmt " got " arg_fmt, \
-				   file, line, str, fmt, *expect, got);		\
-			return;							\
+			KUNIT_FAIL_AND_ABORT(test,				\
+					     "%s:%d: vsscanf(\"%s\", \"%s\", ...) expected " arg_fmt " got " arg_fmt, \
+					     file, line, str, fmt, *expect, got); \
 		}								\
 	}									\
 } while (0)
@@ -435,8 +430,11 @@ static void numbers_list_hh(struct kunit *test, const char *delim)
 	numbers_list_8(signed char,	   "0x%hhx", delim, "hhi", check_char);
 }
 
-static void numbers_list(struct kunit *test, const char *delim)
+static void numbers_list(struct kunit *test)
 {
+	const char * const *param = test->param_value;
+	const char *delim = *param;
+
 	numbers_list_ll(test, delim);
 	numbers_list_l(test, delim);
 	numbers_list_d(test, delim);
@@ -507,8 +505,11 @@ static void numbers_list_field_width_hh(struct kunit *test, const char *delim)
  * List of numbers separated by delim. Each field width specifier is the
  * maximum possible digits for the given type and base.
  */
-static void numbers_list_field_width_typemax(struct kunit *test, const char *delim)
+static void numbers_list_field_width_typemax(struct kunit *test)
 {
+	const char * const *param = test->param_value;
+	const char *delim = *param;
+
 	numbers_list_field_width_ll(test, delim);
 	numbers_list_field_width_l(test, delim);
 	numbers_list_field_width_d(test, delim);
@@ -570,8 +571,11 @@ static void numbers_list_field_width_val_hh(struct kunit *test, const char *deli
  * List of numbers separated by delim. Each field width specifier is the
  * exact length of the corresponding value digits in the string being scanned.
  */
-static void numbers_list_field_width_val_width(struct kunit *test, const char *delim)
+static void numbers_list_field_width_val_width(struct kunit *test)
 {
+	const char * const *param = test->param_value;
+	const char *delim = *param;
+
 	numbers_list_field_width_val_ll(test, delim);
 	numbers_list_field_width_val_l(test, delim);
 	numbers_list_field_width_val_d(test, delim);
@@ -587,7 +591,12 @@ static void numbers_list_field_width_val_width(struct kunit *test, const char *d
  */
 static void numbers_slice(struct kunit *test)
 {
-	numbers_list_field_width_val_width(test, "");
+	const char *delim = "";
+
+	KUNIT_ASSERT_PTR_EQ(test, test->param_value, NULL);
+	test->param_value = &delim;
+
+	numbers_list_field_width_val_width(test);
 }
 
 #define test_number_prefix(T, str, scan_fmt, expect0, expect1, n_args, fn)	\
@@ -738,62 +747,60 @@ static const char * const number_delimiters[] = {
 	" ", ":", ",", "-", "/",
 };
 
-static void test_numbers(struct kunit *test)
+static void number_delimiter_param_desc(const char * const *param,
+					   char *desc)
 {
-	int i;
+	snprintf(desc, KUNIT_PARAM_DESC_SIZE, "\"%s\"", *param);
+}
 
-	/* String containing only one number. */
-	numbers_simple(test);
+KUNIT_ARRAY_PARAM(number_delimiters, number_delimiters, number_delimiter_param_desc);
 
+static struct kunit_case scanf_test_cases[] = {
+	KUNIT_CASE(numbers_simple),
 	/* String with multiple numbers separated by delimiter. */
-	for (i = 0; i < ARRAY_SIZE(number_delimiters); i++) {
-		numbers_list(test, number_delimiters[i]);
-
-		/* Field width may be longer than actual field digits. */
-		numbers_list_field_width_typemax(test, number_delimiters[i]);
-
-		/* Each field width exactly length of actual field digits. */
-		numbers_list_field_width_val_width(test, number_delimiters[i]);
-	}
-
+	KUNIT_CASE_PARAM(numbers_list, number_delimiters_gen_params),
+	/* Field width may be longer than actual field digits. */
+	KUNIT_CASE_PARAM(numbers_list_field_width_typemax, number_delimiters_gen_params),
+	/* Each field width exactly length of actual field digits. */
+	KUNIT_CASE_PARAM(numbers_list_field_width_val_width, number_delimiters_gen_params),
 	/* Slice continuous sequence of digits using field widths. */
-	numbers_slice(test);
+	KUNIT_CASE(numbers_slice),
+	KUNIT_CASE(numbers_prefix_overflow),
 
-	numbers_prefix_overflow(test);
-}
+	KUNIT_CASE(test_simple_strtoull),
+	KUNIT_CASE(test_simple_strtoll),
+	KUNIT_CASE(test_simple_strtoul),
+	KUNIT_CASE(test_simple_strtol),
+	{}
+};
 
-static void scanf_test(struct kunit *test)
+static int scanf_suite_init(struct kunit_suite *suite)
 {
 	test_buffer = kmalloc(BUF_SIZE, GFP_KERNEL);
 	if (!test_buffer)
-		return;
+		return -ENOMEM;
 
 	fmt_buffer = kmalloc(BUF_SIZE, GFP_KERNEL);
 	if (!fmt_buffer) {
 		kfree(test_buffer);
-		return;
+		return -ENOMEM;
 	}
 
 	prandom_seed_state(&rnd_state, 3141592653589793238ULL);
 
-	test_numbers(test);
-
-	test_simple_strtoull(test);
-	test_simple_strtoll(test);
-	test_simple_strtoul(test);
-	test_simple_strtol(test);
+	return 0;
+}
 
+static void scanf_suite_exit(struct kunit_suite *suite)
+{
 	kfree(fmt_buffer);
 	kfree(test_buffer);
 }
 
-static struct kunit_case scanf_test_cases[] = {
-	KUNIT_CASE(scanf_test),
-	{}
-};
-
 static struct kunit_suite scanf_test_suite = {
 	.name = "scanf",
+	.suite_init = scanf_suite_init,
+	.suite_exit = scanf_suite_exit,
 	.test_cases = scanf_test_cases,
 };
 
Signature · 1 line
2.48.1
maintainer
#16 lore raw

Re: [PATCH v8 4/4] scanf: break kunit into test cases

Quoted 18 lines · Tamir Duberstein

Use suite_init and move some tests into scanf_test_cases. This gives us nicer output in the event of a failure.

---
 lib/tests/scanf_kunit.c | 95 ++++++++++++++++++++++++++-----------------------
 1 file changed, 51 insertions(+), 44 deletions(-)
lib/tests/scanf_kunit.c +0 -1
index 3bbad9ebe437..fa215a7db366 100644
@@ -4,14 +4,10 @@
  */
 
 #include <kunit/test.h>
-#include <linux/bitops.h>

lib/tests/scanf_kunit.c line 12

Quoted 10 lines
lib/tests/scanf_kunit.c +1 -4
-#include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/overflow.h>
-#include <linux/printk.h>
 #include <linux/prandom.h>
 #include <linux/slab.h>
-#include <linux/string.h>
+#include <linux/sprintf.h>
 
 #define BUF_SIZE 1024

It would make more sense to do this clean up in the 3rd patch where some code was replaced by the kunit macros.

Also I am not sure about the choice. It might make sense to remove <include/printk.h> because the pr_*() calls were removed. But what about the others? Did anyone request the clean up, please?

I do not want to open a bike shadding because different people have different opinion.

I would personally prefer to keep the explicit includes when the related API is still used. It helps to optimize nested includes in the header files which helps to speedup build. AFAIK, there are people working in this optimization and they might need to revert this change.

lib/tests/scanf_kunit.c do { \ · line 51

Quoted 11 lines
lib/tests/scanf_kunit.c +3 -4
@@ -50,10 +46,9 @@ do {										\
 	for (; n_args > 0; n_args--, expect++) {				\
 		typeof(*expect) got = *va_arg(ap, typeof(expect));		\
 		if (got != *expect) {						\
-			KUNIT_FAIL(test,					\
-				   "%s:%d: vsscanf(\"%s\", \"%s\", ...) expected " arg_fmt " got " arg_fmt, \
-				   file, line, str, fmt, *expect, got);		\
-			return;							\
+			KUNIT_FAIL_AND_ABORT(test,				\
+					     "%s:%d: vsscanf(\"%s\", \"%s\", ...) expected " arg_fmt " got " arg_fmt, \
+					     file, line, str, fmt, *expect, got); \

I am just curious. Is there any particular reason why KUNIT_FAIL() is replaced with KUNIT_FAIL_AND_ABORT()?

Did the move of some tests into KUNIT_CASE() increased the number of reported errors?

Why is _ABORT() variant used in _check_numbers_template() and not in _test()?

I do not have strong opinion. The change just looks a bit ad-hoc and inconsistent.

lib/tests/scanf_kunit.c do { \ · line 54

Quoted 3 lines
lib/tests/scanf_kunit.c +0 -0
 		}								\
 	}									\
 } while (0)

Otherwise, the change looks good to me.

Best Regards,
Petr

PS: I suggest to wait at least one or two days with the respin. Other
reviewers might want to add their own opinion.

#17 lore raw

Re: [PATCH v8 4/4] scanf: break kunit into test cases

Quoted 38 lines · Petr Mladek
Quoted 18 lines · Tamir Duberstein

Use suite_init and move some tests into scanf_test_cases. This gives us nicer output in the event of a failure.

---
 lib/tests/scanf_kunit.c | 95 ++++++++++++++++++++++++++-----------------------
 1 file changed, 51 insertions(+), 44 deletions(-)
lib/tests/scanf_kunit.c +0 -1
index 3bbad9ebe437..fa215a7db366 100644
@@ -4,14 +4,10 @@
  */
 
 #include <kunit/test.h>
-#include <linux/bitops.h>

lib/tests/scanf_kunit.c line 12

Quoted 10 lines
lib/tests/scanf_kunit.c +1 -4
-#include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/overflow.h>
-#include <linux/printk.h>
 #include <linux/prandom.h>
 #include <linux/slab.h>
-#include <linux/string.h>
+#include <linux/sprintf.h>
 
 #define BUF_SIZE 1024

It would make more sense to do this clean up in the 3rd patch where some code was replaced by the kunit macros.

Also I am not sure about the choice. It might make sense to remove <include/printk.h> because the pr_*() calls were removed. But what about the others? Did anyone request the clean up, please?

Quoted 8 lines

I do not want to open a bike shadding because different people have different opinion.

I would personally prefer to keep the explicit includes when the related API is still used. It helps to optimize nested includes in the header files which helps to speedup build. AFAIK, there are people working in this optimization and they might need to revert this change.

Yeah, I don't feel strongly. I'll just restore all the includes.

Quoted 15 lines

lib/tests/scanf_kunit.c do { \ · line 51

Quoted 11 lines
lib/tests/scanf_kunit.c +3 -4
@@ -50,10 +46,9 @@ do {                                                                               \
      for (; n_args > 0; n_args--, expect++) {                                \
              typeof(*expect) got = *va_arg(ap, typeof(expect));              \
              if (got != *expect) {                                           \
-                     KUNIT_FAIL(test,                                        \
-                                "%s:%d: vsscanf(\"%s\", \"%s\", ...) expected " arg_fmt " got " arg_fmt, \
-                                file, line, str, fmt, *expect, got);         \
-                     return;                                                 \
+                     KUNIT_FAIL_AND_ABORT(test,                              \
+                                          "%s:%d: vsscanf(\"%s\", \"%s\", ...) expected " arg_fmt " got " arg_fmt, \
+                                          file, line, str, fmt, *expect, got); \

I am just curious. Is there any particular reason why KUNIT_FAIL() is replaced with KUNIT_FAIL_AND_ABORT()?

Quoted 12 lines

Did the move of some tests into KUNIT_CASE() increased the number of reported errors?

Why is _ABORT() variant used in _check_numbers_template() and not in _test()?

I do not have strong opinion. The change just looks a bit ad-hoc and inconsistent.

Quoted 3 lines
lib/tests/scanf_kunit.c +0 -0
              }                                                               \
      }                                                                       \
 } while (0)

Honestly I don't remember. The effect is definitely to kill tests earlier in the case of failure, but you're right to point out the inconsistency with _test. The original code had the same behavior in both cases, so I will restore that.

Quoted 8 lines

Otherwise, the change looks good to me.

Best Regards,
Petr

PS: I suggest to wait at least one or two days with the respin. Other
reviewers might want to add their own opinion.

Will do. Thanks for the reviews.
Tamir

#18 lore raw

Re: [PATCH v8 4/4] scanf: break kunit into test cases

Quoted 2 lines · Tamir Duberstein
Quoted 1 line · Petr Mladek

On Fri 2025-02-14 11:20:01, Tamir Duberstein wrote:

...

Quoted 23 lines
Quoted 23 lines

lib/tests/scanf_kunit.c line 12

Quoted 12 lines

#include <kunit/test.h>

lib/tests/scanf_kunit.c +1 -5
-#include <linux/bitops.h>
-#include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/overflow.h>
-#include <linux/printk.h>
 #include <linux/prandom.h>
 #include <linux/slab.h>
-#include <linux/string.h>
+#include <linux/sprintf.h>
 
 #define BUF_SIZE 1024

It would make more sense to do this clean up in the 3rd patch where some code was replaced by the kunit macros.

Also I am not sure about the choice. It might make sense to remove <include/printk.h> because the pr_*() calls were removed. But what about the others? Did anyone request the clean up, please?

I do not want to open a bike shadding because different people have different opinion.

Quoted 7 lines
Quoted 5 lines

I would personally prefer to keep the explicit includes when the related API is still used. It helps to optimize nested includes in the header files which helps to speedup build. AFAIK, there are people working in this optimization and they might need to revert this change.

Yeah, I don't feel strongly. I'll just restore all the includes.

It will be blind approach. Please, try to look at them closely and include what you use (IWYU principle). I don't think anybody uses kernel.h here, for example.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#19 lore raw

Re: [PATCH v8 4/4] scanf: break kunit into test cases

Quoted 38 lines · Andy Shevchenko
Quoted 2 lines · Tamir Duberstein
Quoted 1 line · Petr Mladek

On Fri 2025-02-14 11:20:01, Tamir Duberstein wrote:

...

Quoted 23 lines
Quoted 23 lines

lib/tests/scanf_kunit.c line 12

Quoted 12 lines

#include <kunit/test.h>

lib/tests/scanf_kunit.c +1 -5
-#include <linux/bitops.h>
-#include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/overflow.h>
-#include <linux/printk.h>
 #include <linux/prandom.h>
 #include <linux/slab.h>
-#include <linux/string.h>
+#include <linux/sprintf.h>
 
 #define BUF_SIZE 1024

It would make more sense to do this clean up in the 3rd patch where some code was replaced by the kunit macros.

Also I am not sure about the choice. It might make sense to remove <include/printk.h> because the pr_*() calls were removed. But what about the others? Did anyone request the clean up, please?

I do not want to open a bike shadding because different people have different opinion.

Quoted 7 lines
Quoted 5 lines

I would personally prefer to keep the explicit includes when the related API is still used. It helps to optimize nested includes in the header files which helps to speedup build. AFAIK, there are people working in this optimization and they might need to revert this change.

Yeah, I don't feel strongly. I'll just restore all the includes.

Quoted 7 lines

It will be blind approach. Please, try to look at them closely and include what you use (IWYU principle). I don't think anybody uses kernel.h here, for example.

--
With Best Regards,
Andy Shevchenko

I think I'm getting conflicting instructions here. IWYU is indeed what I did: bitops, kernel, overflow, printk are all unused; string is used only for sprintf, so I made that replacement.

However Petr said "Did anyone request the clean up, please?" which implies to me an aversion to unwanted cleanup. So, which is it please?

#20 lore raw

Re: [PATCH v8 4/4] scanf: break kunit into test cases

Quoted 5 lines · Tamir Duberstein
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Tamir Duberstein
Quoted 1 line · Petr Mladek

On Fri 2025-02-14 11:20:01, Tamir Duberstein wrote:

...

Quoted 35 lines
Quoted 29 lines
Quoted 29 lines
Quoted 28 lines

lib/tests/scanf_kunit.c line 12

Quoted 12 lines

#include <kunit/test.h>

lib/tests/scanf_kunit.c +1 -5
-#include <linux/bitops.h>
-#include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/overflow.h>
-#include <linux/printk.h>
 #include <linux/prandom.h>
 #include <linux/slab.h>
-#include <linux/string.h>
+#include <linux/sprintf.h>
 
 #define BUF_SIZE 1024

It would make more sense to do this clean up in the 3rd patch where some code was replaced by the kunit macros.

Also I am not sure about the choice. It might make sense to remove <include/printk.h> because the pr_*() calls were removed. But what about the others? Did anyone request the clean up, please?

I do not want to open a bike shadding because different people have different opinion.

I would personally prefer to keep the explicit includes when the related API is still used. It helps to optimize nested includes in the header files which helps to speedup build. AFAIK, there are people working in this optimization and they might need to revert this change.

Quoted 5 lines
Quoted 1 line

Yeah, I don't feel strongly. I'll just restore all the includes.

It will be blind approach. Please, try to look at them closely and include what you use (IWYU principle). I don't think anybody uses kernel.h here, for example.

Quoted 6 lines

I think I'm getting conflicting instructions here. IWYU is indeed what I did: bitops, kernel, overflow, printk are all unused; string is used only for sprintf, so I made that replacement.

However Petr said "Did anyone request the clean up, please?" which implies to me an aversion to unwanted cleanup. So, which is it please?

I believe he asks the background of the change. And if it made in a separate patch it would be clearer to begin with (e.g., Suggested-by tag).

But I don't know how you deducted that it's unwanted. With a separate patch we may discuss and see if it's wanted or not. In any case I would like to see such a patch.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#21 lore raw

Re: [PATCH v8 4/4] scanf: break kunit into test cases

Quoted 52 lines · Andy Shevchenko
Quoted 5 lines · Tamir Duberstein
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Tamir Duberstein
Quoted 1 line · Petr Mladek

On Fri 2025-02-14 11:20:01, Tamir Duberstein wrote:

...

Quoted 35 lines
Quoted 29 lines
Quoted 29 lines
Quoted 28 lines

lib/tests/scanf_kunit.c line 12

Quoted 12 lines

#include <kunit/test.h>

lib/tests/scanf_kunit.c +1 -5
-#include <linux/bitops.h>
-#include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/overflow.h>
-#include <linux/printk.h>
 #include <linux/prandom.h>
 #include <linux/slab.h>
-#include <linux/string.h>
+#include <linux/sprintf.h>
 
 #define BUF_SIZE 1024

It would make more sense to do this clean up in the 3rd patch where some code was replaced by the kunit macros.

Also I am not sure about the choice. It might make sense to remove <include/printk.h> because the pr_*() calls were removed. But what about the others? Did anyone request the clean up, please?

I do not want to open a bike shadding because different people have different opinion.

I would personally prefer to keep the explicit includes when the related API is still used. It helps to optimize nested includes in the header files which helps to speedup build. AFAIK, there are people working in this optimization and they might need to revert this change.

Quoted 5 lines
Quoted 1 line

Yeah, I don't feel strongly. I'll just restore all the includes.

It will be blind approach. Please, try to look at them closely and include what you use (IWYU principle). I don't think anybody uses kernel.h here, for example.

Quoted 6 lines

I think I'm getting conflicting instructions here. IWYU is indeed what I did: bitops, kernel, overflow, printk are all unused; string is used only for sprintf, so I made that replacement.

However Petr said "Did anyone request the clean up, please?" which implies to me an aversion to unwanted cleanup. So, which is it please?

Quoted 6 lines

I believe he asks the background of the change. And if it made in a separate patch it would be clearer to begin with (e.g., Suggested-by tag).

But I don't know how you deducted that it's unwanted. With a separate patch we may discuss and see if it's wanted or not. In any case I would like to see such a patch.

Thanks for clarifying. Nobody suggested that cleanup. I will remove printk.h in the 3rd patch as Petr suggested and the remaining headers in a separate final patch for the next respin.

maintainer
#22 lore raw

Re: [PATCH v8 4/4] scanf: break kunit into test cases

In reply to Tamir Duberstein
Quoted 31 lines · Tamir Duberstein
Quoted 29 lines · Andy Shevchenko
Quoted 2 lines · Tamir Duberstein
Quoted 1 line · Petr Mladek

On Fri 2025-02-14 11:20:01, Tamir Duberstein wrote:

...

Quoted 22 lines
Quoted 21 lines

lib/tests/scanf_kunit.c line 12

Quoted 12 lines

#include <kunit/test.h>

lib/tests/scanf_kunit.c +1 -5
-#include <linux/bitops.h>
-#include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/overflow.h>
-#include <linux/printk.h>
 #include <linux/prandom.h>
 #include <linux/slab.h>
-#include <linux/string.h>
+#include <linux/sprintf.h>
 
 #define BUF_SIZE 1024

It would make more sense to do this clean up in the 3rd patch where some code was replaced by the kunit macros.

I would personally prefer to keep the explicit includes when the related API is still used. It helps to optimize nested includes in the header files which helps to speedup build. AFAIK, there are people working in this optimization and they might need to revert this change.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Yeah, I don't feel strongly. I'll just restore all the includes.

It will be blind approach. Please, try to look at them closely and include what you use (IWYU principle). I don't think anybody uses kernel.h here, for example.

I think I'm getting conflicting instructions here. IWYU is indeed what I did: bitops, kernel, overflow, printk are all unused;

I believe that the headers were added for a reason. And this patchset keeps most of the code. This is why the change look suspicious. And I see in the patched lib/tests/scanf_kunit.c:

+ hweight32(), BITS_PER_TYPE(), BITS_PER_LONG which looks like bitops stuff
+ is_signed_type(), type_min(), type_max() from overflow.h

So, I would keep bitops.h and overflow.h.

The printk() calls were obviously removed in the 3rd patch so printk.h include should be removed there.

I do not see any obvious reason for kernel.h, so I would remove it in a separate patch.

Quoted 1 line

string is used only for sprintf, so I made that replacement.

Makes sense. But please do this in a separate patch with this explanation. It might be done together with the kernel.h removal.

Best Regards,
Petr

#23 lore raw

Re: [PATCH v8 4/4] scanf: break kunit into test cases

Quoted 42 lines · Petr Mladek
Quoted 31 lines · Tamir Duberstein
Quoted 29 lines · Andy Shevchenko
Quoted 2 lines · Tamir Duberstein
Quoted 1 line · Petr Mladek

On Fri 2025-02-14 11:20:01, Tamir Duberstein wrote:

...

Quoted 22 lines
Quoted 21 lines

lib/tests/scanf_kunit.c line 12

Quoted 12 lines

#include <kunit/test.h>

lib/tests/scanf_kunit.c +1 -5
-#include <linux/bitops.h>
-#include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/overflow.h>
-#include <linux/printk.h>
 #include <linux/prandom.h>
 #include <linux/slab.h>
-#include <linux/string.h>
+#include <linux/sprintf.h>
 
 #define BUF_SIZE 1024

It would make more sense to do this clean up in the 3rd patch where some code was replaced by the kunit macros.

I would personally prefer to keep the explicit includes when the related API is still used. It helps to optimize nested includes in the header files which helps to speedup build. AFAIK, there are people working in this optimization and they might need to revert this change.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Yeah, I don't feel strongly. I'll just restore all the includes.

It will be blind approach. Please, try to look at them closely and include what you use (IWYU principle). I don't think anybody uses kernel.h here, for example.

I think I'm getting conflicting instructions here. IWYU is indeed what I did: bitops, kernel, overflow, printk are all unused;

Quoted 8 lines

I believe that the headers were added for a reason. And this patchset keeps most of the code. This is why the change look suspicious. And I see in the patched lib/tests/scanf_kunit.c:

+ hweight32(), BITS_PER_TYPE(), BITS_PER_LONG which looks like bitops stuff
+ is_signed_type(), type_min(), type_max() from overflow.h

So, I would keep bitops.h and overflow.h.

Thanks for checking.

Quoted 10 lines

The printk() calls were obviously removed in the 3rd patch so printk.h include should be removed there.

I do not see any obvious reason for kernel.h, so I would remove it in a separate patch.

Quoted 1 line

string is used only for sprintf, so I made that replacement.

Makes sense. But please do this in a separate patch with this explanation. It might be done together with the kernel.h removal.

Will do.

Thanks again.
Tamir

#24 lore raw

Re: [PATCH v8 4/4] scanf: break kunit into test cases

In reply to Petr Mladek
Quoted 1 line · Petr Mladek

On Fri 2025-02-14 11:20:01, Tamir Duberstein wrote:

...

Quoted 11 lines
Quoted 11 lines

#include <kunit/test.h>

lib/tests/scanf_kunit.c +1 -5
-#include <linux/bitops.h>
-#include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/overflow.h>
-#include <linux/printk.h>
 #include <linux/prandom.h>
 #include <linux/slab.h>
-#include <linux/string.h>
+#include <linux/sprintf.h>
Quoted 4 lines
Quoted 1 line

#define BUF_SIZE 1024

It would make more sense to do this clean up in the 3rd patch where some code was replaced by the kunit macros.

+1.

Quoted 3 lines

Also I am not sure about the choice. It might make sense to remove <include/printk.h> because the pr_*() calls were removed. But what about the others? Did anyone request the clean up, please?

Header inclusions is a pain point to me in the kernel. Esp. misuse of kernel.h or other headers to behave like a "proxy". If no-one even asked for a cleanup it's always good to follow IWYU principle as you mentioned below.

Quoted 8 lines

I do not want to open a bike shadding because different people have different opinion.

I would personally prefer to keep the explicit includes when the related API is still used. It helps to optimize nested includes in the header files which helps to speedup build. AFAIK, there are people working in this optimization and they might need to revert this change.

+1.

Signature · 2 lines
With Best Regards,
Andy Shevchenko