Hi Arkadiusz, On Fri, Feb 07, 2025 at 10:16:28PM +0100, Arkadiusz Drabczyk wrote: > GCC and Clang print warnings: > > $ clang main.c -Wall > main.c:30:23: warning: format specifies type 'size_t' (aka 'unsigned long') but the argument has type 'unsigned int' [-Wformat] > 30 | printf("#%zu:\n", i); > | ~~~ ^ > | %u > 1 warning generated. > > $ gcc main.c -Wall > main.c: In function ‘main’: > main.c:30:16: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 2 has type ‘unsigned int’ [-Wformat=] > 30 | printf("#%zu:\n", i); > | ~~^ ~ > | | | > | | unsigned int > | long unsigned int > | %u > > Signed-off-by: Arkadiusz Drabczyk <arkadiusz@xxxxxxxxxxxx> Thanks! I've applied the patch: <https://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?h=contrib&id=6f71d1e4958bd327b4cea006d27a854e66b85380> I also added a Fixes tag: Fixes: b42296e4feaf (2022-09-15; "Various pages: EXAMPLES: Use unsigned types for loop iterators") Have a lovely night! Alex > --- > man/man3/regex.3 | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/man/man3/regex.3 b/man/man3/regex.3 > index 3069489cb..a094c3b20 100644 > --- a/man/man3/regex.3 > +++ b/man/man3/regex.3 > @@ -392,7 +392,7 @@ int main(void) > \& > off = pmatch[0].rm_so + (s \- str); > len = pmatch[0].rm_eo \- pmatch[0].rm_so; > - printf("#%zu:\[rs]n", i); > + printf("#%u:\[rs]n", i); > printf("offset = %jd; length = %jd\[rs]n", (intmax_t) off, > (intmax_t) len); > printf("substring = \[rs]"%.*s\[rs]"\[rs]n", len, s + pmatch[0].rm_so); > -- > 2.45.2 > > -- <https://www.alejandro-colomar.es/>
Attachment:
signature.asc
Description: PGP signature