← Back to team overview

kicad-developers team mailing list archive

[PATCH 2/2] Warn about missing override specifiers, if supported (gcc 5.1, clang 3.5)

 

---
 CMakeLists.txt | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0581c9e..e3e0eec 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -174,6 +174,18 @@ if( CMAKE_VERSION VERSION_LESS 3.1 AND ( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_C
 endif()
 
 
+# Warn about missing override specifiers, if supported
+if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
+    include(CheckCXXCompilerFlag)
+
+    CHECK_CXX_COMPILER_FLAG("-Wsuggest-override" COMPILER_SUPPORTS_WSUGGEST_OVERRIDE)
+
+    if(COMPILER_SUPPORTS_WSUGGEST_OVERRIDE)
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override")
+    endif()
+endif()
+
+
 #================================================
 # Set flags for GCC, or treat llvm as GCC
 #================================================

Follow ups

References