Replace cxx17_bm_searcher config check with feature test macro

This enables the code also for boostrap.

Amends b24e689cb5.

Pick-to: 6.3
Change-Id: I8efc76c20690282a2428f360d6b93896966b97ee
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Marc Mutz 2022-01-24 09:15:24 +01:00 committed by Mårten Nordheim
parent a8f00bf0ad
commit df0f8e036c
3 changed files with 1 additions and 28 deletions

View File

@ -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 <algorithm>
#include <functional>
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 <filesystem>"
@ -541,10 +519,6 @@ qt_feature("cxx11_future" PUBLIC
LABEL "C++11 <future>"
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 <filesystem>"
CONDITION TEST_cxx17_filesystem

View File

@ -78,7 +78,6 @@
#define QT_FEATURE_cborstreamwriter 1
#define QT_CRYPTOGRAPHICHASH_ONLY_SHA1
#define QT_FEATURE_cxx11_random (__has_include(<random>) ? 1 : -1)
#define QT_FEATURE_cxx17_bm_searcher -1
#define QT_FEATURE_cxx17_filesystem -1
#define QT_NO_DATASTREAM
#define QT_FEATURE_datestring 1

View File

@ -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)];