[Pcre-svn] [369] code/trunk: Patch to reduce warnings from c…

Página Inicial
Delete this message
Autor: Subversion repository
Data:  
Para: pcre-svn
Assunto: [Pcre-svn] [369] code/trunk: Patch to reduce warnings from certain compilers.
Revision: 369
          http://vcs.pcre.org/viewvc?view=rev&revision=369
Author:   ph10
Date:     2008-08-24 17:53:47 +0100 (Sun, 24 Aug 2008)


Log Message:
-----------
Patch to reduce warnings from certain compilers.

Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/pcre_compile.c
    code/trunk/pcre_internal.h
    code/trunk/pcre_ord2utf8.c
    code/trunk/pcre_ucp_searchfuncs.c
    code/trunk/pcre_valid_utf8.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2008-08-24 16:25:20 UTC (rev 368)
+++ code/trunk/ChangeLog    2008-08-24 16:53:47 UTC (rev 369)
@@ -70,6 +70,8 @@


 17. Make it more clear in the documentation that values returned from 
     pcre_exec() in ovector are byte offsets, not character counts.
+    
+18. Tidied a few places to stop certain compilers from issuing warnings. 



Version 7.7 07-May-08

Modified: code/trunk/pcre_compile.c
===================================================================
--- code/trunk/pcre_compile.c    2008-08-24 16:25:20 UTC (rev 368)
+++ code/trunk/pcre_compile.c    2008-08-24 16:53:47 UTC (rev 369)
@@ -455,7 +455,7 @@
 find_error_text(int n)
 {
 const char *s = error_texts;
-for (; n > 0; n--) while (*s++ != 0);
+for (; n > 0; n--) while (*s++ != 0) {};
 return s;
 }


@@ -1002,7 +1002,7 @@
     if (*(++ptr) == 0) return -1;
     if (*ptr == 'Q') for (;;)
       {
-      while (*(++ptr) != 0 && *ptr != '\\');
+      while (*(++ptr) != 0 && *ptr != '\\') {};
       if (*ptr == 0) return -1;
       if (*(++ptr) == 'E') break;
       }
@@ -1045,7 +1045,7 @@
         if (*(++ptr) == 0) return -1;
         if (*ptr == 'Q') for (;;)
           {
-          while (*(++ptr) != 0 && *ptr != '\\');
+          while (*(++ptr) != 0 && *ptr != '\\') {};
           if (*ptr == 0) return -1;
           if (*(++ptr) == 'E') break;
           }
@@ -1059,7 +1059,7 @@


   if (xmode && *ptr == '#')
     {
-    while (*(++ptr) != 0 && *ptr != '\n');
+    while (*(++ptr) != 0 && *ptr != '\n') {};
     if (*ptr == 0) return -1;
     continue;
     }
@@ -1450,6 +1450,8 @@
       if (code[-1] >= 0xc0) code += _pcre_utf8_table4[code[-1] & 0x3f];
       break;
       }
+#else
+    (void)(utf8);  /* Keep compiler happy by referencing function argument */
 #endif
     }
   }
@@ -1543,6 +1545,8 @@
       if (code[-1] >= 0xc0) code += _pcre_utf8_table4[code[-1] & 0x3f];
       break;
       }
+#else
+    (void)(utf8);  /* Keep compiler happy by referencing function argument */
 #endif
     }
   }
@@ -2134,6 +2138,8 @@
   case OP_CHAR:
 #ifdef SUPPORT_UTF8
   if (utf8 && item > 127) { GETCHAR(item, utf8_char); }
+#else
+  (void)(utf8_char);  /* Keep compiler happy by referencing function argument */
 #endif
   return item != next;


@@ -4216,7 +4222,7 @@
       const char *vn = verbnames;
       const uschar *name = ++ptr;
       previous = NULL;
-      while ((cd->ctypes[*++ptr] & ctype_letter) != 0);
+      while ((cd->ctypes[*++ptr] & ctype_letter) != 0) {};
       if (*ptr == ':')
         {
         *errorcodeptr = ERR59;   /* Not supported */


Modified: code/trunk/pcre_internal.h
===================================================================
--- code/trunk/pcre_internal.h    2008-08-24 16:25:20 UTC (rev 368)
+++ code/trunk/pcre_internal.h    2008-08-24 16:53:47 UTC (rev 369)
@@ -559,12 +559,15 @@
 #define REQ_CASELESS 0x0100    /* indicates caselessness */
 #define REQ_VARY     0x0200    /* reqbyte followed non-literal item */


-/* Miscellaneous definitions */
+/* Miscellaneous definitions. The #ifndef is to pacify compiler warnings in
+environments where these macros are defined elsewhere. */

+#ifndef FALSE
typedef int BOOL;

 #define FALSE   0
 #define TRUE    1
+#endif


/* Escape items that are just an encoding of a particular data value. */


Modified: code/trunk/pcre_ord2utf8.c
===================================================================
--- code/trunk/pcre_ord2utf8.c    2008-08-24 16:25:20 UTC (rev 368)
+++ code/trunk/pcre_ord2utf8.c    2008-08-24 16:53:47 UTC (rev 369)
@@ -78,8 +78,10 @@
 *buffer = _pcre_utf8_table2[i] | cvalue;
 return i + 1;
 #else
-return 0;   /* Keep compiler happy; this function won't ever be */
-#endif      /* called when SUPPORT_UTF8 is not defined. */
+(void)(cvalue);  /* Keep compiler happy; this function won't ever be */
+(void)(buffer);  /* called when SUPPORT_UTF8 is not defined. */        
+return 0;       
+#endif          
 }


/* End of pcre_ord2utf8.c */

Modified: code/trunk/pcre_ucp_searchfuncs.c
===================================================================
--- code/trunk/pcre_ucp_searchfuncs.c    2008-08-24 16:25:20 UTC (rev 368)
+++ code/trunk/pcre_ucp_searchfuncs.c    2008-08-24 16:53:47 UTC (rev 369)
@@ -161,7 +161,7 @@


for (;;)
{
- if (top <= bot) return -1;
+ if (top <= bot) return (unsigned int)(-1);
mid = (bot + top) >> 1;
if (c == (ucp_table[mid].f0 & f0_charmask)) break;
if (c < (ucp_table[mid].f0 & f0_charmask)) top = mid;

Modified: code/trunk/pcre_valid_utf8.c
===================================================================
--- code/trunk/pcre_valid_utf8.c    2008-08-24 16:25:20 UTC (rev 368)
+++ code/trunk/pcre_valid_utf8.c    2008-08-24 16:53:47 UTC (rev 369)
@@ -154,6 +154,9 @@
     if ((*(++p) & 0xc0) != 0x80) return p - string;
     }
   }
+#else
+(void)(string);  /* Keep picky compilers happy */
+(void)(length);  
 #endif


return -1;