[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <df7a2fde-9f6e-45bc-b691-3964b406db7c@sdfg.com.ar>
Date: Fri, 26 Apr 2024 17:43:19 +0100
From: Rodrigo Campos <rodrigo@...g.com.ar>
To: Thomas Weißschuh <linux@...ssschuh.net>,
Shuah Khan <skhan@...uxfoundation.org>, "Paul E. McKenney"
<paulmck@...nel.org>
Cc: Willy Tarreau <w@....eu>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 4/4] selftests/nolibc: Add tests for strlcat() and
strlcpy()
On 4/23/24 10:18 AM, Thomas Weißschuh wrote:
>> +#define EXPECT_STRBUFEQ(cond, expr, buf, val, cmp) \
>> + do { if (!(cond)) result(llen, SKIPPED); else ret += expect_str_buf_eq(expr, buf, val, llen, cmp); } while (0)
>> +
>> +static __attribute__((unused))
>> +int expect_str_buf_eq(size_t expr, const char *buf, size_t val, int llen, const char *cmp)
>> +{
>> + llen += printf(" = %lu <%s> ", expr, buf);
>
> This introduces a 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
>
>
> It is easy enough to fix through a cast to "unsigned long".
Thanks for fixing it! Of course, don't hesitate to let me know if there
is something I can help with :)
Best,
Rodrigo
Powered by blists - more mailing lists