[Pcre-svn] [1041] code/trunk: Implement --disable-percent-zt…

Page principale
Supprimer ce message
Auteur: Subversion repository
Date:  
À: pcre-svn
Sujet: [Pcre-svn] [1041] code/trunk: Implement --disable-percent-zt to avoid %zu and %td even if the environment
Revision: 1041
          http://www.exim.org/viewvc/pcre2?view=rev&revision=1041
Author:   ph10
Date:     2018-11-15 18:09:02 +0000 (Thu, 15 Nov 2018)
Log Message:
-----------
Implement --disable-percent-zt to avoid %zu and %td even if the environment 
claims to be C99 or greater.


Modified Paths:
--------------
    code/trunk/CMakeLists.txt
    code/trunk/ChangeLog
    code/trunk/README
    code/trunk/config-cmake.h.in
    code/trunk/configure.ac
    code/trunk/doc/html/README.txt
    code/trunk/doc/html/pcre2build.html
    code/trunk/doc/pcre2.txt
    code/trunk/doc/pcre2build.3
    code/trunk/src/config.h.generic
    code/trunk/src/config.h.in
    code/trunk/src/pcre2test.c


Modified: code/trunk/CMakeLists.txt
===================================================================
--- code/trunk/CMakeLists.txt    2018-11-14 16:59:19 UTC (rev 1040)
+++ code/trunk/CMakeLists.txt    2018-11-15 18:09:02 UTC (rev 1041)
@@ -136,6 +136,8 @@


OPTION(PCRE2_DEBUG "Include debugging code" OFF)

+OPTION(DISABLE_PERCENT_ZT "Disable the use of %zu and %td (rarely needed)" OFF)
+
 SET(PCRE2_EBCDIC OFF CACHE BOOL
     "Use EBCDIC coding instead of ASCII. (This is rarely used outside of mainframe systems.)")



Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2018-11-14 16:59:19 UTC (rev 1040)
+++ code/trunk/ChangeLog    2018-11-15 18:09:02 UTC (rev 1041)
@@ -68,7 +68,12 @@
 inttypes.h, which are known to exist. A note in the autotools documentation
 says (November 2018) that there are none known that are the other way round.


+17. Added --disable-percent-zt to "configure" (and equivalent to CMake) to
+forcibly disable the use of %zu and %td in formatting strings because there is
+at least one version of VMS that claims to be C99 but does not support these
+modifiers.

+
Version 10.32 10-September-2018
-------------------------------


Modified: code/trunk/README
===================================================================
--- code/trunk/README    2018-11-14 16:59:19 UTC (rev 1040)
+++ code/trunk/README    2018-11-15 18:09:02 UTC (rev 1041)
@@ -374,6 +374,15 @@
   If you get error messages about missing functions tgetstr, tgetent, tputs,
   tgetflag, or tgoto, this is the problem, and linking with the ncurses library
   should fix it.
+  
+. The C99 standard defines formatting modifiers z and t for size_t and 
+  ptrdiff_t values, respectively. By default, PCRE2 uses these modifiers in 
+  environments other than Microsoft Visual Studio when __STDC_VERSION__ is 
+  defined and has a value greater than or equal to 199901L (indicating C99).
+  However, there is at least one environment that claims to be C99 but does not
+  support these modifiers. If --disable-percent-zt is specified, no use is made
+  of the z or t modifiers. Instead or %td or %zu, %lu is used, with a cast for 
+  size_t values.


. There is a special option called --enable-fuzz-support for use by people who
want to run fuzzing tests on PCRE2. At present this applies only to the 8-bit
@@ -888,4 +897,4 @@
Philip Hazel
Email local part: ph10
Email domain: cam.ac.uk
-Last updated: 19 September 2018
+Last updated: 15 November 2018

Modified: code/trunk/config-cmake.h.in
===================================================================
--- code/trunk/config-cmake.h.in    2018-11-14 16:59:19 UTC (rev 1040)
+++ code/trunk/config-cmake.h.in    2018-11-15 18:09:02 UTC (rev 1041)
@@ -18,6 +18,7 @@
 #cmakedefine SUPPORT_PCRE2_16 1
 #cmakedefine SUPPORT_PCRE2_32 1
 #cmakedefine PCRE2_DEBUG 1
+#cmakedefine DISABLE_PERCENT_ZT 1


#cmakedefine SUPPORT_LIBBZ2 1
#cmakedefine SUPPORT_LIBEDIT 1

Modified: code/trunk/configure.ac
===================================================================
--- code/trunk/configure.ac    2018-11-14 16:59:19 UTC (rev 1040)
+++ code/trunk/configure.ac    2018-11-15 18:09:02 UTC (rev 1041)
@@ -131,7 +131,7 @@
               , enable_pcre2_32=unset)
 AC_SUBST(enable_pcre2_32)


-# Handle --dnable-debug (disabled by default)
+# Handle --enable-debug (disabled by default)
 AC_ARG_ENABLE(debug,
               AS_HELP_STRING([--enable-debug],
                              [enable debugging code]),
@@ -343,6 +343,12 @@
 #                              [don't use stack recursion when matching]),
 #               , enable_stack_for_recursion=yes)


+# Handle --disable-percent_zt (set as "auto" by default)
+AC_ARG_ENABLE(percent-zt,
+              AS_HELP_STRING([--disable-percent-zt],
+                             [disable the use of z and t formatting modifiers]),
+              , enable_percent_zt=auto)
+
 # Set the default value for pcre2-8
 if test "x$enable_pcre2_8" = "xunset"
 then
@@ -587,6 +593,14 @@
     Define to any value to include debugging code.])
 fi


+if test "$enable_percent_zt" = "no"; then
+  AC_DEFINE([DISABLE_PERCENT_ZT], [], [
+    Define to any value to disable the use of the z and t modifiers in
+    formatting settings such as %zu or %td (this is rarely needed).])
+else
+  enable_percent_zt=auto     
+fi
+
 # Unless running under Windows, JIT support requires pthreads.


 if test "$enable_jit" = "yes"; then
@@ -1033,6 +1047,7 @@
     Valgrind support ................... : ${enable_valgrind}
     Code coverage ...................... : ${enable_coverage}
     Fuzzer support ..................... : ${enable_fuzz_support}
+    Use %zu and %td .................... : ${enable_percent_zt}


EOF


Modified: code/trunk/doc/html/README.txt
===================================================================
--- code/trunk/doc/html/README.txt    2018-11-14 16:59:19 UTC (rev 1040)
+++ code/trunk/doc/html/README.txt    2018-11-15 18:09:02 UTC (rev 1041)
@@ -374,6 +374,15 @@
   If you get error messages about missing functions tgetstr, tgetent, tputs,
   tgetflag, or tgoto, this is the problem, and linking with the ncurses library
   should fix it.
+  
+. The C99 standard defines formatting modifiers z and t for size_t and 
+  ptrdiff_t values, respectively. By default, PCRE2 uses these modifiers in 
+  environments other than Microsoft Visual Studio when __STDC_VERSION__ is 
+  defined and has a value greater than or equal to 199901L (indicating C99).
+  However, there is at least one environment that claims to be C99 but does not
+  support these modifiers. If --disable-percent-zt is specified, no use is made
+  of the z or t modifiers. Instead or %td or %zu, %lu is used, with a cast for 
+  size_t values.


. There is a special option called --enable-fuzz-support for use by people who
want to run fuzzing tests on PCRE2. At present this applies only to the 8-bit
@@ -888,4 +897,4 @@
Philip Hazel
Email local part: ph10
Email domain: cam.ac.uk
-Last updated: 19 September 2018
+Last updated: 15 November 2018

Modified: code/trunk/doc/html/pcre2build.html
===================================================================
--- code/trunk/doc/html/pcre2build.html    2018-11-14 16:59:19 UTC (rev 1040)
+++ code/trunk/doc/html/pcre2build.html    2018-11-15 18:09:02 UTC (rev 1041)
@@ -33,11 +33,12 @@
 <li><a name="TOC18" href="#SEC18">INCLUDING DEBUGGING CODE</a>
 <li><a name="TOC19" href="#SEC19">DEBUGGING WITH VALGRIND SUPPORT</a>
 <li><a name="TOC20" href="#SEC20">CODE COVERAGE REPORTING</a>
-<li><a name="TOC21" href="#SEC21">SUPPORT FOR FUZZERS</a>
-<li><a name="TOC22" href="#SEC22">OBSOLETE OPTION</a>
-<li><a name="TOC23" href="#SEC23">SEE ALSO</a>
-<li><a name="TOC24" href="#SEC24">AUTHOR</a>
-<li><a name="TOC25" href="#SEC25">REVISION</a>
+<li><a name="TOC21" href="#SEC21">DISABLING THE Z AND T FORMATTING MODIFIERS</a>
+<li><a name="TOC22" href="#SEC22">SUPPORT FOR FUZZERS</a>
+<li><a name="TOC23" href="#SEC23">OBSOLETE OPTION</a>
+<li><a name="TOC24" href="#SEC24">SEE ALSO</a>
+<li><a name="TOC25" href="#SEC25">AUTHOR</a>
+<li><a name="TOC26" href="#SEC26">REVISION</a>
 </ul>
 <br><a name="SEC1" href="#TOC1">BUILDING PCRE2</a><br>
 <P>
@@ -523,8 +524,22 @@
 information about code coverage, see the <b>gcov</b> and <b>lcov</b>
 documentation.
 </P>
-<br><a name="SEC21" href="#TOC1">SUPPORT FOR FUZZERS</a><br>
+<br><a name="SEC21" href="#TOC1">DISABLING THE Z AND T FORMATTING MODIFIERS</a><br>
 <P>
+The C99 standard defines formatting modifiers z and t for size_t and 
+ptrdiff_t values, respectively. By default, PCRE2 uses these modifiers in 
+environments other than Microsoft Visual Studio when __STDC_VERSION__ is 
+defined and has a value greater than or equal to 199901L (indicating C99).
+However, there is at least one environment that claims to be C99 but does not
+support these modifiers. If 
+<pre>
+  --disable-percent-zt 
+</pre>
+is specified, no use is made of the z or t modifiers. Instead or %td or %zu,
+%lu is used, with a cast for size_t values.
+</P>
+<br><a name="SEC22" href="#TOC1">SUPPORT FOR FUZZERS</a><br>
+<P>
 There is a special option for use by people who want to run fuzzing tests on
 PCRE2:
 <pre>
@@ -547,7 +562,7 @@
 string. Otherwise, it is assumed to be a file name, and the contents of the
 file are the test string.
 </P>
-<br><a name="SEC22" href="#TOC1">OBSOLETE OPTION</a><br>
+<br><a name="SEC23" href="#TOC1">OBSOLETE OPTION</a><br>
 <P>
 In versions of PCRE2 prior to 10.30, there were two ways of handling
 backtracking in the <b>pcre2_match()</b> function. The default was to use the
@@ -559,11 +574,11 @@
 changed (the stack is no longer used) and this option now does nothing except
 give a warning.
 </P>
-<br><a name="SEC23" href="#TOC1">SEE ALSO</a><br>
+<br><a name="SEC24" href="#TOC1">SEE ALSO</a><br>
 <P>
 <b>pcre2api</b>(3), <b>pcre2-config</b>(3).
 </P>
-<br><a name="SEC24" href="#TOC1">AUTHOR</a><br>
+<br><a name="SEC25" href="#TOC1">AUTHOR</a><br>
 <P>
 Philip Hazel
 <br>
@@ -572,9 +587,9 @@
 Cambridge, England.
 <br>
 </P>
-<br><a name="SEC25" href="#TOC1">REVISION</a><br>
+<br><a name="SEC26" href="#TOC1">REVISION</a><br>
 <P>
-Last updated: 26 April 2018
+Last updated: 15 November 2018
 <br>
 Copyright &copy; 1997-2018 University of Cambridge.
 <br>


Modified: code/trunk/doc/pcre2.txt
===================================================================
--- code/trunk/doc/pcre2.txt    2018-11-14 16:59:19 UTC (rev 1040)
+++ code/trunk/doc/pcre2.txt    2018-11-15 18:09:02 UTC (rev 1041)
@@ -4158,6 +4158,21 @@
        mentation.



+DISABLING THE Z AND T FORMATTING MODIFIERS
+
+       The  C99  standard  defines formatting modifiers z and t for size_t and
+       ptrdiff_t values, respectively. By default, PCRE2 uses these  modifiers
+       in  environments  other  than  Microsoft Visual Studio when __STDC_VER-
+       SION__ is defined and has a value greater  than  or  equal  to  199901L
+       (indicating  C99).   However,  there  is  at least one environment that
+       claims to be C99 but does not support these modifiers. If
+
+         --disable-percent-zt
+
+       is specified, no use is made of the z or t modifiers. Instead or %td or
+       %zu, %lu is used, with a cast for size_t values.
+
+
 SUPPORT FOR FUZZERS


        There  is  a  special  option for use by people who want to run fuzzing
@@ -4210,7 +4225,7 @@


REVISION

-       Last updated: 26 April 2018
+       Last updated: 15 November 2018
        Copyright (c) 1997-2018 University of Cambridge.
 ------------------------------------------------------------------------------



Modified: code/trunk/doc/pcre2build.3
===================================================================
--- code/trunk/doc/pcre2build.3    2018-11-14 16:59:19 UTC (rev 1040)
+++ code/trunk/doc/pcre2build.3    2018-11-15 18:09:02 UTC (rev 1041)
@@ -1,4 +1,4 @@
-.TH PCRE2BUILD 3 "26 April 2018" "PCRE2 10.32"
+.TH PCRE2BUILD 3 "15 November 2018" "PCRE2 10.33"
 .SH NAME
 PCRE2 - Perl-compatible regular expressions (revised API)
 .
@@ -533,6 +533,22 @@
 documentation.
 .
 .
+.SH "DISABLING THE Z AND T FORMATTING MODIFIERS"
+.rs
+.sp
+The C99 standard defines formatting modifiers z and t for size_t and 
+ptrdiff_t values, respectively. By default, PCRE2 uses these modifiers in 
+environments other than Microsoft Visual Studio when __STDC_VERSION__ is 
+defined and has a value greater than or equal to 199901L (indicating C99).
+However, there is at least one environment that claims to be C99 but does not
+support these modifiers. If 
+.sp
+  --disable-percent-zt 
+.sp
+is specified, no use is made of the z or t modifiers. Instead or %td or %zu,
+%lu is used, with a cast for size_t values.
+.
+.
 .SH "SUPPORT FOR FUZZERS"
 .rs
 .sp
@@ -591,6 +607,6 @@
 .rs
 .sp
 .nf
-Last updated: 26 April 2018
+Last updated: 15 November 2018
 Copyright (c) 1997-2018 University of Cambridge.
 .fi


Modified: code/trunk/src/config.h.generic
===================================================================
--- code/trunk/src/config.h.generic    2018-11-14 16:59:19 UTC (rev 1040)
+++ code/trunk/src/config.h.generic    2018-11-15 18:09:02 UTC (rev 1041)
@@ -35,6 +35,10 @@
    */
 /* #undef BSR_ANYCRLF */


+/* Define to any value to disable the use of the z and t modifiers in
+   formatting settings such as %zu or %td (this is rarely needed). */
+/* #undef DISABLE_PERCENT_ZT */
+
 /* If you are compiling for a system that uses EBCDIC instead of ASCII
    character codes, define this macro to any value. When EBCDIC is set, PCRE2
    assumes that all input strings are in EBCDIC. If you do not define this


Modified: code/trunk/src/config.h.in
===================================================================
--- code/trunk/src/config.h.in    2018-11-14 16:59:19 UTC (rev 1040)
+++ code/trunk/src/config.h.in    2018-11-15 18:09:02 UTC (rev 1041)
@@ -35,6 +35,10 @@
    */
 #undef BSR_ANYCRLF


+/* Define to any value to disable the use of the z and t modifiers in
+   formatting settings such as %zu or %td (this is rarely needed). */
+#undef DISABLE_PERCENT_ZT
+
 /* If you are compiling for a system that uses EBCDIC instead of ASCII
    character codes, define this macro to any value. When EBCDIC is set, PCRE2
    assumes that all input strings are in EBCDIC. If you do not define this


Modified: code/trunk/src/pcre2test.c
===================================================================
--- code/trunk/src/pcre2test.c    2018-11-14 16:59:19 UTC (rev 1040)
+++ code/trunk/src/pcre2test.c    2018-11-15 18:09:02 UTC (rev 1041)
@@ -169,9 +169,10 @@
 /* void vms_setsymbol( char *, char *, int ); Original code from [1]. */
 #endif


-/* VC and older compilers don't support %td or %zu. */
+/* VC and older compilers don't support %td or %zu, and even some that claim to
+be C99 don't support it (hence DISABLE_PERCENT_ZT). */

-#if defined(_MSC_VER) || !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L
+#if defined(_MSC_VER) || !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L || defined(DISABLE_PERCENT_ZT)
#define PTR_FORM "lu"
#define SIZ_FORM "lu"
#define SIZ_CAST (unsigned long int)