[Pcre-svn] [1472] code/trunk: Fix C++ compiler warnings and …

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [1472] code/trunk: Fix C++ compiler warnings and silly quantifier size check.
Revision: 1472
          http://vcs.pcre.org/viewvc?view=rev&revision=1472
Author:   ph10
Date:     2014-04-21 17:11:50 +0100 (Mon, 21 Apr 2014)


Log Message:
-----------
Fix C++ compiler warnings and silly quantifier size check.

Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/configure.ac
    code/trunk/pcre_compile.c
    code/trunk/pcre_scanner_unittest.cc
    code/trunk/pcre_stringpiece_unittest.cc
    code/trunk/pcrecpp.cc
    code/trunk/testdata/testoutput2


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2014-04-04 13:44:51 UTC (rev 1471)
+++ code/trunk/ChangeLog    2014-04-21 16:11:50 UTC (rev 1472)
@@ -1,6 +1,18 @@
 ChangeLog for PCRE
 ------------------


+Version 8.36 xx-xxx-2014
+------------------------
+
+1.  Got rid of some compiler warnings in the C++ modules that were shown up by
+    -Wmissing-field-initializers and -Wunused-parameter.
+    
+2.  The tests for quantifiers being too big (greater than 65535) were being
+    applied after reading the number, and stupidly assuming that integer 
+    overflow would give a negative number. The tests are now applied as the 
+    numbers are read.
+
+
 Version 8.35 04-April-2014
 --------------------------



Modified: code/trunk/configure.ac
===================================================================
--- code/trunk/configure.ac    2014-04-04 13:44:51 UTC (rev 1471)
+++ code/trunk/configure.ac    2014-04-21 16:11:50 UTC (rev 1472)
@@ -9,9 +9,9 @@
 dnl be defined as -RC2, for example. For real releases, it should be empty.


m4_define(pcre_major, [8])
-m4_define(pcre_minor, [35])
-m4_define(pcre_prerelease, [])
-m4_define(pcre_date, [2014-04-04])
+m4_define(pcre_minor, [36])
+m4_define(pcre_prerelease, [-RC1])
+m4_define(pcre_date, [2014-04-21])

# NOTE: The CMakeLists.txt file searches for the above variables in the first
# 50 lines of this file. Please update that if the variables above are moved.

Modified: code/trunk/pcre_compile.c
===================================================================
--- code/trunk/pcre_compile.c    2014-04-04 13:44:51 UTC (rev 1471)
+++ code/trunk/pcre_compile.c    2014-04-21 16:11:50 UTC (rev 1472)
@@ -1583,30 +1583,30 @@
 int min = 0;
 int max = -1;


-/* Read the minimum value and do a paranoid check: a negative value indicates
-an integer overflow. */
-
-while (IS_DIGIT(*p)) min = min * 10 + (int)(*p++ - CHAR_0);
-if (min < 0 || min > 65535)
+while (IS_DIGIT(*p)) 
   {
-  *errorcodeptr = ERR5;
-  return p;
-  }
+  min = min * 10 + (int)(*p++ - CHAR_0);
+  if (min > 65535)
+    {
+    *errorcodeptr = ERR5;
+    return p;
+    }
+  }   


-/* Read the maximum value if there is one, and again do a paranoid on its size.
-Also, max must not be less than min. */
-
 if (*p == CHAR_RIGHT_CURLY_BRACKET) max = min; else
   {
   if (*(++p) != CHAR_RIGHT_CURLY_BRACKET)
     {
     max = 0;
-    while(IS_DIGIT(*p)) max = max * 10 + (int)(*p++ - CHAR_0);
-    if (max < 0 || max > 65535)
+    while(IS_DIGIT(*p)) 
       {
-      *errorcodeptr = ERR5;
-      return p;
-      }
+      max = max * 10 + (int)(*p++ - CHAR_0);
+      if (max > 65535)
+        {
+        *errorcodeptr = ERR5;
+        return p;
+        }
+      }   
     if (max < min)
       {
       *errorcodeptr = ERR4;
@@ -1615,9 +1615,6 @@
     }
   }


-/* Fill in the required variables, and pass back the pointer to the terminating
-'}'. */
-
*minp = min;
*maxp = max;
return p;

Modified: code/trunk/pcre_scanner_unittest.cc
===================================================================
--- code/trunk/pcre_scanner_unittest.cc    2014-04-04 13:44:51 UTC (rev 1471)
+++ code/trunk/pcre_scanner_unittest.cc    2014-04-21 16:11:50 UTC (rev 1472)
@@ -149,6 +149,8 @@
 //       small stack size


int main(int argc, char** argv) {
+ (void)argc;
+ (void)argv;
TestScanner();
TestBigComment();


Modified: code/trunk/pcre_stringpiece_unittest.cc
===================================================================
--- code/trunk/pcre_stringpiece_unittest.cc    2014-04-04 13:44:51 UTC (rev 1471)
+++ code/trunk/pcre_stringpiece_unittest.cc    2014-04-21 16:11:50 UTC (rev 1472)
@@ -142,6 +142,8 @@
 }


int main(int argc, char** argv) {
+ (void)argc;
+ (void)argv;
CheckComparisonOperators();
CheckSTLComparator();


Modified: code/trunk/pcrecpp.cc
===================================================================
--- code/trunk/pcrecpp.cc    2014-04-04 13:44:51 UTC (rev 1471)
+++ code/trunk/pcrecpp.cc    2014-04-21 16:11:50 UTC (rev 1472)
@@ -511,7 +511,7 @@
     return 0;
   }


-  pcre_extra extra = { 0, 0, 0, 0, 0, 0 };
+  pcre_extra extra = { 0, 0, 0, 0, 0, 0, 0, 0 };
   if (options_.match_limit() > 0) {
     extra.flags |= PCRE_EXTRA_MATCH_LIMIT;
     extra.match_limit = options_.match_limit();
@@ -660,6 +660,8 @@
 /***** Parsers for various types *****/


bool Arg::parse_null(const char* str, int n, void* dest) {
+ (void)str;
+ (void)n;
// We fail if somebody asked us to store into a non-NULL void* pointer
return (dest == NULL);
}

Modified: code/trunk/testdata/testoutput2
===================================================================
--- code/trunk/testdata/testoutput2    2014-04-04 13:44:51 UTC (rev 1471)
+++ code/trunk/testdata/testoutput2    2014-04-21 16:11:50 UTC (rev 1472)
@@ -5821,13 +5821,13 @@
 No match


/a{11111111111111111111}/I
-Failed: number too big in {} quantifier at offset 22
+Failed: number too big in {} quantifier at offset 8

/(){64294967295}/I
-Failed: number too big in {} quantifier at offset 14
+Failed: number too big in {} quantifier at offset 9

/(){2,4294967295}/I
-Failed: number too big in {} quantifier at offset 15
+Failed: number too big in {} quantifier at offset 11

"(?i:a)(?i:b)(?i:c)(?i:d)(?i:e)(?i:f)(?i:g)(?i:h)(?i:i)(?i:j)(k)(?i:l)A\1B"I
Capturing subpattern count = 1