Re: [pcre-dev] PCRE2 10.30-RC1 test release

Góra strony
Delete this message
Autor: Petr Pisar
Data:  
Dla: pcre-dev
Temat: Re: [pcre-dev] PCRE2 10.30-RC1 test release
On Thu, Jul 20, 2017 at 11:48:40AM +0200, Petr Pisar via Pcre-dev wrote:
> I spotted this compiler warning on i686 and armv7hl:
>
> src/pcre2test.c: In function 'process_pattern':
> src/pcre2test.c:5469:63: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=]
>      fprintf(outfile, "** Pattern conversion error at offset %lu: ",
>                                                              ~~^

>

This can be fixed with this change:

--- a/src/pcre2test.c
+++ b/src/pcre2test.c
@@ -5466,7 +5466,7 @@ if (pat_patctl.convert_type != CONVERT_UNSET)

   if (rc != 0)
     {
-    fprintf(outfile, "** Pattern conversion error at offset %lu: ",
+    fprintf(outfile, "** Pattern conversion error at offset %zu: ",
       converted_length);
     convert_return = print_error_message(rc, "", "\n")? PR_SKIP:PR_ABEND;
     }


I've already forgot on your attitude to ISO C90 formatters. I can see one %zd
usage in src/pcre2test, but also various %llu for size_t. I don't know which
one you prefer.

-- Petr