diff options
author | Christian Ehrlicher <[email protected]> | 2024-06-28 13:31:59 +0200 |
---|---|---|
committer | Christian Ehrlicher <[email protected]> | 2024-07-01 22:50:42 +0200 |
commit | bcfa0102e5910d99263ebb73515cc9d35b818b5c (patch) | |
tree | 0b5f165b13e4aba1523680f8c3a2b4ddc355360c | |
parent | daad2b28fdb884e6d796ab024bcb962155cf5534 (diff) |
SQL/SQLite: add check for localtime_r/localtime_s
Add a check for localtime_r/localtime_s to avoid the usage of a sqlite
mutex when a time needs to be converted.
Pick-to: 6.8
Change-Id: I536497da1938131298c1198db85dab74d6157e35
Reviewed-by: Alexey Edelev <[email protected]>
Reviewed-by: Alexandru Croitor <[email protected]>
-rw-r--r-- | configure.cmake | 38 | ||||
-rw-r--r-- | src/plugins/sqldrivers/sqlite/CMakeLists.txt | 10 |
2 files changed, 48 insertions, 0 deletions
diff --git a/configure.cmake b/configure.cmake index db358bb7048..b394e88c072 100644 --- a/configure.cmake +++ b/configure.cmake @@ -370,6 +370,36 @@ qt_config_compile_test_x86simd(avx512vbmi2 "AVX512VBMI2") # x86: vaes qt_config_compile_test_x86simd(vaes "VAES") +# localtime_r +qt_config_compile_test(localtime_r + LABEL "localtime_r()" + CODE +"#include <time.h> + +int main(void) +{ + /* BEGIN TEST: */ +(void) localtime_r(nullptr, nullptr); + /* END TEST: */ + return 0; +} +") + +# localtime_s +qt_config_compile_test(localtime_s + LABEL "localtime_s()" + CODE +"#include <time.h> + +int main(void) +{ + /* BEGIN TEST: */ +(void) localtime_s(nullptr, nullptr); + /* END TEST: */ + return 0; +} +") + # posix_fallocate qt_config_compile_test(posix_fallocate LABEL "POSIX fallocate()" @@ -954,6 +984,14 @@ qt_feature("wasm-exceptions" PUBLIC qt_feature_definition("wasm-exceptions" "QT_WASM_EXCEPTIONS" VALUE "1") qt_feature_config("wasm-exceptions" QMAKE_PRIVATE_CONFIG) +qt_feature("localtime_r" PRIVATE + LABEL "localtime_r()" + CONDITION TEST_localtime_r +) +qt_feature("localtime_s" PRIVATE + LABEL "localtime_s()" + CONDITION TEST_localtime_s +) qt_feature("posix_fallocate" PRIVATE LABEL "POSIX fallocate()" CONDITION TEST_posix_fallocate diff --git a/src/plugins/sqldrivers/sqlite/CMakeLists.txt b/src/plugins/sqldrivers/sqlite/CMakeLists.txt index e667034c2e5..6ca4b120ccf 100644 --- a/src/plugins/sqldrivers/sqlite/CMakeLists.txt +++ b/src/plugins/sqldrivers/sqlite/CMakeLists.txt @@ -74,6 +74,16 @@ qt_internal_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_largefile SQLITE_DISABLE_LFS ) +qt_internal_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_localtime_r + DEFINES + HAVE_LOCALTIME_R=1 +) + +qt_internal_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_localtime_s + DEFINES + HAVE_LOCALTIME_S=1 +) + qt_internal_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_posix_fallocate AND NOT QT_FEATURE_system_sqlite DEFINES HAVE_POSIX_FALLOCATE=1 |