diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 8b1e9b21fd..e6687ffe25 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -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, "/", "\\"); diff --git a/Source/CTest/cmCTestDiscoverTests.cxx b/Source/CTest/cmCTestDiscoverTests.cxx index a871bad44b..754850dc8d 100644 --- a/Source/CTest/cmCTestDiscoverTests.cxx +++ b/Source/CTest/cmCTestDiscoverTests.cxx @@ -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; } diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 18b5d24e23..52911e6290 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -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() diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index fbeacd063b..701ab34d01 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -673,13 +673,13 @@ void cmCTestTestHandler::LogTestSummary(std::vector 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())) { diff --git a/Source/cmBuildSbomGenerator.cxx b/Source/cmBuildSbomGenerator.cxx index 1155604a6b..178cf39c00 100644 --- a/Source/cmBuildSbomGenerator.cxx +++ b/Source/cmBuildSbomGenerator.cxx @@ -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); } diff --git a/Source/cmCMakeLanguageCommand.cxx b/Source/cmCMakeLanguageCommand.cxx index 49313d9ddb..3b668e057a 100644 --- a/Source/cmCMakeLanguageCommand.cxx +++ b/Source/cmCMakeLanguageCommand.cxx @@ -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(""), "'"); + listFile ? *listFile : std::string(""), '\''); 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 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 += " = "; } @@ -864,21 +864,21 @@ void EmitBlockHeader( cm::optional 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 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 diff --git a/Source/cmCMakePresetsGraph.cxx b/Source/cmCMakePresetsGraph.cxx index acc9de24ee..7b044bc224 100644 --- a/Source/cmCMakePresetsGraph.cxx +++ b/Source/cmCMakePresetsGraph.cxx @@ -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; } diff --git a/Source/cmCMakeSarifLogger.cxx b/Source/cmCMakeSarifLogger.cxx index 9a41411460..fa8281eea5 100644 --- a/Source/cmCMakeSarifLogger.cxx +++ b/Source/cmCMakeSarifLogger.cxx @@ -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( diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 9805ad6c88..913d522270 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -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) { diff --git a/Source/cmExportPackageInfoGenerator.cxx b/Source/cmExportPackageInfoGenerator.cxx index 6c76a5849a..7107026b43 100644 --- a/Source/cmExportPackageInfoGenerator.cxx +++ b/Source/cmExportPackageInfoGenerator.cxx @@ -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)); diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 8844a09915..b68db1eebc 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -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; } diff --git a/Source/cmFastbuildNormalTargetGenerator.cxx b/Source/cmFastbuildNormalTargetGenerator.cxx index f1e869074e..9a8f2b273b 100644 --- a/Source/cmFastbuildNormalTargetGenerator.cxx +++ b/Source/cmFastbuildNormalTargetGenerator.cxx @@ -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); diff --git a/Source/cmGeneratorFileSet.cxx b/Source/cmGeneratorFileSet.cxx index 62df8ba8d8..81e0e447f6 100644 --- a/Source/cmGeneratorFileSet.cxx +++ b/Source/cmGeneratorFileSet.cxx @@ -158,7 +158,7 @@ std::vector> 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; } diff --git a/Source/cmGeneratorTarget_IncludeDirectories.cxx b/Source/cmGeneratorTarget_IncludeDirectories.cxx index b8047e86f9..5b3d79b035 100644 --- a/Source/cmGeneratorTarget_IncludeDirectories.cxx +++ b/Source/cmGeneratorTarget_IncludeDirectories.cxx @@ -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'); } } } diff --git a/Source/cmGeneratorTarget_LinkDirectories.cxx b/Source/cmGeneratorTarget_LinkDirectories.cxx index d2360d422d..cc56034a1e 100644 --- a/Source/cmGeneratorTarget_LinkDirectories.cxx +++ b/Source/cmGeneratorTarget_LinkDirectories.cxx @@ -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()) { diff --git a/Source/cmGlobalFastbuildGenerator.cxx b/Source/cmGlobalFastbuildGenerator.cxx index 95cbefacd4..26fc1799cd 100644 --- a/Source/cmGlobalFastbuildGenerator.cxx +++ b/Source/cmGlobalFastbuildGenerator.cxx @@ -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"; } diff --git a/Source/cmInstallSbomGenerator.cxx b/Source/cmInstallSbomGenerator.cxx index 0db7a44449..0407e193e8 100644 --- a/Source/cmInstallSbomGenerator.cxx +++ b/Source/cmInstallSbomGenerator.cxx @@ -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)) { diff --git a/Source/cmList.cxx b/Source/cmList.cxx index 42a4033e7c..16e43a5516 100644 --- a/Source/cmList.cxx +++ b/Source/cmList.cxx @@ -89,8 +89,8 @@ std::string OutputVarFor(cm::string_view prefix, cmMakefile& makefile) { cmListFileContext context = makefile.GetBacktrace().Top(); std::size_t hash = - std::hash{}(cmStrCat(context.FilePath, ":", context.Line)); - return cmStrCat(prefix, hash, "_"); + std::hash{}(cmStrCat(context.FilePath, ':', context.Line)); + return cmStrCat(prefix, hash, '_'); } void RequireFunction(cmMakefile const& makefile, diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 1214be2741..a6417e6ac5 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -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); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 4b0442d02e..e1a7672dcc 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -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.")); diff --git a/Source/cmMathCommand.cxx b/Source/cmMathCommand.cxx index d14145732d..50e25d8a87 100644 --- a/Source/cmMathCommand.cxx +++ b/Source/cmMathCommand.cxx @@ -141,7 +141,7 @@ bool HandleIncDecCommand(std::vector 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 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; } diff --git a/Source/cmPackageInfoArguments.cxx b/Source/cmPackageInfoArguments.cxx index e9fe498cf0..ef78aed88b 100644 --- a/Source/cmPackageInfoArguments.cxx +++ b/Source/cmPackageInfoArguments.cxx @@ -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()); } diff --git a/Source/cmSbomArguments.cxx b/Source/cmSbomArguments.cxx index b5c48fa6aa..fa7eb8757d 100644 --- a/Source/cmSbomArguments.cxx +++ b/Source/cmSbomArguments.cxx @@ -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 diff --git a/Source/cmSbomBuilder.cxx b/Source/cmSbomBuilder.cxx index a7e7b295a8..e6ee300040 100644 --- a/Source/cmSbomBuilder.cxx +++ b/Source/cmSbomBuilder.cxx @@ -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"); diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 79aa715cab..622239fdd3 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -2269,7 +2269,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector 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"