Skip to content

Commit

Permalink
Always compile with -Wsuggest-override not to forget override
Browse files Browse the repository at this point in the history
`override` indicates an override of a virtual method and refuses to compile in case of a signature mismatch across the inheritence hierarchy.

This is especially useful when signatures change not to forget anything. Hence, we shall always use `override` whereever applicable.
  • Loading branch information
Al2Klimov committed Nov 11, 2024
1 parent c6ee729 commit 6c33571
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ set(CMAKE_MACOSX_RPATH 1)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${CMAKE_INSTALL_FULL_LIBDIR}/icinga2")

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Winconsistent-missing-override")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments -fcolor-diagnostics -fno-limit-debug-info")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -fcolor-diagnostics -fno-limit-debug-info")

Expand All @@ -249,6 +251,8 @@ if(CMAKE_C_COMPILER_ID STREQUAL "SunPro")
endif()

if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wsuggest-override")

if(CMAKE_SYSTEM_NAME MATCHES AIX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -lpthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -lpthread")
Expand Down

0 comments on commit 6c33571

Please sign in to comment.