summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2008-08-24 16:53:47 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2008-08-24 16:53:47 +0000
commit851d65f42191b664ba09ce6df72d13db63aab921 (patch)
tree59609d43e98040da106e564e32382b336a660369
parent41687a877dcdcc63d1d53b0648600018ceecb2eb (diff)
downloadpcre-851d65f42191b664ba09ce6df72d13db63aab921.tar.gz
Patch to reduce warnings from certain compilers.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@369 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--ChangeLog2
-rw-r--r--pcre_compile.c16
-rw-r--r--pcre_internal.h5
-rw-r--r--pcre_ord2utf8.c6
-rw-r--r--pcre_ucp_searchfuncs.c2
-rw-r--r--pcre_valid_utf8.c3
6 files changed, 25 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index a491cb1..4a2676c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -70,6 +70,8 @@ Version 7.8 25-Aug-08
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
diff --git a/pcre_compile.c b/pcre_compile.c
index 7142a2d..ebf6b2c 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -455,7 +455,7 @@ static const char *
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 @@ for (; *ptr != 0; ptr++)
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 @@ for (; *ptr != 0; ptr++)
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 @@ for (; *ptr != 0; ptr++)
if (xmode && *ptr == '#')
{
- while (*(++ptr) != 0 && *ptr != '\n');
+ while (*(++ptr) != 0 && *ptr != '\n') {};
if (*ptr == 0) return -1;
continue;
}
@@ -1450,6 +1450,8 @@ for (;;)
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 @@ for (;;)
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 @@ if (next >= 0) switch(op_code)
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 @@ we set the flag only if there is a literal "\r" or "\n" in the class. */
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 */
diff --git a/pcre_internal.h b/pcre_internal.h
index 97c62d9..2d2217b 100644
--- a/pcre_internal.h
+++ b/pcre_internal.h
@@ -559,12 +559,15 @@ variable-length repeat, or a anything other than literal characters. */
#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. */
diff --git a/pcre_ord2utf8.c b/pcre_ord2utf8.c
index 0fdc512..202031f 100644
--- a/pcre_ord2utf8.c
+++ b/pcre_ord2utf8.c
@@ -78,8 +78,10 @@ for (j = i; j > 0; j--)
*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 */
diff --git a/pcre_ucp_searchfuncs.c b/pcre_ucp_searchfuncs.c
index b76770e..a11b35c 100644
--- a/pcre_ucp_searchfuncs.c
+++ b/pcre_ucp_searchfuncs.c
@@ -161,7 +161,7 @@ makes things a lot slower. */
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;
diff --git a/pcre_valid_utf8.c b/pcre_valid_utf8.c
index bc3bc8f..5f2df08 100644
--- a/pcre_valid_utf8.c
+++ b/pcre_valid_utf8.c
@@ -154,6 +154,9 @@ for (p = string; length-- > 0; p++)
if ((*(++p) & 0xc0) != 0x80) return p - string;
}
}
+#else
+(void)(string); /* Keep picky compilers happy */
+(void)(length);
#endif
return -1;