From 43e444d1ffac9d63eeb2053465d02ce4a6cc7410 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Fri, 29 Sep 2017 23:53:29 +0200 Subject: CMake: qt5_add_binary_resource: re-run if needed qt5_add_binary_resources() macro did not recompile for CMake generated input before this patch. Adding the input files to the DEPENDS option corrects this issue: Task-number: QTBUG-60714 Change-Id: I0f46918c6f1079fed7ee1b21305b18ff38f863f8 Reviewed-by: David Faure --- src/corelib/Qt5CoreMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake index 8b65db95cb..8d3dbe3ecf 100644 --- a/src/corelib/Qt5CoreMacros.cmake +++ b/src/corelib/Qt5CoreMacros.cmake @@ -257,7 +257,7 @@ function(QT5_ADD_BINARY_RESOURCES target ) add_custom_command(OUTPUT ${rcc_destination} COMMAND ${Qt5Core_RCC_EXECUTABLE} ARGS ${rcc_options} --binary --name ${target} --output ${rcc_destination} ${infiles} - DEPENDS ${rc_depends} ${out_depends} VERBATIM) + DEPENDS ${rc_depends} ${out_depends} ${infiles} VERBATIM) add_custom_target(${target} ALL DEPENDS ${rcc_destination}) endfunction() -- cgit v1.2.3 From 74118a4784569046d5fdf5e08c99f8b1b43e9710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 24 Nov 2017 10:10:23 +0200 Subject: moc: Initialize staticMetaObject with the highest user-settable priority The referenced static meta object for the superclass might be in a different DLL. In this case, the whole QMetaObject can't be initialized all via preinitialized data in the data section of the binary, but must run code at runtime to fill in the value of the dllimported pointer. In these cases, both GCC and MSVC initialize as much as possible statically, while only filling in the dllimported values (QMetaObject::d::superdata) at runtime. Clang, on the other side, initializes the whole struct at runtime if some part of it needs runtime initialization, leaving the struct completely uninitialized before constructors are run. In C++, there are no guarantees for in what order constructors in different translation units are executed. This in particular means that there are no guarantees as to whether qRegisterWidgetsVariant() in qwidgetsvariants.cpp runs before or after the runtime initialization of QWidget::staticMetaObject. With GCC and MSVC, this doesn't seem to have mattered since only the superdata pointer of the staticMetaObject was uninitialized - everything else was initialized, and the superdata pointer doesn't seem to be accessed during qRegisterWidgetsVariant. With clang, the whole staticMetaObject is uninitialized, unless the staticMetaObject has been initialized before (and the initialization order is undefined). By setting a manual priority (which is a GCC extension that also clang supports) for the staticMetaObjects, we can be sure that these are initialized before the actual explicit constructor invocations (without any explicit initialization priority) that can access the staticMetaObjects. Change-Id: I64a82f12d690528567509791bae088b6304e189b Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/global/qglobal.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 4e7c1b59be..2464db7c5f 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -508,6 +508,12 @@ using qsizetype = QIntegerForSizeof::Signed; # define Q_ALWAYS_INLINE inline #endif +#ifdef Q_CC_GNU +# define QT_INIT_METAOBJECT __attribute__((init_priority(101))) +#else +# define QT_INIT_METAOBJECT +#endif + //defines the type for the WNDPROC on windows //the alignment needs to be forced for sse2 to not crash with mingw #if defined(Q_OS_WIN) -- cgit v1.2.3