From 0e778b96f1f4bb0d98648fab693cb16cca451beb Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 26 Mar 2021 14:14:18 +0100 Subject: [PATCH 1/3] tst_qobject: enable some tests for narrowing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Compilers are catching up, so some #if 0 codepaths can now be conditionally enabled. Change-Id: Ia9e87a096bc2ae4789ab390a9170d9c1eb9690d6 Reviewed-by: Tor Arne Vestbø Reviewed-by: Qt CI Bot Reviewed-by: Alexandru Croitor --- tests/auto/corelib/kernel/qobject/tst_qobject.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 858a5084ac7..f36a40e5df7 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -7314,8 +7314,10 @@ void tst_QObject::checkArgumentsForNarrowing() FITS(ConvertingToDouble, long double); - // no compiler still implements this properly. -#if 0 + // GCC and clang don't implement this properly yet: + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99625 + // https://bugs.llvm.org/show_bug.cgi?id=49676 +#if defined(Q_CC_MSVC) // at least since VS2017 struct ConstructibleFromInt { /* implicit */ ConstructibleFromInt(int) {} }; @@ -7334,7 +7336,9 @@ void tst_QObject::checkArgumentsForNarrowing() class ForwardDeclared; FITS(ForwardDeclared, ForwardDeclared); -#if 0 // waiting for official compiler releases that implement P1957... +#if (defined(Q_CC_EXACTLY_GCC) && Q_CC_EXACTLY_GCC >= 1100) \ + || (defined(Q_CC_CLANG) && Q_CC_CLANG >= 1100) \ + || defined(Q_CC_MSVC) // at least since VS2017 { // wg21.link/P1957 NARROWS(char*, bool); From 9466b3629a391ae93c4f06d3627e3dc9e10bba9f Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Mon, 29 Mar 2021 16:46:19 +0200 Subject: [PATCH 2/3] Add missing compile definitions to the resource object library The resource object library must be compiled with the definitions specified in Qt::Core. Missing the required definitions causes linker problems when QT_NAMESPACE is defined. Change-Id: If0ca20604e251822279e0d4906c47b94d3b4ceb4 Reviewed-by: Alexandru Croitor --- src/corelib/Qt6CoreMacros.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake index 9e9b0f1e568..b4ffa545789 100644 --- a/src/corelib/Qt6CoreMacros.cmake +++ b/src/corelib/Qt6CoreMacros.cmake @@ -1185,6 +1185,9 @@ function(__qt_propagate_generated_resource target resource_name generated_source set(resource_target "${target}_resources_${resource_count}") add_library("${resource_target}" OBJECT "${generated_source_code}") + target_compile_definitions("${resource_target}" PRIVATE + "$" + ) set_property(TARGET ${resource_target} APPEND PROPERTY _qt_resource_name ${resource_name}) # Save the path to the generated source file, relative to the the current build dir. From 856fadf85ca2a3b70878d01d32e4d4cef807b8a9 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Tue, 30 Mar 2021 12:37:08 +0200 Subject: [PATCH 3/3] Fix processing of list arguments passed to the 'configure' script list(TRANSFORM ...) unexpectedly removes semicolon escaping in list items. So the list arguments seems to be broken. The 'bracket argument' suppresses this behavior. Right before forwarding command line arguments to the cmake call, 'bracket arguments'are replaced by escaped semicolons back. Recent fix escapes all semicolons of the 'configure_args' and glues all arguments to a single 'list'. Amends df8e1c8e588cb0529b2bc02faef1022ef3f29145 Change-Id: I4a458b9e3add307b36924c4c7c7f739d348f9343 Reviewed-by: Alexandru Croitor --- cmake/QtProcessConfigureArgs.cmake | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cmake/QtProcessConfigureArgs.cmake b/cmake/QtProcessConfigureArgs.cmake index 6410fc30273..cecf7a681f8 100644 --- a/cmake/QtProcessConfigureArgs.cmake +++ b/cmake/QtProcessConfigureArgs.cmake @@ -43,6 +43,13 @@ else() set(commandline_files "${MODULE_ROOT}/${commandline_filename}") endif() file(STRINGS "${OPTFILE}" configure_args) + +# list(TRANSFORM ...) unexpectedly removes semicolon escaping in list items. So the list arguments +# seem to be broken. The 'bracket argument' suppresses this behavior. Right before forwarding +# command line arguments to the cmake call, 'bracket arguments' are replaced by escaped semicolons +# back. +list(TRANSFORM configure_args REPLACE ";" "[[;]]") + list(FILTER configure_args EXCLUDE REGEX "^[ \t]*$") list(TRANSFORM configure_args STRIP) list(TRANSFORM configure_args REPLACE "\\\\" "\\\\\\\\") @@ -82,9 +89,7 @@ while(NOT "${configure_args}" STREQUAL "") elseif(arg MATCHES "^-host.*dir") message(FATAL_ERROR "${arg} is not supported anymore.") elseif(arg STREQUAL "--") - # Everything after this argument will be passed to CMake verbatim, - # but we need to escape semi-colons so that lists are preserved. - string(REPLACE ";" "\\;" configure_args "${configure_args}") + # Everything after this argument will be passed to CMake verbatim. list(APPEND cmake_args "${configure_args}") break() else() @@ -821,6 +826,9 @@ endif() push("${MODULE_ROOT}") +# Restore the escaped semicolons in arguments that are lists +list(TRANSFORM cmake_args REPLACE "\\[\\[;\\]\\]" "\\\\;") + execute_process(COMMAND "${CMAKE_COMMAND}" ${cmake_args} COMMAND_ECHO STDOUT RESULT_VARIABLE exit_code)