From ea5477e43de4660343897e4669bc5809dc4ddabe Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 23 Jun 2016 00:16:15 +0200 Subject: [PATCH 1/4] Make C++ feature checks extensible Turn the feature check for cxx11_unordered_map into a function such that we can use it for other features as well. Drop the 11 suffix, as we may want to check features from other standards. --- CMakeLists.txt | 2 +- Source/Checks/cm_cxx11_unordered_map.cmake | 25 ------------- Source/Checks/cm_cxx_features.cmake | 36 +++++++++++++++++++ ...dered_map.cpp => cm_cxx_unordered_map.cxx} | 0 Source/cmConfigure.cmake.h.in | 2 +- Source/cmDefinitions.h | 4 +-- Source/cmFileTimeComparison.cxx | 6 ++-- Source/cmGlobalGenerator.h | 4 +-- Source/cmMakefile.h | 6 ++-- Source/cmTarget.h | 4 +-- 10 files changed, 50 insertions(+), 39 deletions(-) delete mode 100644 Source/Checks/cm_cxx11_unordered_map.cmake create mode 100644 Source/Checks/cm_cxx_features.cmake rename Source/Checks/{cm_cxx11_unordered_map.cpp => cm_cxx_unordered_map.cxx} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5336208d0..ae5990ebe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,7 @@ if(NOT DEFINED CMAKE_CXX_STANDARD AND NOT CMake_NO_CXX_STANDARD) endif() endif() if(NOT CMake_TEST_EXTERNAL_CMAKE) - include(${CMake_SOURCE_DIR}/Source/Checks/cm_cxx11_unordered_map.cmake) + include(${CMake_SOURCE_DIR}/Source/Checks/cm_cxx_features.cmake) endif() # option to set the internal encoding of CMake to UTF-8 diff --git a/Source/Checks/cm_cxx11_unordered_map.cmake b/Source/Checks/cm_cxx11_unordered_map.cmake deleted file mode 100644 index 80fe391bc..000000000 --- a/Source/Checks/cm_cxx11_unordered_map.cmake +++ /dev/null @@ -1,25 +0,0 @@ - -if(CMAKE_CXX_STANDARD AND NOT DEFINED CMake_HAVE_CXX11_UNORDERED_MAP) - message(STATUS "Checking if compiler supports C++11 unordered_map") - try_compile(CMake_HAVE_CXX11_UNORDERED_MAP - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_LIST_DIR}/cm_cxx11_unordered_map.cpp - CMAKE_FLAGS -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} - OUTPUT_VARIABLE OUTPUT - ) - if(CMake_HAVE_CXX11_UNORDERED_MAP) - message(STATUS "Checking if compiler supports C++11 unordered_map - yes") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if compiler supports C++11 unordered_map passed with the following output:\n" - "${OUTPUT}\n" - "\n" - ) - else() - message(STATUS "Checking if compiler supports C++11 unordered_map - no") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if compiler supports C++11 unordered_map failed with the following output:\n" - "${OUTPUT}\n" - "\n" - ) - endif() -endif() diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake new file mode 100644 index 000000000..b0ecc4cd2 --- /dev/null +++ b/Source/Checks/cm_cxx_features.cmake @@ -0,0 +1,36 @@ + +function(cm_check_cxx_feature name) + string(TOUPPER ${name} FEATURE) + if(NOT DEFINED CMake_HAVE_CXX_${FEATURE}) + message(STATUS "Checking if compiler supports C++ ${name}") + try_compile(CMake_HAVE_CXX_${FEATURE} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_LIST_DIR}/cm_cxx_${name}.cxx + CMAKE_FLAGS -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} + OUTPUT_VARIABLE OUTPUT + ) + # If using the feature causes warnings, treat it as broken/unavailable. + if(OUTPUT MATCHES "warning") + set(CMake_HAVE_CXX_${FEATURE} OFF CACHE INTERNAL "TRY_COMPILE" FORCE) + endif() + if(CMake_HAVE_CXX_${FEATURE}) + message(STATUS "Checking if compiler supports C++ ${name} - yes") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if compiler supports C++ ${name} passed with the following output:\n" + "${OUTPUT}\n" + "\n" + ) + else() + message(STATUS "Checking if compiler supports C++ ${name} - no") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if compiler supports C++ ${name} failed with the following output:\n" + "${OUTPUT}\n" + "\n" + ) + endif() + endif() +endfunction() + +if(CMAKE_CXX_STANDARD) + cm_check_cxx_feature(unordered_map) +endif() diff --git a/Source/Checks/cm_cxx11_unordered_map.cpp b/Source/Checks/cm_cxx_unordered_map.cxx similarity index 100% rename from Source/Checks/cm_cxx11_unordered_map.cpp rename to Source/Checks/cm_cxx_unordered_map.cxx diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index 938b10ed4..4c5ad2ada 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -29,7 +29,7 @@ #cmakedefine CMAKE_USE_ELF_PARSER #cmakedefine CMAKE_USE_MACH_PARSER #cmakedefine CMAKE_ENCODING_UTF8 -#cmakedefine CMake_HAVE_CXX11_UNORDERED_MAP +#cmakedefine CMake_HAVE_CXX_UNORDERED_MAP #define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@" #define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@" diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 7be0098eb..8f1813c98 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -17,7 +17,7 @@ #include "cmLinkedTree.h" #if defined(CMAKE_BUILD_WITH_CMAKE) -#ifdef CMake_HAVE_CXX11_UNORDERED_MAP +#ifdef CMake_HAVE_CXX_UNORDERED_MAP #include #else #include "cmsys/hash_map.hxx" @@ -92,7 +92,7 @@ private: static Def NoDef; #if defined(CMAKE_BUILD_WITH_CMAKE) -#ifdef CMake_HAVE_CXX11_UNORDERED_MAP +#ifdef CMake_HAVE_CXX_UNORDERED_MAP typedef std::unordered_map MapType; #else typedef cmsys::hash_map MapType; diff --git a/Source/cmFileTimeComparison.cxx b/Source/cmFileTimeComparison.cxx index 7efe1943e..9d6350528 100644 --- a/Source/cmFileTimeComparison.cxx +++ b/Source/cmFileTimeComparison.cxx @@ -13,7 +13,7 @@ // Use a hash table to avoid duplicate file time checks from disk. #if defined(CMAKE_BUILD_WITH_CMAKE) -#ifdef CMake_HAVE_CXX11_UNORDERED_MAP +#ifdef CMake_HAVE_CXX_UNORDERED_MAP #include #else #include @@ -47,13 +47,13 @@ private: { public: size_t operator()(const std::string& s) const { return h(s.c_str()); } -#ifdef CMake_HAVE_CXX11_UNORDERED_MAP +#ifdef CMake_HAVE_CXX_UNORDERED_MAP std::hash h; #else cmsys::hash h; #endif }; -#ifdef CMake_HAVE_CXX11_UNORDERED_MAP +#ifdef CMake_HAVE_CXX_UNORDERED_MAP typedef std::unordered_map #else #include @@ -433,7 +433,7 @@ protected: private: #if defined(CMAKE_BUILD_WITH_CMAKE) -#ifdef CMake_HAVE_CXX11_UNORDERED_MAP +#ifdef CMake_HAVE_CXX_UNORDERED_MAP typedef std::unordered_map TargetMap; typedef std::unordered_map GeneratorTargetMap; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 1680c6aaf..c68cd1c87 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -31,7 +31,7 @@ #include #include #if defined(CMAKE_BUILD_WITH_CMAKE) -#ifdef CMake_HAVE_CXX11_UNORDERED_MAP +#ifdef CMake_HAVE_CXX_UNORDERED_MAP #include #else #include @@ -796,7 +796,7 @@ protected: // libraries, classes, and executables mutable cmTargets Targets; #if defined(CMAKE_BUILD_WITH_CMAKE) -#ifdef CMake_HAVE_CXX11_UNORDERED_MAP +#ifdef CMake_HAVE_CXX_UNORDERED_MAP typedef std::unordered_map TargetMap; #else typedef cmsys::hash_map TargetMap; @@ -915,7 +915,7 @@ private: // A map for fast output to input look up. #if defined(CMAKE_BUILD_WITH_CMAKE) -#ifdef CMake_HAVE_CXX11_UNORDERED_MAP +#ifdef CMake_HAVE_CXX_UNORDERED_MAP typedef std::unordered_map OutputToSourceMap; #else typedef cmsys::hash_map OutputToSourceMap; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index f91e5c68d..9e095c2de 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -21,7 +21,7 @@ #include #if defined(CMAKE_BUILD_WITH_CMAKE) -#ifdef CMake_HAVE_CXX11_UNORDERED_MAP +#ifdef CMake_HAVE_CXX_UNORDERED_MAP #include #else #include @@ -331,7 +331,7 @@ private: }; #ifdef CMAKE_BUILD_WITH_CMAKE -#ifdef CMake_HAVE_CXX11_UNORDERED_MAP +#ifdef CMake_HAVE_CXX_UNORDERED_MAP typedef std::unordered_map cmTargets; #else typedef cmsys::hash_map cmTargets; From 09aa2c94186081267753dedb50acb102717a6577 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 23 Jun 2016 00:29:47 +0200 Subject: [PATCH 2/4] Use where available --- Source/Checks/cm_cxx_features.cmake | 1 + Source/Checks/cm_cxx_unordered_set.cxx | 7 +++++++ Source/cmConfigure.cmake.h.in | 1 + Source/cmGeneratorTarget.cxx | 5 ++++- Source/cmTarget.cxx | 6 +++++- 5 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 Source/Checks/cm_cxx_unordered_set.cxx diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake index b0ecc4cd2..e550e641a 100644 --- a/Source/Checks/cm_cxx_features.cmake +++ b/Source/Checks/cm_cxx_features.cmake @@ -33,4 +33,5 @@ endfunction() if(CMAKE_CXX_STANDARD) cm_check_cxx_feature(unordered_map) + cm_check_cxx_feature(unordered_set) endif() diff --git a/Source/Checks/cm_cxx_unordered_set.cxx b/Source/Checks/cm_cxx_unordered_set.cxx new file mode 100644 index 000000000..de4bb7765 --- /dev/null +++ b/Source/Checks/cm_cxx_unordered_set.cxx @@ -0,0 +1,7 @@ +#include +int main() +{ + std::unordered_set set; + set.insert(0); + return 0; +} diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index 4c5ad2ada..a723942ba 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -30,6 +30,7 @@ #cmakedefine CMAKE_USE_MACH_PARSER #cmakedefine CMAKE_ENCODING_UTF8 #cmakedefine CMake_HAVE_CXX_UNORDERED_MAP +#cmakedefine CMake_HAVE_CXX_UNORDERED_SET #define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@" #define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@" diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 9a025d911..3668c8297 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -27,7 +27,10 @@ #include "assert.h" #include -#if defined(CMAKE_BUILD_WITH_CMAKE) +#if defined(CMake_HAVE_CXX_UNORDERED_SET) +#include +#define UNORDERED_SET std::unordered_set +#elif defined(CMAKE_BUILD_WITH_CMAKE) #include #define UNORDERED_SET cmsys::hash_set #else diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 43860802c..5e5ed2b29 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -27,7 +27,11 @@ #include #include #include // required for atof -#if defined(CMAKE_BUILD_WITH_CMAKE) + +#if defined(CMake_HAVE_CXX_UNORDERED_SET) +#include +#define UNORDERED_SET std::unordered_set +#elif defined(CMAKE_BUILD_WITH_CMAKE) #include #define UNORDERED_SET cmsys::hash_set #else From 5286110d6f106e03ee6c5bdeea48d62674656c9f Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 23 Jun 2016 00:37:10 +0200 Subject: [PATCH 3/4] cxx features: add check for override --- Source/Checks/cm_cxx_features.cmake | 1 + Source/Checks/cm_cxx_override.cxx | 20 ++++++++++++++++++++ Source/cmConfigure.cmake.h.in | 7 +++++++ bootstrap | 1 + 4 files changed, 29 insertions(+) create mode 100644 Source/Checks/cm_cxx_override.cxx diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake index e550e641a..18dbaf8a1 100644 --- a/Source/Checks/cm_cxx_features.cmake +++ b/Source/Checks/cm_cxx_features.cmake @@ -32,6 +32,7 @@ function(cm_check_cxx_feature name) endfunction() if(CMAKE_CXX_STANDARD) + cm_check_cxx_feature(override) cm_check_cxx_feature(unordered_map) cm_check_cxx_feature(unordered_set) endif() diff --git a/Source/Checks/cm_cxx_override.cxx b/Source/Checks/cm_cxx_override.cxx new file mode 100644 index 000000000..9395a0a23 --- /dev/null +++ b/Source/Checks/cm_cxx_override.cxx @@ -0,0 +1,20 @@ +struct Foo +{ + virtual int test() const = 0; +}; + +struct Bar : Foo +{ + int test() const override { return 0; } +}; + +int test(Foo const& foo) +{ + return foo.test(); +} + +int main() +{ + Bar const bar; + return test(bar); +} diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index a723942ba..a8d4f58c6 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -29,9 +29,16 @@ #cmakedefine CMAKE_USE_ELF_PARSER #cmakedefine CMAKE_USE_MACH_PARSER #cmakedefine CMAKE_ENCODING_UTF8 +#cmakedefine CMake_HAVE_CXX_OVERRIDE #cmakedefine CMake_HAVE_CXX_UNORDERED_MAP #cmakedefine CMake_HAVE_CXX_UNORDERED_SET #define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@" #define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@" +#ifdef CMake_HAVE_CXX_OVERRIDE +#define CM_OVERRIDE override +#else +#define CM_OVERRIDE +#endif + #endif diff --git a/bootstrap b/bootstrap index 27cf9d861..a9f340226 100755 --- a/bootstrap +++ b/bootstrap @@ -1272,6 +1272,7 @@ cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_BINARY_DIR \"${CMAKE_ cmake_report cmConfigure.h${_tmp} "#define CMAKE_BIN_DIR \"/bootstrap-not-insalled\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP" +cmake_report cmConfigure.h${_tmp} "#define CM_OVERRIDE" # Regenerate configured headers for h in Configure VersionConfig; do From 7647f6afa46b6b5020cc1d93b3f75d3358a28f8a Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 23 Jun 2016 01:02:39 +0200 Subject: [PATCH 4/4] Add CM_OVERRIDE to some functions Run clang-tidy's modernize-use-override checker. This checker must have issues in version 3.8. It has way too little matches. And it adds override to destructors. Revert the changes on the destructors and change override to CM_OVERRIDE. --- Source/CPack/IFW/cmCPackIFWRepository.cxx | 6 +- Source/CTest/cmCTestBZR.cxx | 22 ++-- Source/CTest/cmCTestCVS.cxx | 4 +- Source/CTest/cmCTestGIT.cxx | 6 +- Source/CTest/cmCTestHG.cxx | 14 +-- Source/CTest/cmCTestMemCheckHandler.cxx | 4 +- Source/CTest/cmCTestP4.cxx | 10 +- Source/CTest/cmCTestSVN.cxx | 18 +-- Source/CTest/cmCTestScriptHandler.cxx | 4 +- Source/CTest/cmCTestSubmitHandler.cxx | 6 +- Source/CTest/cmCTestTestHandler.cxx | 32 +++--- Source/CTest/cmParseCoberturaCoverage.cxx | 6 +- Source/CTest/cmParseJacocoCoverage.cxx | 4 +- Source/cmELF.cxx | 10 +- Source/cmGeneratorExpressionNode.cxx | 130 ++++++++++++---------- Source/cmOrderDirectories.cxx | 8 +- 16 files changed, 146 insertions(+), 138 deletions(-) diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx index b8a10c64a..e4fa569b1 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.cxx +++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx @@ -177,7 +177,7 @@ public: bool patched; protected: - virtual void StartElement(const std::string& name, const char** atts) + void StartElement(const std::string& name, const char** atts) CM_OVERRIDE { xout.StartElement(name); StartFragment(atts); @@ -192,7 +192,7 @@ protected: } } - virtual void EndElement(const std::string& name) + void EndElement(const std::string& name) CM_OVERRIDE { if (name == "Updates" && !patched) { repository->WriteRepositoryUpdates(xout); @@ -208,7 +208,7 @@ protected: } } - virtual void CharacterDataHandler(const char* data, int length) + void CharacterDataHandler(const char* data, int length) CM_OVERRIDE { std::string content(data, data + length); if (content == "" || content == " " || content == " " || diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx index 92eb570f5..5b3f6128a 100644 --- a/Source/CTest/cmCTestBZR.cxx +++ b/Source/CTest/cmCTestBZR.cxx @@ -101,7 +101,7 @@ private: bool CheckOutFound; cmsys::RegularExpression RegexCheckOut; cmsys::RegularExpression RegexParent; - virtual bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexCheckOut.find(this->Line)) { this->BZR->URL = this->RegexCheckOut.match(1); @@ -126,7 +126,7 @@ public: private: std::string& Rev; cmsys::RegularExpression RegexRevno; - virtual bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexRevno.find(this->Line)) { this->Rev = this->RegexRevno.match(1); @@ -185,7 +185,7 @@ public: } ~LogParser() { this->CleanupParser(); } - virtual int InitializeParser() + int InitializeParser() CM_OVERRIDE { int res = cmXMLParser::InitializeParser(); if (res) { @@ -207,14 +207,14 @@ private: cmsys::RegularExpression EmailRegex; - virtual bool ProcessChunk(const char* data, int length) + bool ProcessChunk(const char* data, int length) CM_OVERRIDE { this->OutputLogger::ProcessChunk(data, length); this->ParseChunk(data, length); return true; } - virtual void StartElement(const std::string& name, const char**) + void StartElement(const std::string& name, const char**) CM_OVERRIDE { this->CData.clear(); if (name == "log") { @@ -239,12 +239,12 @@ private: } } - virtual void CharacterDataHandler(const char* data, int length) + void CharacterDataHandler(const char* data, int length) CM_OVERRIDE { this->CData.insert(this->CData.end(), data, data + length); } - virtual void EndElement(const std::string& name) + void EndElement(const std::string& name) CM_OVERRIDE { if (name == "log") { this->BZR->DoRevision(this->Rev, this->Changes); @@ -274,7 +274,7 @@ private: this->CData.clear(); } - virtual void ReportError(int, int, const char* msg) + void ReportError(int, int, const char* msg) CM_OVERRIDE { this->BZR->Log << "Error parsing bzr log xml: " << msg << "\n"; } @@ -294,7 +294,7 @@ private: cmCTestBZR* BZR; cmsys::RegularExpression RegexUpdate; - virtual bool ProcessChunk(const char* first, int length) + bool ProcessChunk(const char* first, int length) CM_OVERRIDE { bool last_is_new_line = (*first == '\r' || *first == '\n'); @@ -325,7 +325,7 @@ private: return true; } - bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexUpdate.find(this->Line)) { this->DoPath(this->RegexUpdate.match(1)[0], @@ -431,7 +431,7 @@ public: private: cmCTestBZR* BZR; cmsys::RegularExpression RegexStatus; - bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexStatus.find(this->Line)) { this->DoPath(this->RegexStatus.match(1)[0], diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx index 5ddafbb9c..df1968504 100644 --- a/Source/CTest/cmCTestCVS.cxx +++ b/Source/CTest/cmCTestCVS.cxx @@ -53,7 +53,7 @@ private: cmsys::RegularExpression RegexFileRemoved1; cmsys::RegularExpression RegexFileRemoved2; - virtual bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexFileUpdated.find(this->Line)) { this->DoFile(PathUpdated, this->RegexFileUpdated.match(2)); @@ -140,7 +140,7 @@ private: SectionType Section; Revision Rev; - virtual bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->Line == ("=======================================" "======================================")) { diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 8b392f29e..36a781e9e 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -52,7 +52,7 @@ public: private: std::string& Line1; - virtual bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { // Only the first line is of interest. this->Line1 = this->Line; @@ -355,7 +355,7 @@ protected: this->Changes.clear(); } - virtual bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->Line[0] == ':') { this->DiffField = DiffFieldChange; @@ -513,7 +513,7 @@ private: person.TimeZone = strtol(c, (char**)&c, 10); } - virtual bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->Line.empty()) { if (this->Section == SectionBody && this->LineEnd == '\0') { diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx index f1fe3774c..9589e057e 100644 --- a/Source/CTest/cmCTestHG.cxx +++ b/Source/CTest/cmCTestHG.cxx @@ -41,7 +41,7 @@ private: std::string& Rev; cmsys::RegularExpression RegexIdentify; - bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexIdentify.find(this->Line)) { this->Rev = this->RegexIdentify.match(1); @@ -65,7 +65,7 @@ private: cmCTestHG* HG; cmsys::RegularExpression RegexStatus; - bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexStatus.find(this->Line)) { this->DoPath(this->RegexStatus.match(1)[0], this->RegexStatus.match(2)); @@ -182,14 +182,14 @@ private: Change CurChange; std::vector CData; - virtual bool ProcessChunk(const char* data, int length) + bool ProcessChunk(const char* data, int length) CM_OVERRIDE { this->OutputLogger::ProcessChunk(data, length); this->ParseChunk(data, length); return true; } - virtual void StartElement(const std::string& name, const char** atts) + void StartElement(const std::string& name, const char** atts) CM_OVERRIDE { this->CData.clear(); if (name == "logentry") { @@ -201,12 +201,12 @@ private: } } - virtual void CharacterDataHandler(const char* data, int length) + void CharacterDataHandler(const char* data, int length) CM_OVERRIDE { this->CData.insert(this->CData.end(), data, data + length); } - virtual void EndElement(const std::string& name) + void EndElement(const std::string& name) CM_OVERRIDE { if (name == "logentry") { this->HG->DoRevision(this->Rev, this->Changes); @@ -261,7 +261,7 @@ private: return output; } - virtual void ReportError(int, int, const char* msg) + void ReportError(int, int, const char* msg) CM_OVERRIDE { this->HG->Log << "Error parsing hg log xml: " << msg << "\n"; } diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 5f70f66df..6f1a2c495 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -61,7 +61,7 @@ public: this->CTest = c; this->SetErrorCallback(xmlReportError, (void*)c); } - void StartElement(const std::string& name, const char** atts) + void StartElement(const std::string& name, const char** atts) CM_OVERRIDE { if (name == "MemoryLeak" || name == "ResourceLeak") { this->Errors.push_back(cmCTestMemCheckHandler::MLK); @@ -78,7 +78,7 @@ public: ostr << "\n"; this->Log += ostr.str(); } - void EndElement(const std::string&) {} + void EndElement(const std::string&) CM_OVERRIDE {} const char* GetAttribute(const char* name, const char** atts) { diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index ede11c990..072da29f7 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -45,7 +45,7 @@ private: std::string& Rev; cmsys::RegularExpression RegexIdentify; - bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexIdentify.find(this->Line)) { this->Rev = this->RegexIdentify.match(1); @@ -69,7 +69,7 @@ private: cmsys::RegularExpression RegexIdentify; cmCTestP4* P4; - bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexIdentify.find(this->Line)) { P4->ChangeLists.push_back(this->RegexIdentify.match(1)); @@ -92,7 +92,7 @@ private: cmsys::RegularExpression RegexUser; cmCTestP4* P4; - bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexUser.find(this->Line)) { User NewUser; @@ -135,7 +135,7 @@ private: std::string CurrentPath; cmsys::RegularExpression RegexDiff; - bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (!this->Line.empty() && this->Line[0] == '=' && this->RegexDiff.find(this->Line)) { @@ -225,7 +225,7 @@ private: SectionType Section; Revision Rev; - virtual bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->Line.empty()) { this->NextSection(); diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index fa014111b..074bd3df7 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -62,7 +62,7 @@ private: cmsys::RegularExpression RegexRev; cmsys::RegularExpression RegexURL; cmsys::RegularExpression RegexRoot; - virtual bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexRev.find(this->Line)) { this->Rev = this->RegexRev.match(1); @@ -206,7 +206,7 @@ private: cmCTestSVN* SVN; cmsys::RegularExpression RegexUpdate; - bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexUpdate.find(this->Line)) { this->DoPath(this->RegexUpdate.match(1)[0], @@ -323,14 +323,14 @@ private: Change CurChange; std::vector CData; - virtual bool ProcessChunk(const char* data, int length) + bool ProcessChunk(const char* data, int length) CM_OVERRIDE { this->OutputLogger::ProcessChunk(data, length); this->ParseChunk(data, length); return true; } - virtual void StartElement(const std::string& name, const char** atts) + void StartElement(const std::string& name, const char** atts) CM_OVERRIDE { this->CData.clear(); if (name == "logentry") { @@ -348,12 +348,12 @@ private: } } - virtual void CharacterDataHandler(const char* data, int length) + void CharacterDataHandler(const char* data, int length) CM_OVERRIDE { this->CData.insert(this->CData.end(), data, data + length); } - virtual void EndElement(const std::string& name) + void EndElement(const std::string& name) CM_OVERRIDE { if (name == "logentry") { this->SVN->DoRevisionSVN(this->Rev, this->Changes); @@ -372,7 +372,7 @@ private: this->CData.clear(); } - virtual void ReportError(int, int, const char* msg) + void ReportError(int, int, const char* msg) CM_OVERRIDE { this->SVN->Log << "Error parsing svn log xml: " << msg << "\n"; } @@ -441,7 +441,7 @@ public: private: cmCTestSVN* SVN; cmsys::RegularExpression RegexStatus; - bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexStatus.find(this->Line)) { this->DoPath(this->RegexStatus.match(1)[0], @@ -506,7 +506,7 @@ public: private: cmCTestSVN* SVN; cmsys::RegularExpression RegexExternal; - bool ProcessLine() + bool ProcessLine() CM_OVERRIDE { if (this->RegexExternal.find(this->Line)) { this->DoPath(this->RegexExternal.match(1)); diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 6389a9db3..028cfdd20 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -60,8 +60,8 @@ class cmCTestScriptFunctionBlocker : public cmFunctionBlocker public: cmCTestScriptFunctionBlocker() {} virtual ~cmCTestScriptFunctionBlocker() {} - virtual bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf, - cmExecutionStatus&); + bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf, + cmExecutionStatus&) CM_OVERRIDE; // virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf); // virtual void ScopeEnded(cmMakefile &mf); diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 69f2ac5b0..85e243f5c 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -69,7 +69,7 @@ private: return val; } - virtual void StartElement(const std::string& name, const char** atts) + void StartElement(const std::string& name, const char** atts) CM_OVERRIDE { this->CurrentValue.clear(); if (name == "cdash") { @@ -77,12 +77,12 @@ private: } } - virtual void CharacterDataHandler(const char* data, int length) + void CharacterDataHandler(const char* data, int length) CM_OVERRIDE { this->CurrentValue.insert(this->CurrentValue.end(), data, data + length); } - virtual void EndElement(const std::string& name) + void EndElement(const std::string& name) CM_OVERRIDE { if (name == "status") { std::string status = cmSystemTools::UpperCase(this->GetCurrentValue()); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index c991a23f4..3ee9c5f97 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -42,7 +42,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmCTestSubdirCommand* c = new cmCTestSubdirCommand; c->TestHandler = this->TestHandler; @@ -53,13 +53,13 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus&); + bool InitialPass(std::vector const& args, + cmExecutionStatus&) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "subdirs"; } + std::string GetName() const CM_OVERRIDE { return "subdirs"; } cmTypeMacro(cmCTestSubdirCommand, cmCommand); @@ -123,7 +123,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmCTestAddSubdirectoryCommand* c = new cmCTestAddSubdirectoryCommand; c->TestHandler = this->TestHandler; @@ -134,13 +134,13 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args, - cmExecutionStatus&); + bool InitialPass(std::vector const& args, + cmExecutionStatus&) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "add_subdirectory"; } + std::string GetName() const CM_OVERRIDE { return "add_subdirectory"; } cmTypeMacro(cmCTestAddSubdirectoryCommand, cmCommand); @@ -197,7 +197,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmCTestAddTestCommand* c = new cmCTestAddTestCommand; c->TestHandler = this->TestHandler; @@ -208,13 +208,13 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const&, - cmExecutionStatus&); + bool InitialPass(std::vector const&, + cmExecutionStatus&) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "add_test"; } + std::string GetName() const CM_OVERRIDE { return "add_test"; } cmTypeMacro(cmCTestAddTestCommand, cmCommand); @@ -237,7 +237,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + cmCommand* Clone() CM_OVERRIDE { cmCTestSetTestsPropertiesCommand* c = new cmCTestSetTestsPropertiesCommand; c->TestHandler = this->TestHandler; @@ -248,13 +248,13 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const&, - cmExecutionStatus&); + bool InitialPass(std::vector const&, + cmExecutionStatus&) CM_OVERRIDE; /** * The name of the command as specified in CMakeList.txt. */ - virtual std::string GetName() const { return "set_tests_properties"; } + std::string GetName() const CM_OVERRIDE { return "set_tests_properties"; } cmTypeMacro(cmCTestSetTestsPropertiesCommand, cmCommand); diff --git a/Source/CTest/cmParseCoberturaCoverage.cxx b/Source/CTest/cmParseCoberturaCoverage.cxx index 3bdae179c..f1c37edcb 100644 --- a/Source/CTest/cmParseCoberturaCoverage.cxx +++ b/Source/CTest/cmParseCoberturaCoverage.cxx @@ -23,7 +23,7 @@ public: virtual ~XMLParser() {} protected: - virtual void EndElement(const std::string& name) + void EndElement(const std::string& name) CM_OVERRIDE { if (name == "source") { this->InSource = false; @@ -34,7 +34,7 @@ protected: } } - virtual void CharacterDataHandler(const char* data, int length) + void CharacterDataHandler(const char* data, int length) CM_OVERRIDE { std::string tmp; tmp.insert(0, data, length); @@ -46,7 +46,7 @@ protected: } } - virtual void StartElement(const std::string& name, const char** atts) + void StartElement(const std::string& name, const char** atts) CM_OVERRIDE { std::string FoundSource; std::string finalpath = ""; diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx index e456f39f9..27ccf5832 100644 --- a/Source/CTest/cmParseJacocoCoverage.cxx +++ b/Source/CTest/cmParseJacocoCoverage.cxx @@ -23,9 +23,9 @@ public: virtual ~XMLParser() {} protected: - virtual void EndElement(const std::string&) {} + void EndElement(const std::string&) CM_OVERRIDE {} - virtual void StartElement(const std::string& name, const char** atts) + void StartElement(const std::string& name, const char** atts) CM_OVERRIDE { if (name == "package") { this->PackageName = atts[1]; diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index c7f8a2d62..16294ea46 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -241,20 +241,20 @@ public: ByteOrderType order); // Return the number of sections as specified by the ELF header. - virtual unsigned int GetNumberOfSections() const + unsigned int GetNumberOfSections() const CM_OVERRIDE { return static_cast(this->ELFHeader.e_shnum); } // Get the file position and size of a dynamic section entry. - virtual unsigned int GetDynamicEntryCount(); - virtual unsigned long GetDynamicEntryPosition(int j); + unsigned int GetDynamicEntryCount() CM_OVERRIDE; + unsigned long GetDynamicEntryPosition(int j) CM_OVERRIDE; // Lookup a string from the dynamic section with the given tag. - virtual StringEntry const* GetDynamicSectionString(unsigned int tag); + StringEntry const* GetDynamicSectionString(unsigned int tag) CM_OVERRIDE; // Print information about the ELF file. - virtual void PrintInfo(std::ostream& os) const + void PrintInfo(std::ostream& os) const CM_OVERRIDE { os << "ELF " << Types::GetName(); if (this->ByteOrder == ByteOrderMSB) { diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index e750551b2..599ea8d3a 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -42,14 +42,14 @@ static const struct ZeroNode : public cmGeneratorExpressionNode { ZeroNode() {} - virtual bool GeneratesContent() const { return false; } + bool GeneratesContent() const CM_OVERRIDE { return false; } - virtual bool AcceptsArbitraryContentParameter() const { return true; } + bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } std::string Evaluate(const std::vector&, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return std::string(); } @@ -59,12 +59,12 @@ static const struct OneNode : public cmGeneratorExpressionNode { OneNode() {} - virtual bool AcceptsArbitraryContentParameter() const { return true; } + bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return parameters.front(); } @@ -113,7 +113,7 @@ static const struct NotNode : public cmGeneratorExpressionNode std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { if (*parameters.begin() != "0" && *parameters.begin() != "1") { reportError( @@ -129,12 +129,12 @@ static const struct BoolNode : public cmGeneratorExpressionNode { BoolNode() {} - virtual int NumExpectedParameters() const { return 1; } + int NumExpectedParameters() const CM_OVERRIDE { return 1; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return !cmSystemTools::IsOff(parameters.begin()->c_str()) ? "1" : "0"; } @@ -144,12 +144,12 @@ static const struct StrEqualNode : public cmGeneratorExpressionNode { StrEqualNode() {} - virtual int NumExpectedParameters() const { return 2; } + int NumExpectedParameters() const CM_OVERRIDE { return 2; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return *parameters.begin() == parameters[1] ? "1" : "0"; } @@ -159,12 +159,12 @@ static const struct EqualNode : public cmGeneratorExpressionNode { EqualNode() {} - virtual int NumExpectedParameters() const { return 2; } + int NumExpectedParameters() const CM_OVERRIDE { return 2; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { char* pEnd; @@ -236,12 +236,12 @@ static const struct LowerCaseNode : public cmGeneratorExpressionNode { LowerCaseNode() {} - bool AcceptsArbitraryContentParameter() const { return true; } + bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return cmSystemTools::LowerCase(parameters.front()); } @@ -251,12 +251,12 @@ static const struct UpperCaseNode : public cmGeneratorExpressionNode { UpperCaseNode() {} - bool AcceptsArbitraryContentParameter() const { return true; } + bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return cmSystemTools::UpperCase(parameters.front()); } @@ -266,12 +266,12 @@ static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode { MakeCIdentifierNode() {} - bool AcceptsArbitraryContentParameter() const { return true; } + bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return cmSystemTools::MakeCidentifier(parameters.front()); } @@ -281,12 +281,12 @@ static const struct Angle_RNode : public cmGeneratorExpressionNode { Angle_RNode() {} - virtual int NumExpectedParameters() const { return 0; } + int NumExpectedParameters() const CM_OVERRIDE { return 0; } std::string Evaluate(const std::vector&, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return ">"; } @@ -296,12 +296,12 @@ static const struct CommaNode : public cmGeneratorExpressionNode { CommaNode() {} - virtual int NumExpectedParameters() const { return 0; } + int NumExpectedParameters() const CM_OVERRIDE { return 0; } std::string Evaluate(const std::vector&, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return ","; } @@ -311,12 +311,12 @@ static const struct SemicolonNode : public cmGeneratorExpressionNode { SemicolonNode() {} - virtual int NumExpectedParameters() const { return 0; } + int NumExpectedParameters() const CM_OVERRIDE { return 0; } std::string Evaluate(const std::vector&, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return ";"; } @@ -326,7 +326,7 @@ struct CompilerIdNode : public cmGeneratorExpressionNode { CompilerIdNode() {} - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } + int NumExpectedParameters() const CM_OVERRIDE { return OneOrZeroParameters; } std::string EvaluateWithLanguage(const std::vector& parameters, cmGeneratorExpressionContext* context, @@ -381,6 +381,7 @@ static const struct CCompilerIdNode : public CompilerIdNode cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* dagChecker) const + CM_OVERRIDE { if (!context->HeadTarget) { reportError( @@ -402,6 +403,7 @@ static const struct CXXCompilerIdNode : public CompilerIdNode cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* dagChecker) const + CM_OVERRIDE { if (!context->HeadTarget) { reportError( @@ -419,7 +421,7 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode { CompilerVersionNode() {} - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } + int NumExpectedParameters() const CM_OVERRIDE { return OneOrZeroParameters; } std::string EvaluateWithLanguage(const std::vector& parameters, cmGeneratorExpressionContext* context, @@ -460,6 +462,7 @@ static const struct CCompilerVersionNode : public CompilerVersionNode cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* dagChecker) const + CM_OVERRIDE { if (!context->HeadTarget) { reportError( @@ -481,6 +484,7 @@ static const struct CxxCompilerVersionNode : public CompilerVersionNode cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* dagChecker) const + CM_OVERRIDE { if (!context->HeadTarget) { reportError( @@ -498,12 +502,12 @@ struct PlatformIdNode : public cmGeneratorExpressionNode { PlatformIdNode() {} - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } + int NumExpectedParameters() const CM_OVERRIDE { return OneOrZeroParameters; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { const char* platformId = context->LG->GetMakefile()->GetSafeDefinition("CMAKE_SYSTEM_NAME"); @@ -526,12 +530,12 @@ static const struct VersionGreaterNode : public cmGeneratorExpressionNode { VersionGreaterNode() {} - virtual int NumExpectedParameters() const { return 2; } + int NumExpectedParameters() const CM_OVERRIDE { return 2; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER, parameters.front().c_str(), @@ -545,12 +549,12 @@ static const struct VersionLessNode : public cmGeneratorExpressionNode { VersionLessNode() {} - virtual int NumExpectedParameters() const { return 2; } + int NumExpectedParameters() const CM_OVERRIDE { return 2; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, parameters.front().c_str(), @@ -564,12 +568,12 @@ static const struct VersionEqualNode : public cmGeneratorExpressionNode { VersionEqualNode() {} - virtual int NumExpectedParameters() const { return 2; } + int NumExpectedParameters() const CM_OVERRIDE { return 2; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, parameters.front().c_str(), @@ -583,10 +587,10 @@ static const struct LinkOnlyNode : public cmGeneratorExpressionNode { LinkOnlyNode() {} - std::string Evaluate(const std::vector& parameters, - cmGeneratorExpressionContext*, - const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker* dagChecker) const + std::string Evaluate( + const std::vector& parameters, cmGeneratorExpressionContext*, + const GeneratorExpressionContent*, + cmGeneratorExpressionDAGChecker* dagChecker) const CM_OVERRIDE { if (!dagChecker->GetTransitivePropertiesOnly()) { return parameters.front(); @@ -599,12 +603,12 @@ static const struct ConfigurationNode : public cmGeneratorExpressionNode { ConfigurationNode() {} - virtual int NumExpectedParameters() const { return 0; } + int NumExpectedParameters() const CM_OVERRIDE { return 0; } std::string Evaluate(const std::vector&, cmGeneratorExpressionContext* context, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { context->HadContextSensitiveCondition = true; return context->Config; @@ -615,12 +619,12 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode { ConfigurationTestNode() {} - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } + int NumExpectedParameters() const CM_OVERRIDE { return OneOrZeroParameters; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { if (parameters.empty()) { return configurationNode.Evaluate(parameters, context, content, 0); @@ -673,14 +677,14 @@ static const struct JoinNode : public cmGeneratorExpressionNode { JoinNode() {} - virtual int NumExpectedParameters() const { return 2; } + int NumExpectedParameters() const CM_OVERRIDE { return 2; } - virtual bool AcceptsArbitraryContentParameter() const { return true; } + bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { std::vector list; cmSystemTools::ExpandListArgument(parameters.front(), list); @@ -692,12 +696,13 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode { CompileLanguageNode() {} - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } + int NumExpectedParameters() const CM_OVERRIDE { return OneOrZeroParameters; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* dagChecker) const + CM_OVERRIDE { if (context->Language.empty()) { reportError( @@ -795,12 +800,13 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode TargetPropertyNode() {} // This node handles errors on parameter count itself. - virtual int NumExpectedParameters() const { return OneOrMoreParameters; } + int NumExpectedParameters() const CM_OVERRIDE { return OneOrMoreParameters; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* dagCheckerParent) const + CM_OVERRIDE { if (parameters.size() != 1 && parameters.size() != 2) { reportError( @@ -1087,20 +1093,20 @@ static const struct TargetNameNode : public cmGeneratorExpressionNode { TargetNameNode() {} - virtual bool GeneratesContent() const { return true; } + bool GeneratesContent() const CM_OVERRIDE { return true; } - virtual bool AcceptsArbitraryContentParameter() const { return true; } - virtual bool RequiresLiteralInput() const { return true; } + bool AcceptsArbitraryContentParameter() const CM_OVERRIDE { return true; } + bool RequiresLiteralInput() const CM_OVERRIDE { return true; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext*, const GeneratorExpressionContent*, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { return parameters.front(); } - virtual int NumExpectedParameters() const { return 1; } + int NumExpectedParameters() const CM_OVERRIDE { return 1; } } targetNameNode; @@ -1111,7 +1117,7 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { if (!context->EvaluateForBuildsystem) { std::ostringstream e; @@ -1179,12 +1185,13 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode { CompileFeaturesNode() {} - virtual int NumExpectedParameters() const { return OneOrMoreParameters; } + int NumExpectedParameters() const CM_OVERRIDE { return OneOrMoreParameters; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* dagChecker) const + CM_OVERRIDE { cmGeneratorTarget const* target = context->HeadTarget; if (!target) { @@ -1306,12 +1313,12 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode { TargetPolicyNode() {} - virtual int NumExpectedParameters() const { return 1; } + int NumExpectedParameters() const CM_OVERRIDE { return 1; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { if (!context->HeadTarget) { reportError( @@ -1365,13 +1372,13 @@ static const struct InstallPrefixNode : public cmGeneratorExpressionNode { InstallPrefixNode() {} - virtual bool GeneratesContent() const { return true; } - virtual int NumExpectedParameters() const { return 0; } + bool GeneratesContent() const CM_OVERRIDE { return true; } + int NumExpectedParameters() const CM_OVERRIDE { return 0; } std::string Evaluate(const std::vector&, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { reportError(context, content->GetOriginalExpression(), "INSTALL_PREFIX is a marker for install(EXPORT) only. It " @@ -1529,12 +1536,13 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode { TargetFilesystemArtifact() {} - virtual int NumExpectedParameters() const { return 1; } + int NumExpectedParameters() const CM_OVERRIDE { return 1; } std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* dagChecker) const + CM_OVERRIDE { // Lookup the referenced target. std::string name = *parameters.begin(); @@ -1606,7 +1614,7 @@ static const struct ShellPathNode : public cmGeneratorExpressionNode std::string Evaluate(const std::vector& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker*) const + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE { if (!cmSystemTools::FileIsFullPath(parameters.front())) { reportError(context, content->GetOriginalExpression(), diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx index 00606c796..20f224610 100644 --- a/Source/cmOrderDirectories.cxx +++ b/Source/cmOrderDirectories.cxx @@ -157,7 +157,7 @@ public: } } - virtual void Report(std::ostream& e) + void Report(std::ostream& e) CM_OVERRIDE { e << "runtime library ["; if (this->SOName.empty()) { @@ -168,7 +168,7 @@ public: e << "]"; } - virtual bool FindConflict(std::string const& dir); + bool FindConflict(std::string const& dir) CM_OVERRIDE; private: // The soname of the shared library if it is known. @@ -212,12 +212,12 @@ public: { } - virtual void Report(std::ostream& e) + void Report(std::ostream& e) CM_OVERRIDE { e << "link library [" << this->FileName << "]"; } - virtual bool FindConflict(std::string const& dir); + bool FindConflict(std::string const& dir) CM_OVERRIDE; }; bool cmOrderDirectoriesConstraintLibrary::FindConflict(std::string const& dir)