diff --git a/CMakeLists.txt b/CMakeLists.txt index e653e9c..f086483 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,6 +136,8 @@ OPTION(PCRE2_BUILD_PCRE2_32 "Build 32 bit PCRE2 library" OFF) 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.)") diff --git a/ChangeLog b/ChangeLog index 843e108..b5aa03b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -68,6 +68,11 @@ inttypes.h. This supports environments that do not have stdint.h but do have 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 ------------------------------- diff --git a/README b/README index 7acb9ff..9c46ac4 100644 --- a/README +++ b/README @@ -374,6 +374,15 @@ library. They are also documented in the pcre2build man page. 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 @@ The distribution should contain the files listed below. Philip Hazel Email local part: ph10 Email domain: cam.ac.uk -Last updated: 19 September 2018 +Last updated: 15 November 2018 diff --git a/config-cmake.h.in b/config-cmake.h.in index 9b4f15d..f72b18c 100644 --- a/config-cmake.h.in +++ b/config-cmake.h.in @@ -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 diff --git a/configure.ac b/configure.ac index f912661..054aca5 100644 --- a/configure.ac +++ b/configure.ac @@ -131,7 +131,7 @@ AC_ARG_ENABLE(pcre2-32, , 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 @@ AC_ARG_ENABLE(stack-for-recursion,, # [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 @@ if test "$enable_debug" = "yes"; then 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 @@ $PACKAGE-$VERSION configuration summary: Valgrind support ................... : ${enable_valgrind} Code coverage ...................... : ${enable_coverage} Fuzzer support ..................... : ${enable_fuzz_support} + Use %zu and %td .................... : ${enable_percent_zt} EOF diff --git a/doc/html/README.txt b/doc/html/README.txt index 7acb9ff..9c46ac4 100644 --- a/doc/html/README.txt +++ b/doc/html/README.txt @@ -374,6 +374,15 @@ library. They are also documented in the pcre2build man page. 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 @@ The distribution should contain the files listed below. Philip Hazel Email local part: ph10 Email domain: cam.ac.uk -Last updated: 19 September 2018 +Last updated: 15 November 2018 diff --git a/doc/html/pcre2build.html b/doc/html/pcre2build.html index e31b604..a18e269 100644 --- a/doc/html/pcre2build.html +++ b/doc/html/pcre2build.html @@ -33,11 +33,12 @@ please consult the man page, in case the conversion went wrong.
  • INCLUDING DEBUGGING CODE
  • DEBUGGING WITH VALGRIND SUPPORT
  • CODE COVERAGE REPORTING -
  • SUPPORT FOR FUZZERS -
  • OBSOLETE OPTION -
  • SEE ALSO -
  • AUTHOR -
  • REVISION +
  • DISABLING THE Z AND T FORMATTING MODIFIERS +
  • SUPPORT FOR FUZZERS +
  • OBSOLETE OPTION +
  • SEE ALSO +
  • AUTHOR +
  • REVISION
    BUILDING PCRE2

    @@ -523,7 +524,21 @@ This cleans all coverage data including the generated coverage report. For more information about code coverage, see the gcov and lcov documentation.

    -
    SUPPORT FOR FUZZERS
    +
    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_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. +

    +
    SUPPORT FOR FUZZERS

    There is a special option for use by people who want to run fuzzing tests on PCRE2: @@ -547,7 +562,7 @@ arguments: if an argument starts with "=" the rest of it is a literal input string. Otherwise, it is assumed to be a file name, and the contents of the file are the test string.

    -
    OBSOLETE OPTION
    +
    OBSOLETE OPTION

    In versions of PCRE2 prior to 10.30, there were two ways of handling backtracking in the pcre2_match() function. The default was to use the @@ -559,11 +574,11 @@ was set, memory on the heap was used. From release 10.30 onwards this has changed (the stack is no longer used) and this option now does nothing except give a warning.

    -
    SEE ALSO
    +
    SEE ALSO

    pcre2api(3), pcre2-config(3).

    -
    AUTHOR
    +
    AUTHOR

    Philip Hazel
    @@ -572,9 +587,9 @@ University Computing Service Cambridge, England.

    -
    REVISION
    +
    REVISION

    -Last updated: 26 April 2018 +Last updated: 15 November 2018
    Copyright © 1997-2018 University of Cambridge.
    diff --git a/doc/pcre2.txt b/doc/pcre2.txt index b75b905..3b85349 100644 --- a/doc/pcre2.txt +++ b/doc/pcre2.txt @@ -4158,6 +4158,21 @@ CODE COVERAGE REPORTING 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 @@ AUTHOR REVISION - Last updated: 26 April 2018 + Last updated: 15 November 2018 Copyright (c) 1997-2018 University of Cambridge. ------------------------------------------------------------------------------ diff --git a/doc/pcre2build.3 b/doc/pcre2build.3 index 540df78..9fc49e4 100644 --- a/doc/pcre2build.3 +++ b/doc/pcre2build.3 @@ -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 @@ information about code coverage, see the \fBgcov\fP and \fBlcov\fP 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 @@ Cambridge, England. .rs .sp .nf -Last updated: 26 April 2018 +Last updated: 15 November 2018 Copyright (c) 1997-2018 University of Cambridge. .fi diff --git a/src/config.h.generic b/src/config.h.generic index 5ef53d3..4ab845c 100644 --- a/src/config.h.generic +++ b/src/config.h.generic @@ -35,6 +35,10 @@ sure both macros are undefined; an emulation function will then be used. */ */ /* #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 diff --git a/src/config.h.in b/src/config.h.in index d8a5280..9fdf581 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -35,6 +35,10 @@ sure both macros are undefined; an emulation function will then be used. */ */ #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 diff --git a/src/pcre2test.c b/src/pcre2test.c index eaacf00..40b4a6f 100644 --- a/src/pcre2test.c +++ b/src/pcre2test.c @@ -169,9 +169,10 @@ commented out the original, but kept it around just in case. */ /* 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)