[Pcre-svn] [1346] code/trunk: Get rid of some "statement not…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [1346] code/trunk: Get rid of some "statement not reached" and a " possibly uninitialized" compiler
Revision: 1346
          http://vcs.pcre.org/viewvc?view=rev&revision=1346
Author:   ph10
Date:     2013-07-02 19:37:36 +0100 (Tue, 02 Jul 2013)


Log Message:
-----------
Get rid of some "statement not reached" and a "possibly uninitialized" compiler
warnings.

Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/pcre_exec.c
    code/trunk/pcretest.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2013-07-02 17:52:28 UTC (rev 1345)
+++ code/trunk/ChangeLog    2013-07-02 18:37:36 UTC (rev 1346)
@@ -17,6 +17,12 @@


 3.  Make a small performance improvement in strlen16() and strlen32() in
     pcretest.
+    
+4.  Change 36 for 8.33 left some unreachable statements in pcre_exec.c,
+    detected by the Solaris compiler (gcc doesn't seem to be able to diagnose
+    these cases). There was also one in pcretest.c.
+    
+5.  Cleaned up a "may be uninitialized" compiler warning in pcre_exec.c. 



Version 8.33 28-May-2013

Modified: code/trunk/pcre_exec.c
===================================================================
--- code/trunk/pcre_exec.c    2013-07-02 17:52:28 UTC (rev 1345)
+++ code/trunk/pcre_exec.c    2013-07-02 18:37:36 UTC (rev 1346)
@@ -3590,7 +3590,6 @@
           if (fc != cc && foc != cc) break;
           eptr++;
           }
-
         if (possessive) continue;       /* No backtracking */
         for (;;)
           {
@@ -3599,9 +3598,8 @@
           eptr--;
           if (rrc != MATCH_NOMATCH) RRETURN(rrc);
           }
-        RRETURN(MATCH_NOMATCH);
+        /* Control never gets here */
         }
-      /* Control never gets here */
       }


     /* Caseful comparisons (includes all multi-byte characters) */
@@ -3657,7 +3655,7 @@
           eptr--;
           if (rrc != MATCH_NOMATCH) RRETURN(rrc);
           }
-        RRETURN(MATCH_NOMATCH);
+        /* Control never gets here */
         }
       }
     /* Control never gets here */
@@ -3942,10 +3940,8 @@
             eptr--;
             }
           }
-
-        RRETURN(MATCH_NOMATCH);
+        /* Control never gets here */
         }
-      /* Control never gets here */
       }


     /* Caseful comparisons */
@@ -4079,8 +4075,7 @@
             eptr--;
             }
           }
-
-        RRETURN(MATCH_NOMATCH);
+        /* Control never gets here */
         }
       }
     /* Control never gets here */
@@ -6210,12 +6205,9 @@
               eptr[-1] == CHAR_CR) eptr--;
           }
         }
-
-      /* Get here if we can't make it match with any permitted repetitions */
-
-      RRETURN(MATCH_NOMATCH);
+        
+      /* Control never gets here */
       }
-    /* Control never gets here */


     /* There's been some horrible disaster. Arrival here can only mean there is
     something seriously wrong in the code above or the OP_xxx definitions. */
@@ -6410,7 +6402,7 @@
 PCRE_PUCHAR start_match = (PCRE_PUCHAR)subject + start_offset;
 PCRE_PUCHAR end_subject;
 PCRE_PUCHAR start_partial = NULL;
-PCRE_PUCHAR match_partial;
+PCRE_PUCHAR match_partial = NULL;
 PCRE_PUCHAR req_char_ptr = start_match - 1;


const pcre_study_data *study;
@@ -7178,7 +7170,7 @@

/* Handle partial matches - disable any mark data */

-if (start_partial != NULL)
+if (match_partial != NULL)
{
DPRINTF((">>>> returning PCRE_ERROR_PARTIAL\n"));
md->mark = NULL;

Modified: code/trunk/pcretest.c
===================================================================
--- code/trunk/pcretest.c    2013-07-02 17:52:28 UTC (rev 1345)
+++ code/trunk/pcretest.c    2013-07-02 18:37:36 UTC (rev 1346)
@@ -1916,7 +1916,7 @@
     }
   }


-return NULL; /* Control never gets here */
+/* Control never gets here */
}