mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-10-04 04:03:22 +03:00
Source: fix ast-grep warnings
This commit is contained in:
1 parent
e8befb989b
commit
66cfa81885
25 files changed
+111
-104
No files matched your search
@@ -551,7 +551,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
|
||||
GetOption("CPACK_WIX_COMPONENT_KEYS_REGISTRY_PATH");
|
||||
if (componentKeysRegistryPath.empty()) {
|
||||
componentKeysRegistryPath =
|
||||
cmStrCat("Software\\", GetOption("CPACK_PACKAGE_VENDOR"), "\\",
|
||||
cmStrCat("Software\\", GetOption("CPACK_PACKAGE_VENDOR"), '\\',
|
||||
GetOption("CPACK_PACKAGE_NAME"), "\\Components");
|
||||
}
|
||||
cmSystemTools::ReplaceString(componentKeysRegistryPath, "/", "\\");
|
||||
|
||||
@@ -135,7 +135,7 @@ bool cmCTestDiscoverTests(cmTestDiscoveryArgs const& args,
|
||||
if (!res) {
|
||||
status.SetError(cmStrCat(" failed to run command: ",
|
||||
cmSystemTools::PrintSingleCommand(runCommand),
|
||||
"\n", stdErr));
|
||||
'\n', stdErr));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1086,7 +1086,7 @@ void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total)
|
||||
std::string cmCTestRunTest::GenerateLLVMPath(std::string fileString)
|
||||
{
|
||||
std::string dir = this->TestProperties->CTestDirectory;
|
||||
std::string profRawRoot = cmStrCat(dir, "/", this->TestProperties->Name);
|
||||
std::string profRawRoot = cmStrCat(dir, '/', this->TestProperties->Name);
|
||||
return cmStrCat(profRawRoot, fileString);
|
||||
}
|
||||
|
||||
@@ -1096,7 +1096,7 @@ std::string cmCTestRunTest::GetTestMetricsFile() const
|
||||
cmSystemTools::ReplaceString(safeName, "/", "_");
|
||||
cmSystemTools::ReplaceString(safeName, "\\", "_");
|
||||
return cmStrCat(this->CTest->GetInstrumentation().GetDataDir(),
|
||||
"/test/test-", safeName, "-", this->Index, ".json");
|
||||
"/test/test-", safeName, '-', this->Index, ".json");
|
||||
}
|
||||
|
||||
void cmCTestRunTest::CollectLLVMCoverage()
|
||||
|
||||
@@ -673,13 +673,13 @@ void cmCTestTestHandler::LogTestSummary(std::vector<std::string> const& passed,
|
||||
}
|
||||
if (failed.empty()) {
|
||||
cmCTestColorLog(this->CTest, HANDLER_OUTPUT, summaryAttrs,
|
||||
cmStrCat("\n", std::lround(percent),
|
||||
"% tests passed out of ", total, "\n"));
|
||||
cmStrCat('\n', std::lround(percent),
|
||||
"% tests passed out of ", total, '\n'));
|
||||
} else {
|
||||
cmCTestColorLog(this->CTest, HANDLER_OUTPUT, summaryAttrs,
|
||||
cmStrCat("\n", std::lround(percent), "% tests passed, ",
|
||||
cmStrCat('\n', std::lround(percent), "% tests passed, ",
|
||||
failed.size(), " tests failed out of ", total,
|
||||
"\n"));
|
||||
'\n'));
|
||||
}
|
||||
if ((!this->CTest->GetLabelsForSubprojects().empty() &&
|
||||
this->CTest->GetSubprojectSummary())) {
|
||||
|
||||
@@ -13,6 +13,6 @@ void cmBuildSbomGenerator::Compute(cmLocalGenerator* lg)
|
||||
bool cmBuildSbomGenerator::GenerateForBuild(std::string const& config)
|
||||
{
|
||||
cmGeneratedFileStream os(
|
||||
cmStrCat(this->OutputFile, "-", config, ".spdx.json"));
|
||||
cmStrCat(this->OutputFile, '-', config, ".spdx.json"));
|
||||
return this->Builder->Generate(os, config);
|
||||
}
|
||||
@@ -509,11 +509,11 @@ bool cmCMakeLanguageCommandPRINT_TARGETS(
|
||||
} else if (parsedArgs.NoImported) {
|
||||
label = "Non-imported targets";
|
||||
}
|
||||
out += cmStrCat(" ", label);
|
||||
out += cmStrCat(' ', label);
|
||||
if (parsedArgs.Regex) {
|
||||
out += cmStrCat(
|
||||
" matching REGEX '", *parsedArgs.Regex, "' (",
|
||||
parsedArgs.IgnoreCase ? "case insensitive" : "case sensitive", ")");
|
||||
parsedArgs.IgnoreCase ? "case insensitive" : "case sensitive", ')');
|
||||
}
|
||||
out += cmStrCat(":\n", lines);
|
||||
makefile.DisplayStatus(out, -1);
|
||||
@@ -567,7 +567,7 @@ void PrintVariablesNamed(cmMakefile& makefile,
|
||||
}
|
||||
first = false;
|
||||
cmValue v = makefile.GetDefinition(name);
|
||||
msg += cmStrCat(name, "=\"", v ? *v : std::string(), "\"");
|
||||
msg += cmStrCat(name, "=\"", v ? *v : std::string(), '"');
|
||||
}
|
||||
makefile.DisplayStatus(msg, -1);
|
||||
return;
|
||||
@@ -663,9 +663,9 @@ bool PrintVariablesAll(cmMakefile& makefile, PrintVariablesArgs const& parsed,
|
||||
cmValue cached = state->GetInitializedCacheValue(name);
|
||||
if (cached && matches(name, *cached)) {
|
||||
auto const type = state->GetCacheEntryType(name);
|
||||
body += cmStrCat(" CACHE{", name, "}");
|
||||
body += cmStrCat(" CACHE{", name, '}');
|
||||
if (type != cmStateEnums::UNINITIALIZED) {
|
||||
body += cmStrCat(":", cmState::CacheEntryTypeToString(type));
|
||||
body += cmStrCat(':', cmState::CacheEntryTypeToString(type));
|
||||
}
|
||||
body += cmStrCat(" = \"", *cached, "\"\n");
|
||||
anyMatched = true;
|
||||
@@ -676,17 +676,17 @@ bool PrintVariablesAll(cmMakefile& makefile, PrintVariablesArgs const& parsed,
|
||||
cmValue listFile = snapshot.GetDefinition("CMAKE_CURRENT_LIST_FILE");
|
||||
std::string out =
|
||||
cmStrCat(PrintVariablesBanner, " Variables in scope at '",
|
||||
listFile ? *listFile : std::string("<unknown>"), "'");
|
||||
listFile ? *listFile : std::string("<unknown>"), '\'');
|
||||
if (parsed.NameRegex || parsed.ValueRegex) {
|
||||
out += " matching";
|
||||
if (parsed.NameRegex) {
|
||||
out += cmStrCat(" name '", *parsed.NameRegex, "'");
|
||||
out += cmStrCat(" name '", *parsed.NameRegex, '\'');
|
||||
}
|
||||
if (parsed.NameRegex && parsed.ValueRegex) {
|
||||
out += " and";
|
||||
}
|
||||
if (parsed.ValueRegex) {
|
||||
out += cmStrCat(" value '", *parsed.ValueRegex, "'");
|
||||
out += cmStrCat(" value '", *parsed.ValueRegex, '\'');
|
||||
}
|
||||
out += parsed.IgnoreCase ? " (case insensitive)" : " (case sensitive)";
|
||||
}
|
||||
@@ -697,13 +697,13 @@ bool PrintVariablesAll(cmMakefile& makefile, PrintVariablesArgs const& parsed,
|
||||
if (!anyMatched && (parsed.NameRegex || parsed.ValueRegex)) {
|
||||
std::string msg = "No variables in scope matching";
|
||||
if (parsed.NameRegex) {
|
||||
msg += cmStrCat(" name '", *parsed.NameRegex, "'");
|
||||
msg += cmStrCat(" name '", *parsed.NameRegex, '\'');
|
||||
}
|
||||
if (parsed.NameRegex && parsed.ValueRegex) {
|
||||
msg += " and";
|
||||
}
|
||||
if (parsed.ValueRegex) {
|
||||
msg += cmStrCat(" value '", *parsed.ValueRegex, "'");
|
||||
msg += cmStrCat(" value '", *parsed.ValueRegex, '\'');
|
||||
}
|
||||
msg += parsed.IgnoreCase ? " (case insensitive)" : " (case sensitive)";
|
||||
msg += " in cmake_language(PRINT_VARIABLES ...).";
|
||||
@@ -836,9 +836,9 @@ std::vector<cmGeneratorTarget const*> CollectDependentTargets(
|
||||
void WritePropertyLine(std::string& out, std::string const& entityName,
|
||||
std::string const& propertyName, cmValue value)
|
||||
{
|
||||
out += cmStrCat(" ", entityName, ".", propertyName);
|
||||
out += cmStrCat(" ", entityName, '.', propertyName);
|
||||
if (value) {
|
||||
out += cmStrCat(" = \"", *value, "\"");
|
||||
out += cmStrCat(" = \"", *value, '"');
|
||||
} else {
|
||||
out += " = <NOTFOUND>";
|
||||
}
|
||||
@@ -864,21 +864,21 @@ void EmitBlockHeader(
|
||||
cm::optional<std::string> const& valueRegexStr = cm::nullopt)
|
||||
{
|
||||
out +=
|
||||
cmStrCat(" ", (kind == BlockKind::All ? "All properties" : "Properties"),
|
||||
" for ", entityType, " ", entityName);
|
||||
cmStrCat(' ', (kind == BlockKind::All ? "All properties" : "Properties"),
|
||||
" for ", entityType, ' ', entityName);
|
||||
if (suffix == HeaderSuffix::Reachable) {
|
||||
out += " (and all reachable)";
|
||||
}
|
||||
if (kind == BlockKind::All && (nameRegexStr || valueRegexStr)) {
|
||||
out += " matching";
|
||||
if (nameRegexStr) {
|
||||
out += cmStrCat(" name '", *nameRegexStr, "'");
|
||||
out += cmStrCat(" name '", *nameRegexStr, '\'');
|
||||
}
|
||||
if (nameRegexStr && valueRegexStr) {
|
||||
out += " and";
|
||||
}
|
||||
if (valueRegexStr) {
|
||||
out += cmStrCat(" value '", *valueRegexStr, "'");
|
||||
out += cmStrCat(" value '", *valueRegexStr, '\'');
|
||||
}
|
||||
}
|
||||
out += ":\n";
|
||||
@@ -894,15 +894,15 @@ std::string EmptyMatchWarningMessage(
|
||||
cm::optional<std::string> const& valueRegexStr)
|
||||
{
|
||||
std::string msg =
|
||||
cmStrCat("No properties for ", entityType, " ", entityName, " matching");
|
||||
cmStrCat("No properties for ", entityType, ' ', entityName, " matching");
|
||||
if (nameRegexStr) {
|
||||
msg += cmStrCat(" name '", *nameRegexStr, "'");
|
||||
msg += cmStrCat(" name '", *nameRegexStr, '\'');
|
||||
}
|
||||
if (nameRegexStr && valueRegexStr) {
|
||||
msg += " and";
|
||||
}
|
||||
if (valueRegexStr) {
|
||||
msg += cmStrCat(" value '", *valueRegexStr, "'");
|
||||
msg += cmStrCat(" value '", *valueRegexStr, '\'');
|
||||
}
|
||||
msg += " in cmake_language(PRINT_PROPERTIES ...).";
|
||||
return msg;
|
||||
@@ -1086,7 +1086,7 @@ bool PrintPropertiesConfigureTime(
|
||||
makefile);
|
||||
if (result == NamedBlockResult::Failed) {
|
||||
status.SetError(cmStrCat(
|
||||
"failed to retrieve properties for TARGET \"", entityName, "\""));
|
||||
"failed to retrieve properties for TARGET \"", entityName, '"'));
|
||||
return false;
|
||||
}
|
||||
if (result == NamedBlockResult::Emitted) {
|
||||
@@ -1174,7 +1174,7 @@ bool PrintTargetPropertiesDeferred(
|
||||
cmakeInst->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
cmStrCat("failed to retrieve properties for TARGET \"", name,
|
||||
"\""),
|
||||
'"'),
|
||||
bt);
|
||||
return;
|
||||
}
|
||||
@@ -1220,10 +1220,10 @@ bool cmCMakeLanguageCommandPRINT_PROPERTIES(
|
||||
|
||||
if (unparsed.empty()) {
|
||||
return FatalError(status,
|
||||
cmStrCat("mode keyword missing in ",
|
||||
"cmake_language(PRINT_PROPERTIES) call, ",
|
||||
"there must be exactly one of TARGETS SOURCES "
|
||||
"TESTS DIRECTORIES CACHE_ENTRIES"));
|
||||
"mode keyword missing in "
|
||||
"cmake_language(PRINT_PROPERTIES) call, "
|
||||
"there must be exactly one of TARGETS SOURCES "
|
||||
"TESTS DIRECTORIES CACHE_ENTRIES");
|
||||
}
|
||||
|
||||
if (parsedArgs.MaybeReportError(status.GetMakefile())) {
|
||||
@@ -1259,7 +1259,7 @@ bool cmCMakeLanguageCommandPRINT_PROPERTIES(
|
||||
|
||||
if (!unparsed.empty()) {
|
||||
return FatalError(
|
||||
status, cmStrCat("Unknown keywords: \"", cmJoin(unparsed, " "), "\""));
|
||||
status, cmStrCat("Unknown keywords: \"", cmJoin(unparsed, " "), '"'));
|
||||
}
|
||||
|
||||
if (parsedArgsMode.MaybeReportError(status.GetMakefile())) {
|
||||
@@ -1297,17 +1297,17 @@ bool cmCMakeLanguageCommandPRINT_PROPERTIES(
|
||||
|
||||
if (modes.empty()) {
|
||||
return FatalError(status,
|
||||
cmStrCat("mode keyword missing in ",
|
||||
"cmake_language(PRINT_PROPERTIES) call, ",
|
||||
"there must be exactly one of TARGETS SOURCES "
|
||||
"TESTS DIRECTORIES CACHE_ENTRIES"));
|
||||
"mode keyword missing in "
|
||||
"cmake_language(PRINT_PROPERTIES) call, "
|
||||
"there must be exactly one of TARGETS SOURCES "
|
||||
"TESTS DIRECTORIES CACHE_ENTRIES");
|
||||
}
|
||||
if (modes.size() > 1) {
|
||||
return FatalError(status,
|
||||
cmStrCat("multiple mode keywords used in ",
|
||||
"cmake_language(PRINT_PROPERTIES) call, ",
|
||||
"there must be exactly one of TARGETS SOURCES "
|
||||
"TESTS DIRECTORIES CACHE_ENTRIES."));
|
||||
"multiple mode keywords used in "
|
||||
"cmake_language(PRINT_PROPERTIES) call, "
|
||||
"there must be exactly one of TARGETS SOURCES "
|
||||
"TESTS DIRECTORIES CACHE_ENTRIES.");
|
||||
}
|
||||
std::string const mode = modes[0];
|
||||
bool const isTargets = (mode == "TARGETS");
|
||||
@@ -1318,51 +1318,50 @@ bool cmCMakeLanguageCommandPRINT_PROPERTIES(
|
||||
if (!isTargets) {
|
||||
if (parsedArgs.All) {
|
||||
return FatalError(status,
|
||||
cmStrCat("ALL keyword in ",
|
||||
"cmake_language(PRINT_PROPERTIES) call ",
|
||||
"is only valid with the TARGETS scope."));
|
||||
"ALL keyword in "
|
||||
"cmake_language(PRINT_PROPERTIES) call "
|
||||
"is only valid with the TARGETS scope.");
|
||||
}
|
||||
if (hasRegex) {
|
||||
return FatalError(
|
||||
status,
|
||||
cmStrCat("PROPERTY_NAME_REGEX and PROPERTY_VALUE_REGEX in ",
|
||||
"cmake_language(PRINT_PROPERTIES) call ",
|
||||
"are only valid with the TARGETS scope and ALL."));
|
||||
return FatalError(status,
|
||||
"PROPERTY_NAME_REGEX and PROPERTY_VALUE_REGEX in "
|
||||
"cmake_language(PRINT_PROPERTIES) call "
|
||||
"are only valid with the TARGETS scope and ALL.");
|
||||
}
|
||||
if (parsedArgsMode.Deferred) {
|
||||
return FatalError(status,
|
||||
cmStrCat("DEFERRED keyword in ",
|
||||
"cmake_language(PRINT_PROPERTIES) call ",
|
||||
"is only valid with the TARGETS scope."));
|
||||
"DEFERRED keyword in "
|
||||
"cmake_language(PRINT_PROPERTIES) call "
|
||||
"is only valid with the TARGETS scope.");
|
||||
}
|
||||
if (parsedArgsMode.FollowDependencies) {
|
||||
return FatalError(status,
|
||||
cmStrCat("FOLLOW_DEPENDENCIES keyword in ",
|
||||
"cmake_language(PRINT_PROPERTIES) call ",
|
||||
"is only valid with the TARGETS scope."));
|
||||
"FOLLOW_DEPENDENCIES keyword in "
|
||||
"cmake_language(PRINT_PROPERTIES) call "
|
||||
"is only valid with the TARGETS scope.");
|
||||
}
|
||||
if (!hasNamed) {
|
||||
return FatalError(status,
|
||||
cmStrCat("NAMED keyword missing in ",
|
||||
"cmake_language(PRINT_PROPERTIES) call ",
|
||||
"with ", mode, " scope."));
|
||||
cmStrCat("NAMED keyword missing in "
|
||||
"cmake_language(PRINT_PROPERTIES) call "
|
||||
"with ",
|
||||
mode, " scope."));
|
||||
}
|
||||
} else {
|
||||
// ALL and NAMED are mutually exclusive on TARGETS.
|
||||
if (parsedArgs.All && hasNamed) {
|
||||
return FatalError(status,
|
||||
cmStrCat("ALL and NAMED keywords in ",
|
||||
"cmake_language(PRINT_PROPERTIES) call ",
|
||||
"are mutually exclusive."));
|
||||
"ALL and NAMED keywords in "
|
||||
"cmake_language(PRINT_PROPERTIES) call "
|
||||
"are mutually exclusive.");
|
||||
}
|
||||
// Regex filters require ALL - explicit or implicit. Combining regex
|
||||
// with NAMED is an error.
|
||||
if (hasNamed && hasRegex) {
|
||||
return FatalError(
|
||||
status,
|
||||
cmStrCat("PROPERTY_NAME_REGEX and PROPERTY_VALUE_REGEX in ",
|
||||
"cmake_language(PRINT_PROPERTIES) call ",
|
||||
"are only valid with ALL, not NAMED."));
|
||||
return FatalError(status,
|
||||
"PROPERTY_NAME_REGEX and PROPERTY_VALUE_REGEX in "
|
||||
"cmake_language(PRINT_PROPERTIES) call "
|
||||
"are only valid with ALL, not NAMED.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1379,9 +1378,9 @@ bool cmCMakeLanguageCommandPRINT_PROPERTIES(
|
||||
// wrapper, which is always NAMED; reject it in ALL enumeration mode.
|
||||
if (all && parsedArgs.CmakePrintProperties) {
|
||||
return FatalError(status,
|
||||
cmStrCat("__CMAKE_PRINT_PROPERTIES in ",
|
||||
"cmake_language(PRINT_PROPERTIES) call ",
|
||||
"is only valid with NAMED."));
|
||||
"__CMAKE_PRINT_PROPERTIES in "
|
||||
"cmake_language(PRINT_PROPERTIES) call "
|
||||
"is only valid with NAMED.");
|
||||
}
|
||||
|
||||
// Compile regexes once up front so syntax errors are reported here rather
|
||||
|
||||
@@ -156,7 +156,7 @@ bool VisitPreset(
|
||||
if (parent == presets.end()) {
|
||||
cmCMakePresetsErrors::INVALID_PRESET_NAMED(
|
||||
preset.Name, preset.kind(), &graph.parseState,
|
||||
cmStrCat("Could not find inherited preset \"", i, "\""));
|
||||
cmStrCat("Could not find inherited preset \"", i, '"'));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ void cmCMakeSarifLogger::AddBaseDirectory(cm::string_view name,
|
||||
this->UriBaseIds.emplace_back(std::string(name), std::string(path));
|
||||
this->CMakeRun.OriginalUriBaseIds.emplace(
|
||||
std::string(name),
|
||||
cmSarif::ArtifactLocation{ cmStrCat("file://", path, "/"), "" });
|
||||
cmSarif::ArtifactLocation{ cmStrCat("file://", path, '/'), "" });
|
||||
}
|
||||
|
||||
void cmCMakeSarifLogger::RecordDiagnostics(
|
||||
|
||||
@@ -534,7 +534,7 @@ std::string cmCustomCommandGenerator::StoreContentToFile(
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string fileName = cmStrCat(fileDir, "/", hash.HashString(content));
|
||||
std::string fileName = cmStrCat(fileDir, '/', hash.HashString(content));
|
||||
|
||||
cmsys::ofstream file(fileName.c_str(), std::ios::out);
|
||||
if (!file) {
|
||||
|
||||
@@ -578,7 +578,7 @@ void cmExportPackageInfoGenerator::GenerateInterfaceCompileFeatures(
|
||||
for (auto const& value : cmList{ iter->second }) {
|
||||
if (cmHasLiteralPrefix(value, "c_std_")) {
|
||||
auto suffix = cm::string_view{ value }.substr(6, 2);
|
||||
features.emplace(cmStrCat("c", suffix));
|
||||
features.emplace(cmStrCat('c', suffix));
|
||||
} else if (cmHasLiteralPrefix(value, "cxx_std_")) {
|
||||
auto suffix = cm::string_view{ value }.substr(8, 2);
|
||||
features.emplace(cmStrCat("c++", suffix));
|
||||
|
||||
@@ -738,14 +738,14 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand(
|
||||
// no escaping of spaces in this case, see
|
||||
// https://gitlab.kitware.com/cmake/cmake/-/issues/10014
|
||||
std::string const& makefileName = makefile;
|
||||
command = cmStrCat(std::move(command), " -f \"", makefileName, "\" ",
|
||||
" VERBOSE=1 ", target);
|
||||
command = cmStrCat(std::move(command), " -f \"", makefileName,
|
||||
"\" VERBOSE=1 ", target);
|
||||
} else if (generator == "Ninja") {
|
||||
command = cmStrCat(std::move(command), " -v ", target);
|
||||
} else {
|
||||
std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile);
|
||||
command = cmStrCat(std::move(command), " -f \"", makefileName, "\" ",
|
||||
" VERBOSE=1 ", target);
|
||||
command = cmStrCat(std::move(command), " -f \"", makefileName,
|
||||
"\" VERBOSE=1 ", target);
|
||||
}
|
||||
return command;
|
||||
}
|
||||
@@ -2252,7 +2252,7 @@ void cmFastbuildNormalTargetGenerator::AddLipoCommand(FastbuildTarget& target)
|
||||
for (auto const& ArchSpecificTarget : target.LinkerNode) {
|
||||
exec.ExecInput.emplace_back(ArchSpecificTarget.LinkerOutput);
|
||||
}
|
||||
exec.ExecArguments += cmStrCat("-create -output ", target.RealOutput, " ",
|
||||
exec.ExecArguments += cmStrCat("-create -output ", target.RealOutput, ' ',
|
||||
cmJoin(exec.ExecInput, " "));
|
||||
target.PostBuildExecNodes.Alias.PreBuildDependencies.emplace(
|
||||
exec.ExecOutput);
|
||||
|
||||
@@ -158,7 +158,7 @@ std::vector<BT<std::string>> ProcessIncludes(
|
||||
MessageType::FATAL_ERROR,
|
||||
cmStrCat("File set \"", fileSetName, "\" from the target \"",
|
||||
target->GetName(), "\" contains relative path in its ",
|
||||
property, ":\n \"", include, "\""));
|
||||
property, ":\n \"", include, '"'));
|
||||
return includes;
|
||||
}
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ void processIncludeDirectories(cmGeneratorTarget const* tgt,
|
||||
if (uniqueIncludes.insert(entryInclude).second) {
|
||||
includes.emplace_back(entryInclude, entry.Backtrace);
|
||||
if (debugIncludes) {
|
||||
usedIncludes += cmStrCat(" * ", entryInclude, "\n");
|
||||
usedIncludes += cmStrCat(" * ", entryInclude, '\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ void processLinkDirectories(cmGeneratorTarget const* tgt,
|
||||
cmStrCat("Target \"", targetName,
|
||||
"\" contains relative path"
|
||||
" in its INTERFACE_LINK_DIRECTORIES:\n \"",
|
||||
entryDirectory, "\""));
|
||||
entryDirectory, '"'));
|
||||
return;
|
||||
}
|
||||
switch (tgt->GetPolicyStatusCMP0081()) {
|
||||
|
||||
@@ -634,7 +634,7 @@ void cmGlobalFastbuildGenerator::WriteVariable(std::string const& key,
|
||||
{
|
||||
Indent(indent);
|
||||
*this->BuildFileStream << "." << key
|
||||
<< cmStrCat(" ", op, (value.empty() ? "" : " "))
|
||||
<< cmStrCat(' ', op, (value.empty() ? "" : " "))
|
||||
<< value << "\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ void cmInstallSbomGenerator::GenerateScript(std::ostream& os)
|
||||
this->LocalGenerator->GetMakefile()->GetGeneratorConfigs(
|
||||
cmMakefile::IncludeEmptyConfig)) {
|
||||
std::string configName =
|
||||
cmStrCat(tempDir, '/', this->SbomFileName, "-", c, ".spdx.json");
|
||||
cmStrCat(tempDir, '/', this->SbomFileName, '-', c, ".spdx.json");
|
||||
cmGeneratedFileStream sbomStream(configName);
|
||||
this->TempSbomFiles.emplace(c, configName);
|
||||
if (!this->Builder->Generate(sbomStream, c)) {
|
||||
|
||||
+2
-2
@@ -89,8 +89,8 @@ std::string OutputVarFor(cm::string_view prefix, cmMakefile& makefile)
|
||||
{
|
||||
cmListFileContext context = makefile.GetBacktrace().Top();
|
||||
std::size_t hash =
|
||||
std::hash<std::string>{}(cmStrCat(context.FilePath, ":", context.Line));
|
||||
return cmStrCat(prefix, hash, "_");
|
||||
std::hash<std::string>{}(cmStrCat(context.FilePath, ':', context.Line));
|
||||
return cmStrCat(prefix, hash, '_');
|
||||
}
|
||||
|
||||
void RequireFunction(cmMakefile const& makefile,
|
||||
|
||||
@@ -2119,7 +2119,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
|
||||
continue;
|
||||
}
|
||||
if (filterArch.empty() || filterArch == arch) {
|
||||
flags = cmStrCat(flags, " -Xarch_", arch, " ");
|
||||
flags = cmStrCat(flags, " -Xarch_", arch, ' ');
|
||||
// Combine sysroot flag and path to work with -Xarch
|
||||
std::string arch_sysroot = *sysrootFlag + archSysroot;
|
||||
flags += this->ConvertToOutputFormat(arch_sysroot, SHELL);
|
||||
|
||||
+17
-9
@@ -2729,13 +2729,19 @@ void cmMakefile::IssueCMP0219Warning(
|
||||
|
||||
this->IssueDiagnostic(
|
||||
cmDiagnostics::CMD_POLICY,
|
||||
cmStrCat(
|
||||
cmPolicies::GetPolicyWarning(cmPolicies::CMP0219), '\n', "Command \"",
|
||||
calleeName, "\" called with arguments containing backslashes.\n",
|
||||
"Since the policy is not set, backslashes in the arguments:\n", oldArgs,
|
||||
"\n", "will be interpreted as escape sequences for compatibility.\n",
|
||||
"Set the policy to NEW to instead pass\n", newArgs, "\n",
|
||||
"so that argument parsing will preserve the original values."));
|
||||
cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0219),
|
||||
"\n"
|
||||
"Command \"",
|
||||
calleeName,
|
||||
"\" called with arguments containing backslashes.\n"
|
||||
"Since the policy is not set, backslashes in the arguments:\n",
|
||||
oldArgs,
|
||||
"\n"
|
||||
"will be interpreted as escape sequences for compatibility.\n"
|
||||
"Set the policy to NEW to instead pass\n",
|
||||
newArgs,
|
||||
"\n"
|
||||
"so that argument parsing will preserve the original values."));
|
||||
}
|
||||
|
||||
void cmMakefile::IssueCMP0219Warning(
|
||||
@@ -3646,10 +3652,12 @@ std::string cmMakefile::GetModulesFile(cm::string_view filename, bool& system,
|
||||
if (status && actualName != requestedName) {
|
||||
this->IssueDiagnostic(
|
||||
cmDiagnostics::CMD_AUTHOR,
|
||||
cmStrCat("The module name\n ", requestedName, '\n',
|
||||
cmStrCat("The module name\n ", requestedName,
|
||||
"\n"
|
||||
"does not match the case of the module file name on disk\n"
|
||||
" ",
|
||||
cmSystemTools::GetFilenamePath(result), '/', actualName, '\n',
|
||||
cmSystemTools::GetFilenamePath(result), '/', actualName,
|
||||
"\n"
|
||||
"This may fail on case-sensitive file systems. "
|
||||
"Use the module name\n ",
|
||||
actualName, "\ninstead."));
|
||||
|
||||
@@ -141,7 +141,7 @@ bool HandleIncDecCommand(std::vector<std::string> const& args,
|
||||
long long overflowFrom, long long overflowTo,
|
||||
cm::string_view verbing)
|
||||
{
|
||||
std::string const messageHint = cmStrCat("sub-command ", args[0], " ");
|
||||
std::string const messageHint = cmStrCat("sub-command ", args[0], ' ');
|
||||
if (args.size() != 2) {
|
||||
status.SetError(cmStrCat(messageHint, "wrong number of arguments"));
|
||||
return false;
|
||||
@@ -174,7 +174,7 @@ bool HandleIncDecCommand(std::vector<std::string> const& args,
|
||||
status.GetMakefile().IssueDiagnostic(
|
||||
cmDiagnosticCategory::CMD_AUTHOR,
|
||||
cmStrCat("signed integer overflow while ", verbing, ":\n ", intValue,
|
||||
"\n"));
|
||||
'\n'));
|
||||
// Overflow is undefined behavior in C++, so define it manually
|
||||
newValue = overflowTo;
|
||||
}
|
||||
|
||||
@@ -96,5 +96,5 @@ std::string cmPackageInfoArguments::GetDefaultDestination(
|
||||
if (root.empty()) {
|
||||
return cmStrCat("cps/"_s, this->GetPackageDirName());
|
||||
}
|
||||
return cmStrCat(root, '/', "cps/"_s, this->GetPackageDirName());
|
||||
return cmStrCat(root, "/cps/"_s, this->GetPackageDirName());
|
||||
}
|
||||
@@ -97,7 +97,7 @@ std::string cmSbomArguments::GetDefaultDestination(
|
||||
if (root.empty()) {
|
||||
return cmStrCat("sbom/"_s, this->GetPackageName());
|
||||
}
|
||||
return cmStrCat(root, '/', "sbom/"_s, this->GetPackageName());
|
||||
return cmStrCat(root, "/sbom/"_s, this->GetPackageName());
|
||||
}
|
||||
|
||||
cmSbomArguments::SbomFormat cmSbomArguments::GetFormat() const
|
||||
|
||||
@@ -195,7 +195,7 @@ bool cmSbomBuilder::AddPackageInformation(
|
||||
|
||||
artifact.BuiltTime = cmSystemTools::GetCurrentDateTime("%FT%TZ");
|
||||
cmSpdxExternalRef externalRef;
|
||||
externalRef.Locator = cmStrCat("cmake:find_package(", name, ")");
|
||||
externalRef.Locator = cmStrCat("cmake:find_package(", name, ')');
|
||||
externalRef.ExternalRefType = "buildSystem";
|
||||
return true;
|
||||
}
|
||||
@@ -312,7 +312,7 @@ bool cmSbomBuilder::GenerateLinkProperties(
|
||||
}
|
||||
}
|
||||
std::string pkgName =
|
||||
cmStrCat(linkInfo.Package, ":", linkInfo.Component);
|
||||
cmStrCat(linkInfo.Package, ':', linkInfo.Component);
|
||||
cmSpdxPackage pkg;
|
||||
pkg.Name = pkgName;
|
||||
pkg.SpdxId = cmStrCat("urn:", pkgName, "#Package");
|
||||
|
||||
+1
-1
@@ -2269,7 +2269,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args,
|
||||
return 1;
|
||||
};
|
||||
auto const isFilename = [](std::string const& arg) -> bool {
|
||||
return arg == "-"_s || !cmHasLiteralPrefix(arg, "-");
|
||||
return arg == "-"_s || !cmHasPrefix(arg, '-');
|
||||
};
|
||||
|
||||
static char const validPlaceholderChars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
|
||||
Reference in new issue
Block a user