Skip to content

Commit

Permalink
Add -Wsuggest-override for gcc >= 9.2
Browse files Browse the repository at this point in the history
gcc doesn't report warnings for final methods since version 9.2:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78010

Change-Id: I7152351aac0e3bad86d777e119f25137ef97ec6f
Reviewed-by: Qt CI Bot <[email protected]>
Reviewed-by: Kai Koehne <[email protected]>
  • Loading branch information
avolkov-astra committed Jul 24, 2020
1 parent 6533d1a commit 865582b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmake/QtInternalTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ if (MSVC)
)
endif()

if (GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "9.2")
target_compile_options(PlatformCommonInternal INTERFACE $<$<COMPILE_LANGUAGE:CXX>:-Wsuggest-override>)
endif()

function(qt_get_implicit_sse2_genex_condition out_var)
set(is_shared_lib "$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>")
set(is_static_lib "$<STREQUAL:$<TARGET_PROPERTY:TYPE>,STATIC_LIBRARY>")
Expand Down
2 changes: 2 additions & 0 deletions mkspecs/features/qt_common.prf
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ clang {
greaterThan(QT_GCC_MAJOR_VERSION, 6): QMAKE_CXXFLAGS_WARN_ON += -Wno-stringop-overflow
# GCC 9 introduced -Wformat-overflow in -Wall, but it is buggy:
greaterThan(QT_GCC_MAJOR_VERSION, 8): QMAKE_CXXFLAGS_WARN_ON += -Wno-format-overflow
ver = $${QT_GCC_MAJOR_VERSION}.$${QT_GCC_MINOR_VERSION}
versionAtLeast(ver, 9.2): QMAKE_CXXFLAGS_WARN_ON += -Wsuggest-override
}

warnings_are_errors:warning_clean {
Expand Down

0 comments on commit 865582b

Please sign in to comment.