Disable -Wmissing-field-initializers when building with GCC

This warning is enabled with -Wextra, but incomplete aggregate
initialization is quite common in modern C++ due to direct member
initialization, and we make use of that in Creator in several places.

Change-Id: I585dd70e7c5c52e4549f1c5e3b8d16cc40b260ce
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2022-02-10 17:08:16 +01:00
parent ff71d1fb7b
commit 9528762855
2 changed files with 4 additions and 1 deletions

View File

@@ -66,6 +66,9 @@ if (Qt5_VERSION VERSION_LESS 6.0.0)
if (MSVC AND MSVC_VERSION GREATER_EQUAL 1910)
add_compile_options(/permissive- /Zc:__cplusplus)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL GNU)
add_compile_options(-Wno-missing-field-initializers)
endif()
else()
# Common intermediate directory for QML modules which are defined via qt_add_qml_module()
set(QT_QML_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/qml_modules")

View File

@@ -50,7 +50,7 @@ Product {
flags.push("-Wno-deprecated-copy", "-Wno-constant-logical-operand");
}
if (!qbs.toolchain.contains("clang")) {
flags.push("-Wno-noexcept-type");
flags.push("-Wno-missing-field-initializers", "-Wno-noexcept-type");
if (Utilities.versionCompare(cpp.compilerVersion, "9") >= 0)
flags.push("-Wno-deprecated-copy", "-Wno-init-list-lifetime");
}