diff --git a/pcre2-10.35-RC1-Avoid-using-1-as-a-suffix-in-pcre2test-as-it-can-pro.patch b/pcre2-10.35-RC1-Avoid-using-1-as-a-suffix-in-pcre2test-as-it-can-pro.patch new file mode 100644 index 0000000..11903ea --- /dev/null +++ b/pcre2-10.35-RC1-Avoid-using-1-as-a-suffix-in-pcre2test-as-it-can-pro.patch @@ -0,0 +1,95 @@ +From b941dacb37e5b7e18cf1e99ec10f5117a135a05e Mon Sep 17 00:00:00 2001 +From: ph10 +Date: Thu, 23 Apr 2020 15:41:23 +0000 +Subject: [PATCH] Avoid using [-1] as a suffix in pcre2test as it can provoke a + compiler warning. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@1245 6239d852-aaf2-0410-a92c-79f79f948069 +Signed-off-by: Petr Písař +--- + src/pcre2test.c | 39 ++++++++++++++++++++++++++++----------- + +diff --git a/src/pcre2test.c b/src/pcre2test.c +index ed75e06..c4b6059 100644 +--- a/src/pcre2test.c ++++ b/src/pcre2test.c +@@ -2980,15 +2980,21 @@ return (int)(pp - p); + *************************************************/ + + /* Must handle UTF-8 strings in utf8 mode. Yields number of characters printed. +-For printing *MARK strings, a negative length is given. If handed a NULL file, +-just counts chars without printing (because pchar() does that). */ ++For printing *MARK strings, a negative length is given, indicating that the ++length is in the previous code unit. We can't use strlen() because the string ++may contain binary zeros. Avoid using [-1] as a suffix because this can provoke ++a compiler warning. If handed a NULL file, this function just counts chars ++without printing (because pchar() does that). */ + + static int pchars8(PCRE2_SPTR8 p, int length, BOOL utf, FILE *f) + { + uint32_t c = 0; + int yield = 0; +- +-if (length < 0) length = p[-1]; ++if (length < 0) ++ { ++ PCRE2_SPTR8 pp = p - 1; ++ length = *pp; ++ } + while (length-- > 0) + { + if (utf) +@@ -3017,13 +3023,19 @@ return yield; + *************************************************/ + + /* Must handle UTF-16 strings in utf mode. Yields number of characters printed. +-For printing *MARK strings, a negative length is given. If handed a NULL file, +-just counts chars without printing. */ ++For printing *MARK strings, a negative length is given, indicating that the ++length is in the previous code unit. Avoid using [-1] as a suffix because this ++can provoke a compiler warning. If handed a NULL file, just counts chars ++without printing. */ + + static int pchars16(PCRE2_SPTR16 p, int length, BOOL utf, FILE *f) + { + int yield = 0; +-if (length < 0) length = p[-1]; ++if (length < 0) ++ { ++ PCRE2_SPTR16 pp = p - 1; ++ length = *pp; ++ } + while (length-- > 0) + { + uint32_t c = *p++ & 0xffff; +@@ -3051,15 +3063,20 @@ return yield; + *************************************************/ + + /* Must handle UTF-32 strings in utf mode. Yields number of characters printed. +-For printing *MARK strings, a negative length is given. If handed a NULL file, +-just counts chars without printing. */ ++For printing *MARK strings, a negative length is given, indicating that the ++length is in the previous code unit. Avoid using [-1] as a suffix because this ++can provoke a compiler warning. If handed a NULL file, just counts chars ++without printing. */ + + static int pchars32(PCRE2_SPTR32 p, int length, BOOL utf, FILE *f) + { + int yield = 0; + (void)(utf); /* Avoid compiler warning */ +- +-if (length < 0) length = p[-1]; ++if (length < 0) ++ { ++ PCRE2_SPTR32 pp = p - 1; ++ length = *pp; ++ } + while (length-- > 0) + { + uint32_t c = *p++; +-- +2.21.3 + diff --git a/pcre2-10.35-RC1-Second-attempt-at-getting-rid-of-gcc-10-warning.patch b/pcre2-10.35-RC1-Second-attempt-at-getting-rid-of-gcc-10-warning.patch new file mode 100644 index 0000000..952b16d --- /dev/null +++ b/pcre2-10.35-RC1-Second-attempt-at-getting-rid-of-gcc-10-warning.patch @@ -0,0 +1,173 @@ +From 4d848be74dd036959c94a717dfa7dab23035b6df Mon Sep 17 00:00:00 2001 +From: ph10 +Date: Fri, 24 Apr 2020 15:36:53 +0000 +Subject: [PATCH] Second attempt at getting rid of gcc 10 warning. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@1247 6239d852-aaf2-0410-a92c-79f79f948069 +Signed-off-by: Petr Písař +--- + src/pcre2test.c | 38 +++++++++++--------------------------- + testdata/testinput2 | 9 +++++++++ + testdata/testoutput2 | 18 ++++++++++++++++++ + 3 files changed, 38 insertions(+), 27 deletions(-) + +diff --git a/src/pcre2test.c b/src/pcre2test.c +index c4b6059..3f4fef4 100644 +--- a/src/pcre2test.c ++++ b/src/pcre2test.c +@@ -2981,20 +2981,14 @@ return (int)(pp - p); + + /* Must handle UTF-8 strings in utf8 mode. Yields number of characters printed. + For printing *MARK strings, a negative length is given, indicating that the +-length is in the previous code unit. We can't use strlen() because the string +-may contain binary zeros. Avoid using [-1] as a suffix because this can provoke +-a compiler warning. If handed a NULL file, this function just counts chars +-without printing (because pchar() does that). */ ++length is in the first code unit. If handed a NULL file, this function just ++counts chars without printing (because pchar() does that). */ + + static int pchars8(PCRE2_SPTR8 p, int length, BOOL utf, FILE *f) + { + uint32_t c = 0; + int yield = 0; +-if (length < 0) +- { +- PCRE2_SPTR8 pp = p - 1; +- length = *pp; +- } ++if (length < 0) length = *p++; + while (length-- > 0) + { + if (utf) +@@ -3024,18 +3018,13 @@ return yield; + + /* Must handle UTF-16 strings in utf mode. Yields number of characters printed. + For printing *MARK strings, a negative length is given, indicating that the +-length is in the previous code unit. Avoid using [-1] as a suffix because this +-can provoke a compiler warning. If handed a NULL file, just counts chars ++length is in the first code unit. If handed a NULL file, just counts chars + without printing. */ + + static int pchars16(PCRE2_SPTR16 p, int length, BOOL utf, FILE *f) + { + int yield = 0; +-if (length < 0) +- { +- PCRE2_SPTR16 pp = p - 1; +- length = *pp; +- } ++if (length < 0) length = *p++; + while (length-- > 0) + { + uint32_t c = *p++ & 0xffff; +@@ -3064,19 +3053,14 @@ return yield; + + /* Must handle UTF-32 strings in utf mode. Yields number of characters printed. + For printing *MARK strings, a negative length is given, indicating that the +-length is in the previous code unit. Avoid using [-1] as a suffix because this +-can provoke a compiler warning. If handed a NULL file, just counts chars ++length is in the first code unit. If handed a NULL file, just counts chars + without printing. */ + + static int pchars32(PCRE2_SPTR32 p, int length, BOOL utf, FILE *f) + { + int yield = 0; + (void)(utf); /* Avoid compiler warning */ +-if (length < 0) +- { +- PCRE2_SPTR32 pp = p - 1; +- length = *pp; +- } ++if (length < 0) length = *p++; + while (length-- > 0) + { + uint32_t c = *p++; +@@ -6327,7 +6311,7 @@ if (cb->mark != last_callout_mark) + else + { + fprintf(outfile, "Latest Mark: "); +- PCHARSV(cb->mark, 0, -1, utf, outfile); ++ PCHARSV(cb->mark, -1, -1, utf, outfile); + putc('\n', outfile); + } + last_callout_mark = cb->mark; +@@ -7848,7 +7832,7 @@ for (gmatched = 0;; gmatched++) + TESTFLD(match_data, mark, !=, NULL)) + { + fprintf(outfile, "MK: "); +- PCHARSV(CASTFLD(void *, match_data, mark), 0, -1, utf, outfile); ++ PCHARSV(CASTFLD(void *, match_data, mark), -1, -1, utf, outfile); + fprintf(outfile, "\n"); + } + +@@ -7880,7 +7864,7 @@ for (gmatched = 0;; gmatched++) + TESTFLD(match_data, mark, !=, NULL)) + { + fprintf(outfile, ", mark="); +- PCHARS(rubriclength, CASTFLD(void *, match_data, mark), 0, -1, utf, ++ PCHARS(rubriclength, CASTFLD(void *, match_data, mark), -1, -1, utf, + outfile); + rubriclength += 7; + } +@@ -7979,7 +7963,7 @@ for (gmatched = 0;; gmatched++) + TESTFLD(match_data, mark, !=, NULL)) + { + fprintf(outfile, ", mark = "); +- PCHARSV(CASTFLD(void *, match_data, mark), 0, -1, utf, outfile); ++ PCHARSV(CASTFLD(void *, match_data, mark), -1, -1, utf, outfile); + } + if ((pat_patctl.control & CTL_JITVERIFY) != 0 && jit_was_used) + fprintf(outfile, " (JIT)"); +diff --git a/testdata/testinput2 b/testdata/testinput2 +index 3de72f1..c816c5f 100644 +--- a/testdata/testinput2 ++++ b/testdata/testinput2 +@@ -5855,4 +5855,13 @@ a)"xI + /^\w+/tables=3 + École + ++/"(*MARK:>" 00 "<).."/hex,mark,no_start_optimize ++ AB ++ A\=ph ++\= Expect no match ++ A ++ ++/"(*MARK:>" 00 "<).(?C1)."/hex,mark,no_start_optimize ++ AB ++ + # End of testinput2 +diff --git a/testdata/testoutput2 b/testdata/testoutput2 +index 886a24d..c90efef 100644 +--- a/testdata/testoutput2 ++++ b/testdata/testoutput2 +@@ -17603,6 +17603,24 @@ No match + École + 0: \xc3 + ++/"(*MARK:>" 00 "<).."/hex,mark,no_start_optimize ++ AB ++ 0: AB ++MK: >\x00< ++ A\=ph ++Partial match, mark=>\x00<: A ++\= Expect no match ++ A ++No match, mark = >\x00< ++ ++/"(*MARK:>" 00 "<).(?C1)."/hex,mark,no_start_optimize ++ AB ++--->AB ++ 1 ^^ . ++Latest Mark: >\x00< ++ 0: AB ++MK: >\x00< ++ + # End of testinput2 + Error -70: PCRE2_ERROR_BADDATA (unknown error number) + Error -62: bad serialized data +-- +2.21.3 + diff --git a/pcre2.spec b/pcre2.spec index edf5627..d967f12 100644 --- a/pcre2.spec +++ b/pcre2.spec @@ -9,7 +9,7 @@ %global rcversion RC1 Name: pcre2 Version: 10.35 -Release: %{?rcversion:0.}1%{?rcversion:.%rcversion}%{?dist} +Release: %{?rcversion:0.}2%{?rcversion:.%rcversion}%{?dist} %global myversion %{version}%{?rcversion:-%rcversion} Summary: Perl-compatible regular expression library # the library: BSD with exceptions @@ -51,6 +51,10 @@ Source1: https://ftp.pcre.org/pub/pcre/%{?rcversion:Testing/}%{name}-%{myvers Source2: https://ftp.pcre.org/pub/pcre/Public-Key # Do no set RPATH if libdir is not /usr/lib Patch0: pcre2-10.10-Fix-multilib.patch +# 1/2 Fix a compiler warning about -1 index, in upstream after pcre2-10.35-RC1 +Patch1: pcre2-10.35-RC1-Avoid-using-1-as-a-suffix-in-pcre2test-as-it-can-pro.patch +# 2/2 Fix a compiler warning about -1 index, in upstream after pcre2-10.35-RC1 +Patch2: pcre2-10.35-RC1-Second-attempt-at-getting-rid-of-gcc-10-warning.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: coreutils @@ -142,6 +146,8 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test. %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' %setup -q -n %{name}-%{myversion} %patch0 -p1 +%patch1 -p1 +%patch2 -p1 # Because of multilib patch libtoolize --copy --force autoreconf -vif @@ -259,6 +265,9 @@ make %{?_smp_mflags} check VERBOSE=yes %{_mandir}/man1/pcre2test.* %changelog +* Mon Apr 27 2020 Petr Pisar - 10.35-0.2.RC1 +- Fix a compiler warning about -1 index + * Thu Apr 16 2020 Petr Pisar - 10.35-0.1.RC1 - 10.35-RC1 bump