linux-next: build failure after merge of the kspp tree
Hi all,
After merging the kspp tree, today's linux-next build (x86_64 allmodconfig) failed like this:
In file included from lib/string_kunit.c:8:lib/string_kunit.c: In function 'test_strspn':lib/string_kunit.c:176:25: error: format '%d' expects argument of type 'int', but argument 7 has type 'size_t' {aka 'long unsigned int'} [-Werror=format=]
176 | "i:%d", i);
| ^~~~~~ ~
| |
| size_t {aka long unsigned int}
include/kunit/test.h:597:37: note: in definition of macro '_KUNIT_FAILED'
597 | fmt, \
| ^~~
include/kunit/test.h:722:9: note: in expansion of macro 'KUNIT_BASE_BINARY_ASSERTION'
722 | KUNIT_BASE_BINARY_ASSERTION(test, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
include/kunit/test.h:1253:9: note: in expansion of macro 'KUNIT_BINARY_INT_ASSERTION'
1253 | KUNIT_BINARY_INT_ASSERTION(test, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
lib/string_kunit.c:175:17: note: in expansion of macro 'KUNIT_ASSERT_EQ_MSG'
175 | KUNIT_ASSERT_EQ_MSG(test, s->a, strspn(s->str, s->accept),
| ^~~~~~~~~~~~~~~~~~~
lib/string_kunit.c:176:29: note: format string is defined here
176 | "i:%d", i);
| ~^
| |
| int
| %ld
lib/string_kunit.c:178:25: error: format '%d' expects argument of type 'int', but argument 7 has type 'size_t' {aka 'long unsigned int'} [-Werror=format=]
178 | "i:%d", i);
| ^~~~~~ ~
| |
| size_t {aka long unsigned int}
include/kunit/test.h:597:37: note: in definition of macro '_KUNIT_FAILED'
597 | fmt, \
| ^~~
include/kunit/test.h:722:9: note: in expansion of macro 'KUNIT_BASE_BINARY_ASSERTION'
722 | KUNIT_BASE_BINARY_ASSERTION(test, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
include/kunit/test.h:1253:9: note: in expansion of macro 'KUNIT_BINARY_INT_ASSERTION'
1253 | KUNIT_BINARY_INT_ASSERTION(test, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
lib/string_kunit.c:177:17: note: in expansion of macro 'KUNIT_ASSERT_EQ_MSG'
177 | KUNIT_ASSERT_EQ_MSG(test, s->r, strcspn(s->str, s->reject),
| ^~~~~~~~~~~~~~~~~~~
lib/string_kunit.c:178:29: note: format string is defined here
178 | "i:%d", i);
| ~^
| |
| int
| %ldcc1: all warnings being treated as errors
Caused by commit
578914ebade8 ("string: Convert selftest to KUnit")
I have used the kspp tree from next-20240304 for today.
Signature · 2 lines
Cheers, Stephen Rothwell
Quoted 5 lines · Stephen Rothwell
Hi all,
After merging the kspp tree, today's linux-next build (
x86_64allmodconfig) failed like this:
Quoted 7 lines
In file included from
lib/string_kunit.c:8:lib/string_kunit.c: In function 'test_strspn':lib/string_kunit.c:176:25: error: format '%d' expects argument of type 'int', but argument 7 has type 'size_t' {aka 'long unsigned int'} [-Werror=format=]176 | "i:%d", i); | ^~~~~~ ~ | | | size_t {aka long unsigned int}
I was really scratching my head on this one. I didn't see the warning on my end because this is actually a result of the merge, namely KUnit becoming correctly stricter about format strings:
806cb2270237 ("kunit: Annotate _MSG assertion variants with gnu printf specifiers")
I will fix the format string! :)
Signature · 1 line
Kees Cook