cmStrCat: combine neighboring arguments where possible

Found using the `cmstrcat-adjacent-literals` rule for `ast-grep`.
This commit is contained in:
Ben Boeckel
2025-05-15 18:27:13 +02:00
parent 483d13daf4
commit 23779057fd
26 changed files with 112 additions and 77 deletions
+11 -7
View File
@@ -417,7 +417,8 @@ bool HandleStringsCommand(std::vector<std::string> const& args,
"CMAKE_POLICY_WARNING_CMP0159")) {
status.GetMakefile().IssueMessage(
MessageType::AUTHOR_WARNING,
cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0159), '\n',
cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0159),
"\n"
"For compatibility, CMake is leaving CMAKE_MATCH_<n> "
"unchanged."));
}
@@ -2131,8 +2132,9 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
if (!file.empty()) {
fout.open(file.c_str(), std::ios::binary);
if (!fout) {
status.SetError(cmStrCat("DOWNLOAD cannot open file for write\n",
" file: \"", file, '"'));
status.SetError(cmStrCat("DOWNLOAD cannot open file for write\n"
" file: \"",
file, '"'));
return false;
}
}
@@ -2330,8 +2332,9 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
std::string actualHash = hash->HashFile(file);
if (actualHash.empty()) {
status.SetError(cmStrCat("DOWNLOAD cannot compute hash on download\n",
" for file: \"", file, '"'));
status.SetError(cmStrCat("DOWNLOAD cannot compute hash on download\n"
" for file: \"",
file, '"'));
return false;
}
@@ -2990,8 +2993,9 @@ bool HandleLockCommand(std::vector<std::string> const& args,
} else {
status.GetMakefile().IssueMessage(
MessageType::FATAL_ERROR,
cmStrCat("expected DIRECTORY, RELEASE, GUARD, RESULT_VARIABLE or ",
"TIMEOUT\nbut got: \"", args[i], "\"."));
cmStrCat("expected DIRECTORY, RELEASE, GUARD, RESULT_VARIABLE or "
"TIMEOUT\nbut got: \"",
args[i], "\"."));
return false;
}
}