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 --- config.tests/unix/pcre/pcre.cpp | 50 --------------------------------------- config.tests/unix/pcre/pcre.pro | 2 -- config.tests/unix/pcre2/pcre2.cpp | 50 +++++++++++++++++++++++++++++++++++++++ config.tests/unix/pcre2/pcre2.pro | 2 ++ 4 files changed, 52 insertions(+), 52 deletions(-) delete mode 100644 config.tests/unix/pcre/pcre.cpp delete mode 100644 config.tests/unix/pcre/pcre.pro create mode 100644 config.tests/unix/pcre2/pcre2.cpp create mode 100644 config.tests/unix/pcre2/pcre2.pro (limited to 'config.tests') diff --git a/config.tests/unix/pcre/pcre.cpp b/config.tests/unix/pcre/pcre.cpp deleted file mode 100644 index 18f7f7d954..0000000000 --- a/config.tests/unix/pcre/pcre.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Giuseppe D'Angelo . -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#if (PCRE_MAJOR < 8) || ((PCRE_MAJOR == 8) && (PCRE_MINOR < 31)) -#error This PCRE version is not supported -#endif - -int main(int, char **) -{ - return 0; -} - diff --git a/config.tests/unix/pcre/pcre.pro b/config.tests/unix/pcre/pcre.pro deleted file mode 100644 index a47e6d1e96..0000000000 --- a/config.tests/unix/pcre/pcre.pro +++ /dev/null @@ -1,2 +0,0 @@ -SOURCES = pcre.cpp -CONFIG -= qt dylib diff --git a/config.tests/unix/pcre2/pcre2.cpp b/config.tests/unix/pcre2/pcre2.cpp new file mode 100644 index 0000000000..48130f97c4 --- /dev/null +++ b/config.tests/unix/pcre2/pcre2.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#if (PCRE2_MAJOR < 10) || ((PCRE2_MAJOR == 10) && (PCRE_MINOR < 20)) +#error This PCRE version is not supported +#endif + +int main(int, char **) +{ + return 0; +} + diff --git a/config.tests/unix/pcre2/pcre2.pro b/config.tests/unix/pcre2/pcre2.pro new file mode 100644 index 0000000000..6a3fc275bc --- /dev/null +++ b/config.tests/unix/pcre2/pcre2.pro @@ -0,0 +1,2 @@ +SOURCES = pcre2.cpp +CONFIG -= qt dylib -- cgit v1.2.3