From 66bfe14309e9e8968a159d1eda7ed00322d5559d Mon Sep 17 00:00:00 2001 From: friendlyanon Date: Thu, 30 Jun 2022 20:27:42 +0200 Subject: cmMakefile: Refactor parameter and variable names for EnableLanguage In commit 731369ef9c (ENH: try to initialize all languages at the same time, 2004-08-27, v2.4.0~2899) the languages parameter name for cmMakefile::EnableLanguage() was changed to "std::vector languages" in the declaration, however the definition had "std::vector lang". Furthermore, the variable names in the definition had confusing names, such as the "i" variable in the loop which referred to an iterator at one point, but no longer does. --- Source/cmMakefile.cxx | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 62ea427..79a56c1 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3479,7 +3479,7 @@ void cmMakefile::AddTargetObject(std::string const& tgtName, #endif } -void cmMakefile::EnableLanguage(std::vector const& lang, +void cmMakefile::EnableLanguage(std::vector const& languages, bool optional) { if (this->DeferRunning) { @@ -3494,21 +3494,23 @@ void cmMakefile::EnableLanguage(std::vector const& lang, // If RC is explicitly listed we need to do it after other languages. // On some platforms we enable RC implicitly while enabling others. // Do not let that look like recursive enable_language(RC). - std::vector langs; - std::vector langsRC; - langs.reserve(lang.size()); - for (std::string const& i : lang) { - if (i == "RC") { - langsRC.push_back(i); + std::vector languages_without_RC; + std::vector languages_for_RC; + languages_without_RC.reserve(languages.size()); + for (std::string const& language : languages) { + if (language == "RC") { + languages_for_RC.push_back(language); } else { - langs.push_back(i); + languages_without_RC.push_back(language); } } - if (!langs.empty()) { - this->GetGlobalGenerator()->EnableLanguage(langs, this, optional); + if (!languages_without_RC.empty()) { + this->GetGlobalGenerator()->EnableLanguage(languages_without_RC, this, + optional); } - if (!langsRC.empty()) { - this->GetGlobalGenerator()->EnableLanguage(langsRC, this, optional); + if (!languages_for_RC.empty()) { + this->GetGlobalGenerator()->EnableLanguage(languages_for_RC, this, + optional); } } -- cgit v0.12