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 <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Christian Ehrlicher 2024-06-28 13:31:59 +02:00
parent daad2b28fd
commit bcfa0102e5
2 changed files with 48 additions and 0 deletions

View File

@ -370,6 +370,36 @@ qt_config_compile_test_x86simd(avx512vbmi2 "AVX512VBMI2")
# x86: vaes # x86: vaes
qt_config_compile_test_x86simd(vaes "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 # posix_fallocate
qt_config_compile_test(posix_fallocate qt_config_compile_test(posix_fallocate
LABEL "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_definition("wasm-exceptions" "QT_WASM_EXCEPTIONS" VALUE "1")
qt_feature_config("wasm-exceptions" QMAKE_PRIVATE_CONFIG) 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 qt_feature("posix_fallocate" PRIVATE
LABEL "POSIX fallocate()" LABEL "POSIX fallocate()"
CONDITION TEST_posix_fallocate CONDITION TEST_posix_fallocate

View File

@ -74,6 +74,16 @@ qt_internal_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_largefile
SQLITE_DISABLE_LFS 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 qt_internal_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_posix_fallocate AND NOT QT_FEATURE_system_sqlite
DEFINES DEFINES
HAVE_POSIX_FALLOCATE=1 HAVE_POSIX_FALLOCATE=1