Skip to content

Do not use the system wctype() on Windows - #149

Open
kevinushey wants to merge 1 commit into
laurikari:masterfrom
kevinushey:bugfix/win32-wctype
Open

Do not use the system wctype() on Windows#149
kevinushey wants to merge 1 commit into
laurikari:masterfrom
kevinushey:bugfix/win32-wctype

Conversation

@kevinushey

Copy link
Copy Markdown

On Windows, HAVE_ISWCTYPE and HAVE_WCTYPE are defined (both in win32/config.h and by configure under MinGW), so TRE_USE_SYSTEM_WCTYPE is enabled. But the Windows CRT's wctype() has no "blank" class -- wctype("blank") returns 0, so a pattern using [[:blank:]] fails to compile with REG_ECTYPE. The CRT's iswprint(L'\t') also incorrectly returns true, so [[:print:]] matches a tab.

TRE already carries fixes for both in the !TRE_USE_SYSTEM_WCTYPE path -- tre_isblank_func(), and the Windows tab check in tre_isprint_func() imported from #106 -- but they are currently unreachable on Windows because the system-wctype path is selected instead.

This excludes _WIN32 from the TRE_USE_SYSTEM_WCTYPE condition so that TRE's own class-function table is used there, making those existing workarounds effective. R's bundled copy of TRE has shipped this opt-out for many years.

No change on other platforms; make check passes on macOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant