From a9f26089ede701560cebd3a936eede0baf92be5a Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 22 Jul 2024 16:10:13 +0200 Subject: [PATCH] Enable QT_NO_QSNPRINTF globally The qsnprintf() function introduces even more platform variability than std::snprintf(), so from now on, we're using only std::snprintf(). Task-number: QTBUG-127110 Change-Id: Ic81b2a760521d77442cc328d2cfa7659bba8b7e2 Reviewed-by: Thiago Macieira (cherry picked from commit b8a956c2d3f9c158594265eca89185bd2bc671e7) Reviewed-by: Qt Cherry-pick Bot --- cmake/QtInternalTargets.cmake | 1 + src/corelib/CMakeLists.txt | 1 - src/gui/CMakeLists.txt | 1 - src/testlib/CMakeLists.txt | 1 - tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp | 4 ++++ 5 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmake/QtInternalTargets.cmake b/cmake/QtInternalTargets.cmake index 79f7fd9c57f..60135355632 100644 --- a/cmake/QtInternalTargets.cmake +++ b/cmake/QtInternalTargets.cmake @@ -151,6 +151,7 @@ target_link_libraries(PlatformToolInternal INTERFACE PlatformAppInternal) qt_internal_add_global_definition(QT_NO_JAVA_STYLE_ITERATORS) qt_internal_add_global_definition(QT_NO_QASCONST) qt_internal_add_global_definition(QT_NO_QEXCHANGE) +qt_internal_add_global_definition(QT_NO_QSNPRINTF) qt_internal_add_global_definition(QT_NO_NARROWING_CONVERSIONS_IN_CONNECT) qt_internal_add_global_definition(QT_EXPLICIT_QFILE_CONSTRUCTION_FROM_PATH) qt_internal_add_global_definition(QT_USE_QSTRINGBUILDER SCOPE PLUGIN TOOL MODULE) diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt index 320f9e20a5d..de28a6183e9 100644 --- a/src/corelib/CMakeLists.txt +++ b/src/corelib/CMakeLists.txt @@ -332,7 +332,6 @@ qt_internal_add_module(Core QT_NO_CONTEXTLESS_CONNECT QT_NO_FOREACH QT_NO_QPAIR - QT_NO_QSNPRINTF QT_NO_USING_NAMESPACE QT_TYPESAFE_FLAGS QT_USE_NODISCARD_FILE_OPEN diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 124e2bfa293..3b3dbd13218 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -275,7 +275,6 @@ qt_internal_add_module(Gui QT_NO_CONTEXTLESS_CONNECT QT_NO_FOREACH QT_NO_USING_NAMESPACE - QT_NO_QSNPRINTF QT_USE_NODISCARD_FILE_OPEN QT_QPA_DEFAULT_PLATFORM_NAME="${QT_QPA_DEFAULT_PLATFORM}" INCLUDE_DIRECTORIES diff --git a/src/testlib/CMakeLists.txt b/src/testlib/CMakeLists.txt index d4e0a8be38a..391c9de9937 100644 --- a/src/testlib/CMakeLists.txt +++ b/src/testlib/CMakeLists.txt @@ -68,7 +68,6 @@ qt_internal_add_module(Test QT_NO_CONTEXTLESS_CONNECT QT_NO_DATASTREAM QT_NO_FOREACH - QT_NO_QSNPRINTF QT_USE_NODISCARD_FILE_OPEN # Ensure uniform location info between release and debug builds QT_NO_MESSAGELOGCONTEXT diff --git a/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp index 29103b5e3d4..5b22fecbf39 100644 --- a/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp @@ -2,6 +2,10 @@ // Copyright (C) 2016 Intel Corporation. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +#ifdef QT_NO_QSNPRINTF +# undef QT_NO_QSNPRINTF // test of the function +#endif + #include #include