Re: [pcre-dev] PCRE2 10.23-RC1 is available

Top Page
Delete this message
Author: Petr Pisar
Date:  
To: pcre-dev
Subject: Re: [pcre-dev] PCRE2 10.23-RC1 is available
On Mon, Jan 16, 2017 at 06:15:02PM +0000, ph10@??? wrote:
> I have just put a release candidate for 10.23 here:
>

I tested it successfully on:

aarch64
armv7hl
i686
ppc32
ppc64le
ppc64be
s390
s390x
x86_64

with JIT enabled where available.

The only issue is these compiler warnings in pcre2test.c on 32-bit platforms:

src/pcre2test.c: In function 'process_pattern':
src/pcre2test.c:4665:28: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'int' [-Wformat=]
           fprintf(outfile, "** Missing closing quote in hex pattern: "
                            ^
src/pcre2test.c:4680:72: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'int' [-Wformat=]
         fprintf(outfile, "** Unexpected non-hex-digit '%c' at offset %lu "
                                                                        ^
src/pcre2test.c:4692:72: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'int' [-Wformat=]
         fprintf(outfile, "** Unexpected non-hex-digit '%c' at offset %lu "
                                                                        ^


This is caused by printing pointer difference using "%lu" instead of "%td" as
designed for ptrdiff_t types. However, "t" size modifier does not exist before
ISO C99.

Attached patch fixes it in means of "%td", but I believe you will choose more
conservative way like "%lld" and cast to long long int.

-- Petr
From 415b992217a1e393fac5f4a6893013135510cda0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@???>
Date: Tue, 17 Jan 2017 13:48:37 +0100
Subject: [PATCH] Fix warning on printing pointer difference
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Petr Písař <ppisar@???>
---
src/pcre2test.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/pcre2test.c b/src/pcre2test.c
index 5ea245d..e1c8d25 100644
--- a/src/pcre2test.c
+++ b/src/pcre2test.c
@@ -4663,7 +4663,7 @@ if ((pat_patctl.control & CTL_HEXPAT) != 0)
         if (d == 0)
           {
           fprintf(outfile, "** Missing closing quote in hex pattern: "
-            "opening quote is at offset %lu.\n", pq - buffer - 2);
+            "opening quote is at offset %td.\n", pq - buffer - 2);
           return PR_SKIP;
           }
         if (d == c) break;
@@ -4677,7 +4677,7 @@ if ((pat_patctl.control & CTL_HEXPAT) != 0)
       {
       if (!isxdigit(c))
         {
-        fprintf(outfile, "** Unexpected non-hex-digit '%c' at offset %lu "
+        fprintf(outfile, "** Unexpected non-hex-digit '%c' at offset %td "
           "in hex pattern: quote missing?\n", c, pp - buffer - 2);
         return PR_SKIP;
         }
@@ -4689,7 +4689,7 @@ if ((pat_patctl.control & CTL_HEXPAT) != 0)
       d = *pp;
       if (!isxdigit(d))
         {
-        fprintf(outfile, "** Unexpected non-hex-digit '%c' at offset %lu "
+        fprintf(outfile, "** Unexpected non-hex-digit '%c' at offset %td "
           "in hex pattern: quote missing?\n", d, pp - buffer - 1);
         return PR_SKIP;
         }
-- 
2.7.4