← Back to team overview

kicad-developers team mailing list archive

[PATCH 1/4] 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 f077de3..130b1cc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -152,6 +152,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