From 215df7eec63e058e535045396fbb725f0f29f4b0 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Mon, 22 Feb 2021 13:08:41 -0600 Subject: [PATCH] Extend PCRE2 wchar_t interop support to 16-bit wchar_t impls Previously, the interop glue for more friendly access to PCRE2's fixed-size values was only used when char32_t/wchar_t were interchangeable and PCRE2 was used with a global 32-bit unit width set; this patch extends the same to char16_t when wchar_t is also 16-bits (namely on Cygwin) to avoid compilation fpermissive warnings about casts between types of potentially different sizes. Reported in #6585. --- src/builtin_string.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/builtin_string.cpp b/src/builtin_string.cpp index 2e5aed796..779274a76 100644 --- a/src/builtin_string.cpp +++ b/src/builtin_string.cpp @@ -925,10 +925,18 @@ class pcre2_matcher_t : public string_matcher_t { #if PCRE2_CODE_UNIT_WIDTH == 8 uint8_t match_index_msb; uint8_t match_index_lsb; +#if CHAR_BIT == PCRE2_CODE_UNIT_WIDTH char name[]; +#else + char8_t name[]; +#endif #elif PCRE2_CODE_UNIT_WIDTH == 16 uint16_t match_index; +#if WCHAR_T_BITS == PCRE2_CODE_UNIT_WIDTH + wchar_t name[]; +#else char16_t name[]; +#endif #else uint32_t match_index; #if WCHAR_T_BITS == PCRE2_CODE_UNIT_WIDTH