From df0f8e036cdef59d596113c4acb450258aba11d3 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 24 Jan 2022 09:15:24 +0100 Subject: [PATCH] Replace cxx17_bm_searcher config check with feature test macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This enables the code also for boostrap. Amends b24e689cb561d81745ff47a5ce4595b809923914. Pick-to: 6.3 Change-Id: I8efc76c20690282a2428f360d6b93896966b97ee Reviewed-by: MÃ¥rten Nordheim --- src/corelib/configure.cmake | 26 ----------------------- src/corelib/global/qconfig-bootstrapped.h | 1 - src/corelib/text/qstring.cpp | 2 +- 3 files changed, 1 insertion(+), 28 deletions(-) diff --git a/src/corelib/configure.cmake b/src/corelib/configure.cmake index 71e237ae9c4..107028bfac9 100644 --- a/src/corelib/configure.cmake +++ b/src/corelib/configure.cmake @@ -156,28 +156,6 @@ std::mt19937 mt(0); } ") -# cxx17_bm_searcher -qt_config_compile_test(cxx17_bm_searcher - LABEL "C++17 boyer_moore_searcher" - CODE -"#include -#include - -int main(void) -{ - /* BEGIN TEST: */ -const char haystack[] = \"hello\"; -const char needle[] = \"e\"; -const auto it = -std::search(haystack + 0, haystack + std::size(haystack), -std::boyer_moore_searcher(needle + 0, needle + std::size(needle))); -(void)it; - /* END TEST: */ - return 0; -} -"# FIXME: qmake: CONFIG += c++17 -) - # cxx17_filesystem qt_config_compile_test(cxx17_filesystem LABEL "C++17 " @@ -541,10 +519,6 @@ qt_feature("cxx11_future" PUBLIC LABEL "C++11 " CONDITION TEST_cxx11_future ) -qt_feature("cxx17_bm_searcher" PRIVATE - LABEL "C++17 boyer_moore_searcher" - CONDITION TEST_cxx17_bm_searcher -) qt_feature("cxx17_filesystem" PUBLIC LABEL "C++17 " CONDITION TEST_cxx17_filesystem diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index 090dde8312c..f8858460cae 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -78,7 +78,6 @@ #define QT_FEATURE_cborstreamwriter 1 #define QT_CRYPTOGRAPHICHASH_ONLY_SHA1 #define QT_FEATURE_cxx11_random (__has_include() ? 1 : -1) -#define QT_FEATURE_cxx17_bm_searcher -1 #define QT_FEATURE_cxx17_filesystem -1 #define QT_NO_DATASTREAM #define QT_FEATURE_datestring 1 diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index a8482c5fbd4..437b31089dc 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -10564,7 +10564,7 @@ qsizetype QtPrivate::findString(QLatin1String haystack, qsizetype from, QLatin1S return -1; } -#if QT_CONFIG(cxx17_bm_searcher) +#ifdef __cpp_lib_boyer_moore_searcher const auto ciHasher = [](char a) { return latin1Lower[uchar(a)]; }; const auto ciEqual = [](char a, char b) { return latin1Lower[uchar(a)] == latin1Lower[uchar(b)];