summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2021-05-27 14:24:53 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-06-18 21:10:36 +0000
commitd172956ce4d218c4943a61cdb8dfe022bfabc7c3 (patch)
tree7899be7c51a2897b7163b5a900a6a9628b0a374b /cmake
parent2a89b6848c54a18878b010c88c9efbbea343f34f (diff)
Add GCC 11 and C++20 workarounds
GCC 11.1 has a bug [1] in the preprocessor that leads to -Wsuggest-override warnings being raised in random places, even under pragmas that are supposed to suppress it. For some reason, NOT using the integrated preprocessor fixes it, so add that flag as a workaround. Also, GCC 11 introduces a family of warnings for C++20's deprecations of mixed enum arithmetic, which we use all over the place. Avoid a hard error for those warnings. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100796 Change-Id: I3b2aefa385f191f207e7eb876bc1ed0b18fb342b Task-number: QTBUG-93360 Task-number: QTBUG-94059 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit f29ff5dffb7f9321d2bfb6071813d2d8d88186b3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtInternalTargets.cmake11
1 files changed, 11 insertions, 0 deletions
diff --git a/cmake/QtInternalTargets.cmake b/cmake/QtInternalTargets.cmake
index 754688b800..52d29a8673 100644
--- a/cmake/QtInternalTargets.cmake
+++ b/cmake/QtInternalTargets.cmake
@@ -32,6 +32,17 @@ function(qt_internal_set_warnings_are_errors_flags target)
list(APPEND flags -Wno-error=format-overflow)
endif()
+ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "11.0.0")
+ # We do mixed enum arithmetic all over the place:
+ list(APPEND flags -Wno-error=deprecated-enum-enum-conversion -Wno-error=deprecated-enum-float-conversion)
+ endif()
+
+ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "11.0.0" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "11.2.0")
+ # GCC 11.1 has a regression in the integrated preprocessor, so disable it as a workaround (QTBUG-93360)
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100796
+ list(APPEND flags -no-integrated-cpp)
+ endif()
+
# Work-around for bug https://code.google.com/p/android/issues/detail?id=58135
if (ANDROID)
list(APPEND flags -Wno-error=literal-suffix)