From 9ca635482d649c59e312e6f1cd73df6685d280b0 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sun, 3 Jan 2016 14:38:58 +0100 Subject: PCRE2: port QRegularExpression to PCRE2 PCRE1 is going towards EOL. PCRE2 is the way forward in terms of new features, performance, and security improvements. The APIs that QRegularExpression uses are similar so the required modifications aren't extensive. The biggest difference comes to JIT-compiling of the pattern. In PCRE1, JIT-compiling did not modify the processed PCRE pattern, but returned a new chunk of data. This allowed multiple threads to keep matching using the same processed data and NULL for the JIT data, until a thread JIT-compiled and atomically set the shared JIT data to the results of the compilation. In PCRE2, JIT-compiling _modifies_ the processed PCRE pattern in a way that it's thread unsafe [1]; the results of JIT-compilation are stored somewhere inside the processed pattern. This means the above approach cannot work -- a thread may be matching while another one JIT-compiles, causing a data race. While waiting for better workarounds from upstream, employ a read/write mutex to protect the matching from JIT-compilation. [1] https://lists.exim.org/lurker/message/20160104.105831.3cb25b39.en.html [ChangeLog][General] QRegularExpression now requires the PCRE2 library, at least version 10.20. Support for the PCRE1 library has been dropped. A copy of PCRE2 is shipped with Qt and will automatically be used on those platforms which lack it. Change-Id: I9fe11104230a096796df2d0bdcea861acf769f57 Reviewed-by: Thiago Macieira --- src/src.pro | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/src.pro') diff --git a/src/src.pro b/src/src.pro index f19b0bd354..ae36cf468e 100644 --- a/src/src.pro +++ b/src/src.pro @@ -78,8 +78,8 @@ src_testlib.subdir = $$PWD/testlib src_testlib.target = sub-testlib src_testlib.depends = src_corelib # testlib links only to corelib, but see below for the headers -src_3rdparty_pcre.subdir = $$PWD/3rdparty/pcre -src_3rdparty_pcre.target = sub-3rdparty-pcre +src_3rdparty_pcre2.subdir = $$PWD/3rdparty/pcre2 +src_3rdparty_pcre2.target = sub-3rdparty-pcre2 src_3rdparty_harfbuzzng.subdir = $$PWD/3rdparty/harfbuzz-ng src_3rdparty_harfbuzzng.target = sub-3rdparty-harfbuzzng @@ -137,9 +137,9 @@ src_android.subdir = $$PWD/android } } SUBDIRS += src_tools_bootstrap src_tools_moc src_tools_rcc -qtConfig(regularexpression):pcre { - SUBDIRS += src_3rdparty_pcre - src_corelib.depends += src_3rdparty_pcre +qtConfig(regularexpression):pcre2 { + SUBDIRS += src_3rdparty_pcre2 + src_corelib.depends += src_3rdparty_pcre2 } SUBDIRS += src_corelib src_tools_qlalr TOOLS = src_tools_moc src_tools_rcc src_tools_qlalr @@ -201,7 +201,7 @@ android: SUBDIRS += src_android TR_EXCLUDE = \ src_tools_bootstrap src_tools_moc src_tools_rcc src_tools_uic src_tools_qlalr \ src_tools_bootstrap_dbus src_tools_qdbusxml2cpp src_tools_qdbuscpp2xml \ - src_3rdparty_pcre src_3rdparty_harfbuzzng src_3rdparty_freetype + src_3rdparty_pcre2 src_3rdparty_harfbuzzng src_3rdparty_freetype sub-tools.depends = $$TOOLS QMAKE_EXTRA_TARGETS = sub-tools -- cgit v1.2.3