From fe15fa8b1e49b8d6a1a00c94361a7c46d7966247 Mon Sep 17 00:00:00 2001 From: ph10 Date: Wed, 11 Nov 2015 17:43:37 +0000 Subject: [PATCH] Lock out configuring for EBCDIC with non-8-bit libraries. --- ChangeLog | 2 ++ configure.ac | 6 +++++- src/pcre2_internal.h | 12 ++++++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ad577b..34a47bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -284,6 +284,8 @@ a factor of the size of the compiling workspace (it currently is). 82. Small optimizations in code for finding the minimum matching length. +83. Lock out configuring for EBCDIC with non-8-bit libraries. + Version 10.20 30-June-2015 -------------------------- diff --git a/configure.ac b/configure.ac index 006b793..ae064fd 100644 --- a/configure.ac +++ b/configure.ac @@ -339,13 +339,17 @@ fi # Make sure that if enable_ebcdic is set, rebuild_chartables is also enabled. # Also check that UTF support is not requested, because PCRE2 cannot handle # EBCDIC and UTF in the same build. To do so it would need to use different -# character constants depending on the mode. +# character constants depending on the mode. Also, EBCDIC cannot be used with +# 16-bit and 32-bit libraries. # if test "x$enable_ebcdic" = "xyes"; then enable_rebuild_chartables=yes if test "x$enable_unicode" = "xyes"; then AC_MSG_ERROR([support for EBCDIC and Unicode cannot be enabled at the same time]) fi + if test "x$enable_pcre2_16" = "xyes" -o "x$enable_pcre2_32" = "xyes"; then + AC_MSG_ERROR([EBCDIC support is available only for the 8-bit library]) + fi fi # Check argument to --with-link-size diff --git a/src/pcre2_internal.h b/src/pcre2_internal.h index 6c283b9..3c9d954 100644 --- a/src/pcre2_internal.h +++ b/src/pcre2_internal.h @@ -39,7 +39,10 @@ POSSIBILITY OF SUCH DAMAGE. */ /* We do not support both EBCDIC and Unicode at the same time. The "configure" -script prevents both being selected, but not everybody uses "configure". */ +script prevents both being selected, but not everybody uses "configure". EBCDIC +is only supported for the 8-bit library, but the check for this has to be later +in this file, because the first part is not width-dependent, and is included by +pcre2test.c with CODE_UNIT_WIDTH == 0. */ #if defined EBCDIC && defined SUPPORT_UNICODE #error The use of both EBCDIC and SUPPORT_UNICODE is not supported. @@ -1803,11 +1806,16 @@ typedef struct pcre2_serialized_data { #if defined PCRE2_CODE_UNIT_WIDTH && PCRE2_CODE_UNIT_WIDTH != 0 +/* EBCDIC is supported only for the 8-bit library. */ + +#if defined EBCDIC && PCRE2_CODE_UNIT_WIDTH != 8 +#error EBCDIC is not supported for the 16-bit or 32-bit libraries +#endif + /* This is the largest non-UTF code point. */ #define MAX_NON_UTF_CHAR (0xffffffffU >> (32 - PCRE2_CODE_UNIT_WIDTH)) - /* Internal shared data tables and variables. These are used by more than one of the exported public functions. They have to be "external" in the C sense, but are not part of the PCRE2 public API. Although the data for some of them is