• Thomas Weißschuh's avatar
    selftests/nolibc: fix printf format mismatch in expect_str_buf_eq() · 92098b1c
    Thomas Weißschuh authored
    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: 1063649c ("selftests/nolibc: Add tests for strlcat() and strlcpy()")
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarThomas Weißschuh <linux@weissschuh.net>
    92098b1c
nolibc-test.c 45.5 KB