Skip to content

Commit 92098b1

Browse files
committed
selftests/nolibc: fix printf format mismatch in expect_str_buf_eq()
Fix the following compiler warning on 32bit: i386-linux-gcc -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 -W -Wall -Wextra -fno-stack-protector -m32 -mstack-protector-guard=global -fstack-protector-all -o nolibc-test \ -nostdlib -nostdinc -static -Isysroot/i386/include nolibc-test.c nolibc-test-linkage.c -lgcc nolibc-test.c: In function 'expect_str_buf_eq': nolibc-test.c:610:30: error: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'size_t' {aka 'unsigned int'} [-Werror=format=] 610 | llen += printf(" = %lu <%s> ", expr, buf); | ~~^ ~~~~ | | | | | size_t {aka unsigned int} | long unsigned int | %u Fixes: 1063649 ("selftests/nolibc: Add tests for strlcat() and strlcpy()") Cc: [email protected] Signed-off-by: Thomas Weißschuh <[email protected]>
1 parent f266106 commit 92098b1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/testing/selftests/nolibc/nolibc-test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ int expect_strne(const char *expr, int llen, const char *cmp)
607607
static __attribute__((unused))
608608
int expect_str_buf_eq(size_t expr, const char *buf, size_t val, int llen, const char *cmp)
609609
{
610-
llen += printf(" = %lu <%s> ", expr, buf);
610+
llen += printf(" = %lu <%s> ", (unsigned long)expr, buf);
611611
if (strcmp(buf, cmp) != 0) {
612612
result(llen, FAIL);
613613
return 1;

0 commit comments

Comments
 (0)