diff options
author | Brad King <brad.king@kitware.com> | 2019-02-19 12:56:20 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-02-19 12:56:41 (GMT) |
commit | 2bff8513f22ae02d1559851d0eb814083d015a2e (patch) | |
tree | 4fe58a01edfb6a846f1679bbfa86c5703ece47fa /Source/cmake.cxx | |
parent | 9cab31cc79b9c19f2a5121a392a3498d06e25723 (diff) | |
parent | 706b93fa558c5a2e0e45a7068b5039d1f40fbc90 (diff) | |
download | CMake-2bff8513f22ae02d1559851d0eb814083d015a2e.zip CMake-2bff8513f22ae02d1559851d0eb814083d015a2e.tar.gz CMake-2bff8513f22ae02d1559851d0eb814083d015a2e.tar.bz2 |
Merge topic 'modernize-for-loops-c-arrays'
706b93fa55 Modernize: C-arrays and loops over them
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2951
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index dd29c0c..ab783c7 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -99,6 +99,7 @@ #include "cmsys/RegularExpression.hxx" #include <algorithm> #include <cstring> +#include <initializer_list> #include <iostream> #include <iterator> #include <memory> // IWYU pragma: keep @@ -1892,11 +1893,10 @@ bool cmake::LoadCache(const std::string& path, bool internal, std::set<std::string>& includes) { bool result = this->State->LoadCache(path, internal, excludes, includes); - static const char* entries[] = { "CMAKE_CACHE_MAJOR_VERSION", - "CMAKE_CACHE_MINOR_VERSION" }; - for (const char* const* nameIt = cm::cbegin(entries); - nameIt != cm::cend(entries); ++nameIt) { - this->UnwatchUnusedCli(*nameIt); + static const auto entries = { "CMAKE_CACHE_MAJOR_VERSION", + "CMAKE_CACHE_MINOR_VERSION" }; + for (auto const& entry : entries) { + this->UnwatchUnusedCli(entry); } return result; } @@ -1904,13 +1904,12 @@ bool cmake::LoadCache(const std::string& path, bool internal, bool cmake::SaveCache(const std::string& path) { bool result = this->State->SaveCache(path, this->GetMessenger()); - static const char* entries[] = { "CMAKE_CACHE_MAJOR_VERSION", - "CMAKE_CACHE_MINOR_VERSION", - "CMAKE_CACHE_PATCH_VERSION", - "CMAKE_CACHEFILE_DIR" }; - for (const char* const* nameIt = cm::cbegin(entries); - nameIt != cm::cend(entries); ++nameIt) { - this->UnwatchUnusedCli(*nameIt); + static const auto entries = { "CMAKE_CACHE_MAJOR_VERSION", + "CMAKE_CACHE_MINOR_VERSION", + "CMAKE_CACHE_PATCH_VERSION", + "CMAKE_CACHEFILE_DIR" }; + for (auto const& entry : entries) { + this->UnwatchUnusedCli(entry); } return result; } |