Revision: 1494
http://vcs.pcre.org/viewvc?view=rev&revision=1494
Author: ph10
Date: 2014-07-10 17:38:05 +0100 (Thu, 10 Jul 2014)
Log Message:
-----------
Avoid compiler warning for cast function argument.
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/pcre_compile.c
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2014-07-09 04:41:15 UTC (rev 1493)
+++ code/trunk/ChangeLog 2014-07-10 16:38:05 UTC (rev 1494)
@@ -81,7 +81,11 @@
17. Fixed a number of memory leaks in pcregrep.
+18. Avoid a compiler warning (from some compilers) for a function call with
+ a cast that removes "const" from an lvalue by using an intermediate
+ variable (to which the compiler does not object).
+
Version 8.35 04-April-2014
--------------------------
Modified: code/trunk/pcre_compile.c
===================================================================
--- code/trunk/pcre_compile.c 2014-07-09 04:41:15 UTC (rev 1493)
+++ code/trunk/pcre_compile.c 2014-07-10 16:38:05 UTC (rev 1494)
@@ -9277,11 +9277,18 @@
if (errorcode == 0 && re->top_backref > re->top_bracket) errorcode = ERR15;
-/* Unless disabled, check whether single character iterators can be
-auto-possessified. The function overwrites the appropriate opcode values. */
+/* Unless disabled, check whether any single character iterators can be
+auto-possessified. The function overwrites the appropriate opcode values, so
+the type of the pointer must be cast. NOTE: the intermediate variable "temp" is
+used in this code because at least one compiler gives a warning about loss of
+"const" attribute if the cast (pcre_uchar *)codestart is used directly in the
+function call. */
if ((options & PCRE_NO_AUTO_POSSESS) == 0)
- auto_possessify((pcre_uchar *)codestart, utf, cd);
+ {
+ pcre_uchar *temp = (pcre_uchar *)codestart;
+ auto_possessify(temp, utf, cd);
+ }
/* If there were any lookbehind assertions that contained OP_RECURSE
(recursions or subroutine calls), a flag is set for them to be checked here,