cmStandardLevelResolver.cxx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include "cmStandardLevelResolver.h"
  4. #include <algorithm>
  5. #include <cassert>
  6. #include <cstddef>
  7. #include <sstream>
  8. #include <stdexcept>
  9. #include <unordered_map>
  10. #include <utility>
  11. #include <vector>
  12. #include <cm/iterator>
  13. #include <cmext/algorithm>
  14. #include "cmGeneratorExpression.h"
  15. #include "cmGeneratorTarget.h"
  16. #include "cmGlobalGenerator.h"
  17. #include "cmMakefile.h"
  18. #include "cmMessageType.h"
  19. #include "cmPolicies.h"
  20. #include "cmStringAlgorithms.h"
  21. #include "cmTarget.h"
  22. #include "cmValue.h"
  23. #include "cmake.h"
  24. namespace {
  25. #define FEATURE_STRING(F) , #F
  26. const char* const C_FEATURES[] = { nullptr FOR_EACH_C_FEATURE(
  27. FEATURE_STRING) };
  28. const char* const CXX_FEATURES[] = { nullptr FOR_EACH_CXX_FEATURE(
  29. FEATURE_STRING) };
  30. const char* const CUDA_FEATURES[] = { nullptr FOR_EACH_CUDA_FEATURE(
  31. FEATURE_STRING) };
  32. const char* const HIP_FEATURES[] = { nullptr FOR_EACH_HIP_FEATURE(
  33. FEATURE_STRING) };
  34. #undef FEATURE_STRING
  35. struct StandardNeeded
  36. {
  37. int index;
  38. int value;
  39. };
  40. int ParseStd(std::string const& level)
  41. {
  42. try {
  43. return std::stoi(level);
  44. } catch (std::invalid_argument&) {
  45. // Fall through to use an invalid value.
  46. }
  47. return -1;
  48. }
  49. struct StandardLevelComputer
  50. {
  51. explicit StandardLevelComputer(std::string lang, std::vector<int> levels,
  52. std::vector<std::string> levelsStr)
  53. : Language(std::move(lang))
  54. , Levels(std::move(levels))
  55. , LevelsAsStrings(std::move(levelsStr))
  56. {
  57. assert(this->Levels.size() == this->LevelsAsStrings.size());
  58. }
  59. std::string GetCompileOptionDef(cmMakefile* makefile,
  60. cmGeneratorTarget const* target,
  61. std::string const& config) const
  62. {
  63. const auto& stds = this->Levels;
  64. const auto& stdsStrings = this->LevelsAsStrings;
  65. cmValue defaultStd = makefile->GetDefinition(
  66. cmStrCat("CMAKE_", this->Language, "_STANDARD_DEFAULT"));
  67. if (!cmNonempty(defaultStd)) {
  68. // this compiler has no notion of language standard levels
  69. return std::string{};
  70. }
  71. cmPolicies::PolicyStatus const cmp0128{ makefile->GetPolicyStatus(
  72. cmPolicies::CMP0128) };
  73. bool const defaultExt{ cmIsOn(*makefile->GetDefinition(
  74. cmStrCat("CMAKE_", this->Language, "_EXTENSIONS_DEFAULT"))) };
  75. bool ext = true;
  76. if (cmp0128 == cmPolicies::NEW) {
  77. ext = defaultExt;
  78. }
  79. if (cmValue extPropValue = target->GetLanguageExtensions(this->Language)) {
  80. ext = cmIsOn(*extPropValue);
  81. }
  82. std::string const type{ ext ? "EXTENSION" : "STANDARD" };
  83. cmValue standardProp = target->GetLanguageStandard(this->Language, config);
  84. if (!standardProp) {
  85. if (cmp0128 == cmPolicies::NEW) {
  86. // Add extension flag if compiler's default doesn't match.
  87. if (ext != defaultExt) {
  88. return cmStrCat("CMAKE_", this->Language, *defaultStd, "_", type,
  89. "_COMPILE_OPTION");
  90. }
  91. } else {
  92. if (cmp0128 == cmPolicies::WARN &&
  93. makefile->PolicyOptionalWarningEnabled(
  94. "CMAKE_POLICY_WARNING_CMP0128") &&
  95. ext != defaultExt) {
  96. const char* state{};
  97. if (ext) {
  98. if (!makefile->GetDefinition(cmStrCat(
  99. "CMAKE_", this->Language, "_EXTENSION_COMPILE_OPTION"))) {
  100. state = "enabled";
  101. }
  102. } else {
  103. state = "disabled";
  104. }
  105. if (state) {
  106. makefile->IssueMessage(
  107. MessageType::AUTHOR_WARNING,
  108. cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0128),
  109. "\nFor compatibility with older versions of CMake, "
  110. "compiler extensions won't be ",
  111. state, "."));
  112. }
  113. }
  114. if (ext) {
  115. return cmStrCat("CMAKE_", this->Language,
  116. "_EXTENSION_COMPILE_OPTION");
  117. }
  118. }
  119. return std::string{};
  120. }
  121. if (target->GetLanguageStandardRequired(this->Language)) {
  122. std::string option_flag = cmStrCat(
  123. "CMAKE_", this->Language, *standardProp, "_", type, "_COMPILE_OPTION");
  124. cmValue opt = target->Target->GetMakefile()->GetDefinition(option_flag);
  125. if (!opt) {
  126. std::ostringstream e;
  127. e << "Target \"" << target->GetName()
  128. << "\" requires the language "
  129. "dialect \""
  130. << this->Language << *standardProp << "\" "
  131. << (ext ? "(with compiler extensions)" : "")
  132. << ", but CMake "
  133. "does not know the compile flags to use to enable it.";
  134. makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
  135. }
  136. return option_flag;
  137. }
  138. // If the request matches the compiler's defaults we don't need to add
  139. // anything.
  140. if (*standardProp == *defaultStd && ext == defaultExt) {
  141. if (cmp0128 == cmPolicies::NEW) {
  142. return std::string{};
  143. }
  144. if (cmp0128 == cmPolicies::WARN &&
  145. makefile->PolicyOptionalWarningEnabled(
  146. "CMAKE_POLICY_WARNING_CMP0128")) {
  147. makefile->IssueMessage(
  148. MessageType::AUTHOR_WARNING,
  149. cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0128),
  150. "\nFor compatibility with older versions of CMake, "
  151. "unnecessary flags for language standard or compiler "
  152. "extensions may be added."));
  153. }
  154. }
  155. std::string standardStr(*standardProp);
  156. if (this->Language == "CUDA" && standardStr == "98") {
  157. standardStr = "03";
  158. }
  159. auto stdIt =
  160. std::find(cm::cbegin(stds), cm::cend(stds), ParseStd(standardStr));
  161. if (stdIt == cm::cend(stds)) {
  162. std::string e =
  163. cmStrCat(this->Language, "_STANDARD is set to invalid value '",
  164. standardStr, "'");
  165. makefile->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, e,
  166. target->GetBacktrace());
  167. return std::string{};
  168. }
  169. auto defaultStdIt =
  170. std::find(cm::cbegin(stds), cm::cend(stds), ParseStd(*defaultStd));
  171. if (defaultStdIt == cm::cend(stds)) {
  172. std::string e = cmStrCat("CMAKE_", this->Language,
  173. "_STANDARD_DEFAULT is set to invalid value '",
  174. *defaultStd, "'");
  175. makefile->IssueMessage(MessageType::INTERNAL_ERROR, e);
  176. return std::string{};
  177. }
  178. // If the standard requested is older than the compiler's default or the
  179. // extension mode doesn't match then we need to use a flag.
  180. if (stdIt < defaultStdIt) {
  181. auto offset = std::distance(cm::cbegin(stds), stdIt);
  182. return cmStrCat("CMAKE_", this->Language, stdsStrings[offset], "_", type,
  183. "_COMPILE_OPTION");
  184. }
  185. // The compiler's default is at least as new as the requested standard,
  186. // and the requested standard is not required. Decay to the newest
  187. // standard for which a flag is defined.
  188. for (; defaultStdIt < stdIt; --stdIt) {
  189. auto offset = std::distance(cm::cbegin(stds), stdIt);
  190. std::string option_flag =
  191. cmStrCat("CMAKE_", this->Language, stdsStrings[offset], "_", type,
  192. "_COMPILE_OPTION");
  193. if (target->Target->GetMakefile()->GetDefinition(option_flag)) {
  194. return option_flag;
  195. }
  196. }
  197. return std::string{};
  198. }
  199. bool GetNewRequiredStandard(cmMakefile* makefile,
  200. std::string const& targetName,
  201. const std::string& feature,
  202. cmValue currentLangStandardValue,
  203. std::string& newRequiredStandard,
  204. std::string* error) const
  205. {
  206. if (currentLangStandardValue) {
  207. newRequiredStandard = *currentLangStandardValue;
  208. } else {
  209. newRequiredStandard.clear();
  210. }
  211. auto needed = this->HighestStandardNeeded(makefile, feature);
  212. cmValue existingStandard = currentLangStandardValue;
  213. if (!existingStandard) {
  214. cmValue defaultStandard = makefile->GetDefinition(
  215. cmStrCat("CMAKE_", this->Language, "_STANDARD_DEFAULT"));
  216. if (cmNonempty(defaultStandard)) {
  217. existingStandard = defaultStandard;
  218. }
  219. }
  220. auto existingLevelIter = cm::cend(this->Levels);
  221. if (existingStandard) {
  222. existingLevelIter =
  223. std::find(cm::cbegin(this->Levels), cm::cend(this->Levels),
  224. ParseStd(*existingStandard));
  225. if (existingLevelIter == cm::cend(this->Levels)) {
  226. const std::string e =
  227. cmStrCat("The ", this->Language, "_STANDARD property on target \"",
  228. targetName, "\" contained an invalid value: \"",
  229. *existingStandard, "\".");
  230. if (error) {
  231. *error = e;
  232. } else {
  233. makefile->IssueMessage(MessageType::FATAL_ERROR, e);
  234. }
  235. return false;
  236. }
  237. }
  238. if (needed.index != -1) {
  239. // Ensure the C++ language level is high enough to support
  240. // the needed C++ features.
  241. if (existingLevelIter == cm::cend(this->Levels) ||
  242. existingLevelIter < this->Levels.begin() + needed.index) {
  243. newRequiredStandard = this->LevelsAsStrings[needed.index];
  244. }
  245. }
  246. return true;
  247. }
  248. bool HaveStandardAvailable(cmMakefile* makefile,
  249. cmGeneratorTarget const* target,
  250. std::string const& config,
  251. std::string const& feature) const
  252. {
  253. cmValue defaultStandard = makefile->GetDefinition(
  254. cmStrCat("CMAKE_", this->Language, "_STANDARD_DEFAULT"));
  255. if (!defaultStandard) {
  256. makefile->IssueMessage(
  257. MessageType::INTERNAL_ERROR,
  258. cmStrCat("CMAKE_", this->Language,
  259. "_STANDARD_DEFAULT is not set. COMPILE_FEATURES support "
  260. "not fully configured for this compiler."));
  261. // Return true so the caller does not try to lookup the default standard.
  262. return true;
  263. }
  264. // convert defaultStandard to an integer
  265. if (std::find(cm::cbegin(this->Levels), cm::cend(this->Levels),
  266. ParseStd(*defaultStandard)) == cm::cend(this->Levels)) {
  267. const std::string e = cmStrCat("The CMAKE_", this->Language,
  268. "_STANDARD_DEFAULT variable contains an "
  269. "invalid value: \"",
  270. *defaultStandard, "\".");
  271. makefile->IssueMessage(MessageType::INTERNAL_ERROR, e);
  272. return false;
  273. }
  274. cmValue existingStandard =
  275. target->GetLanguageStandard(this->Language, config);
  276. if (!existingStandard) {
  277. existingStandard = defaultStandard;
  278. }
  279. auto existingLevelIter =
  280. std::find(cm::cbegin(this->Levels), cm::cend(this->Levels),
  281. ParseStd(*existingStandard));
  282. if (existingLevelIter == cm::cend(this->Levels)) {
  283. const std::string e =
  284. cmStrCat("The ", this->Language, "_STANDARD property on target \"",
  285. target->GetName(), "\" contained an invalid value: \"",
  286. *existingStandard, "\".");
  287. makefile->IssueMessage(MessageType::FATAL_ERROR, e);
  288. return false;
  289. }
  290. auto needed = this->HighestStandardNeeded(makefile, feature);
  291. return (needed.index == -1) ||
  292. (this->Levels.begin() + needed.index) <= existingLevelIter;
  293. }
  294. StandardNeeded HighestStandardNeeded(cmMakefile* makefile,
  295. std::string const& feature) const
  296. {
  297. std::string prefix = cmStrCat("CMAKE_", this->Language);
  298. StandardNeeded maxLevel = { -1, -1 };
  299. for (size_t i = 0; i < this->Levels.size(); ++i) {
  300. if (cmValue prop = makefile->GetDefinition(
  301. cmStrCat(prefix, this->LevelsAsStrings[i], "_COMPILE_FEATURES"))) {
  302. std::vector<std::string> props = cmExpandedList(*prop);
  303. if (cm::contains(props, feature)) {
  304. maxLevel = { static_cast<int>(i), this->Levels[i] };
  305. }
  306. }
  307. }
  308. return maxLevel;
  309. }
  310. bool IsLaterStandard(int lhs, int rhs) const
  311. {
  312. auto rhsIt =
  313. std::find(cm::cbegin(this->Levels), cm::cend(this->Levels), rhs);
  314. return std::find(rhsIt, cm::cend(this->Levels), lhs) !=
  315. cm::cend(this->Levels);
  316. }
  317. std::string Language;
  318. std::vector<int> Levels;
  319. std::vector<std::string> LevelsAsStrings;
  320. };
  321. std::unordered_map<std::string, StandardLevelComputer>
  322. StandardComputerMapping = {
  323. { "C",
  324. StandardLevelComputer{
  325. "C", std::vector<int>{ 90, 99, 11, 17, 23 },
  326. std::vector<std::string>{ "90", "99", "11", "17", "23" } } },
  327. { "CXX",
  328. StandardLevelComputer{
  329. "CXX", std::vector<int>{ 98, 11, 14, 17, 20, 23 },
  330. std::vector<std::string>{ "98", "11", "14", "17", "20", "23" } } },
  331. { "CUDA",
  332. StandardLevelComputer{
  333. "CUDA", std::vector<int>{ 03, 11, 14, 17, 20, 23 },
  334. std::vector<std::string>{ "03", "11", "14", "17", "20", "23" } } },
  335. { "OBJC",
  336. StandardLevelComputer{
  337. "OBJC", std::vector<int>{ 90, 99, 11, 17, 23 },
  338. std::vector<std::string>{ "90", "99", "11", "17", "23" } } },
  339. { "OBJCXX",
  340. StandardLevelComputer{
  341. "OBJCXX", std::vector<int>{ 98, 11, 14, 17, 20, 23 },
  342. std::vector<std::string>{ "98", "11", "14", "17", "20", "23" } } },
  343. { "HIP",
  344. StandardLevelComputer{
  345. "HIP", std::vector<int>{ 98, 11, 14, 17, 20, 23 },
  346. std::vector<std::string>{ "98", "11", "14", "17", "20", "23" } } }
  347. };
  348. }
  349. std::string cmStandardLevelResolver::GetCompileOptionDef(
  350. cmGeneratorTarget const* target, std::string const& lang,
  351. std::string const& config) const
  352. {
  353. const auto& mapping = StandardComputerMapping.find(lang);
  354. if (mapping == cm::cend(StandardComputerMapping)) {
  355. return std::string{};
  356. }
  357. return mapping->second.GetCompileOptionDef(this->Makefile, target, config);
  358. }
  359. bool cmStandardLevelResolver::AddRequiredTargetFeature(
  360. cmTarget* target, const std::string& feature, std::string* error) const
  361. {
  362. if (cmGeneratorExpression::Find(feature) != std::string::npos) {
  363. target->AppendProperty("COMPILE_FEATURES", feature);
  364. return true;
  365. }
  366. std::string lang;
  367. if (!this->CheckCompileFeaturesAvailable(target->GetName(), feature, lang,
  368. error)) {
  369. return false;
  370. }
  371. target->AppendProperty("COMPILE_FEATURES", feature);
  372. // FIXME: Add a policy to avoid updating the <LANG>_STANDARD target
  373. // property due to COMPILE_FEATURES. The language standard selection
  374. // should be done purely at generate time based on whatever the project
  375. // code put in these properties explicitly. That is mostly true now,
  376. // but for compatibility we need to continue updating the property here.
  377. std::string newRequiredStandard;
  378. bool newRequired = this->GetNewRequiredStandard(
  379. target->GetName(), feature,
  380. target->GetProperty(cmStrCat(lang, "_STANDARD")), newRequiredStandard,
  381. error);
  382. if (!newRequiredStandard.empty()) {
  383. target->SetProperty(cmStrCat(lang, "_STANDARD"), newRequiredStandard);
  384. }
  385. return newRequired;
  386. }
  387. bool cmStandardLevelResolver::CheckCompileFeaturesAvailable(
  388. const std::string& targetName, const std::string& feature, std::string& lang,
  389. std::string* error) const
  390. {
  391. if (!this->CompileFeatureKnown(targetName, feature, lang, error)) {
  392. return false;
  393. }
  394. if (!this->Makefile->GetGlobalGenerator()->GetLanguageEnabled(lang)) {
  395. return true;
  396. }
  397. cmValue features = this->CompileFeaturesAvailable(lang, error);
  398. if (!features) {
  399. return false;
  400. }
  401. std::vector<std::string> availableFeatures = cmExpandedList(features);
  402. if (!cm::contains(availableFeatures, feature)) {
  403. std::ostringstream e;
  404. e << "The compiler feature \"" << feature << "\" is not known to " << lang
  405. << " compiler\n\""
  406. << this->Makefile->GetSafeDefinition("CMAKE_" + lang + "_COMPILER_ID")
  407. << "\"\nversion "
  408. << this->Makefile->GetSafeDefinition("CMAKE_" + lang +
  409. "_COMPILER_VERSION")
  410. << ".";
  411. if (error) {
  412. *error = e.str();
  413. } else {
  414. this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
  415. }
  416. return false;
  417. }
  418. return true;
  419. }
  420. bool cmStandardLevelResolver::CompileFeatureKnown(
  421. const std::string& targetName, const std::string& feature, std::string& lang,
  422. std::string* error) const
  423. {
  424. assert(cmGeneratorExpression::Find(feature) == std::string::npos);
  425. bool isCFeature =
  426. std::find_if(cm::cbegin(C_FEATURES) + 1, cm::cend(C_FEATURES),
  427. cmStrCmp(feature)) != cm::cend(C_FEATURES);
  428. if (isCFeature) {
  429. lang = "C";
  430. return true;
  431. }
  432. bool isCxxFeature =
  433. std::find_if(cm::cbegin(CXX_FEATURES) + 1, cm::cend(CXX_FEATURES),
  434. cmStrCmp(feature)) != cm::cend(CXX_FEATURES);
  435. if (isCxxFeature) {
  436. lang = "CXX";
  437. return true;
  438. }
  439. bool isCudaFeature =
  440. std::find_if(cm::cbegin(CUDA_FEATURES) + 1, cm::cend(CUDA_FEATURES),
  441. cmStrCmp(feature)) != cm::cend(CUDA_FEATURES);
  442. if (isCudaFeature) {
  443. lang = "CUDA";
  444. return true;
  445. }
  446. bool isHIPFeature =
  447. std::find_if(cm::cbegin(HIP_FEATURES) + 1, cm::cend(HIP_FEATURES),
  448. cmStrCmp(feature)) != cm::cend(HIP_FEATURES);
  449. if (isHIPFeature) {
  450. lang = "HIP";
  451. return true;
  452. }
  453. std::ostringstream e;
  454. if (error) {
  455. e << "specified";
  456. } else {
  457. e << "Specified";
  458. }
  459. e << " unknown feature \"" << feature
  460. << "\" for "
  461. "target \""
  462. << targetName << "\".";
  463. if (error) {
  464. *error = e.str();
  465. } else {
  466. this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
  467. }
  468. return false;
  469. }
  470. cmValue cmStandardLevelResolver::CompileFeaturesAvailable(
  471. const std::string& lang, std::string* error) const
  472. {
  473. if (!this->Makefile->GetGlobalGenerator()->GetLanguageEnabled(lang)) {
  474. std::ostringstream e;
  475. if (error) {
  476. e << "cannot";
  477. } else {
  478. e << "Cannot";
  479. }
  480. e << " use features from non-enabled language " << lang;
  481. if (error) {
  482. *error = e.str();
  483. } else {
  484. this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
  485. }
  486. return nullptr;
  487. }
  488. cmValue featuresKnown =
  489. this->Makefile->GetDefinition("CMAKE_" + lang + "_COMPILE_FEATURES");
  490. if (!cmNonempty(featuresKnown)) {
  491. std::ostringstream e;
  492. if (error) {
  493. e << "no";
  494. } else {
  495. e << "No";
  496. }
  497. e << " known features for " << lang << " compiler\n\""
  498. << this->Makefile->GetSafeDefinition("CMAKE_" + lang + "_COMPILER_ID")
  499. << "\"\nversion "
  500. << this->Makefile->GetSafeDefinition("CMAKE_" + lang +
  501. "_COMPILER_VERSION")
  502. << ".";
  503. if (error) {
  504. *error = e.str();
  505. } else {
  506. this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
  507. }
  508. return nullptr;
  509. }
  510. return featuresKnown;
  511. }
  512. bool cmStandardLevelResolver::GetNewRequiredStandard(
  513. const std::string& targetName, const std::string& feature,
  514. cmValue currentLangStandardValue, std::string& newRequiredStandard,
  515. std::string* error) const
  516. {
  517. std::string lang;
  518. if (!this->CheckCompileFeaturesAvailable(targetName, feature, lang, error)) {
  519. return false;
  520. }
  521. auto mapping = StandardComputerMapping.find(lang);
  522. if (mapping != cm::cend(StandardComputerMapping)) {
  523. return mapping->second.GetNewRequiredStandard(
  524. this->Makefile, targetName, feature, currentLangStandardValue,
  525. newRequiredStandard, error);
  526. }
  527. return false;
  528. }
  529. bool cmStandardLevelResolver::HaveStandardAvailable(
  530. cmGeneratorTarget const* target, std::string const& lang,
  531. std::string const& config, const std::string& feature) const
  532. {
  533. auto mapping = StandardComputerMapping.find(lang);
  534. if (mapping != cm::cend(StandardComputerMapping)) {
  535. return mapping->second.HaveStandardAvailable(this->Makefile, target,
  536. config, feature);
  537. }
  538. return false;
  539. }
  540. bool cmStandardLevelResolver::IsLaterStandard(std::string const& lang,
  541. std::string const& lhs,
  542. std::string const& rhs) const
  543. {
  544. auto mapping = StandardComputerMapping.find(lang);
  545. if (mapping != cm::cend(StandardComputerMapping)) {
  546. return mapping->second.IsLaterStandard(std::stoi(lhs), std::stoi(rhs));
  547. }
  548. return false;
  549. }