diff options
author | Brad King <brad.king@kitware.com> | 2023-05-22 17:17:41 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-05-22 21:14:54 (GMT) |
commit | 93ee2b369c8f2937d848026bad40b09586a5c487 (patch) | |
tree | 86a9b3cbdc529cea02b36190295bbf29a35806b0 /Source | |
parent | 7b3ec2b891d587828808845bfc390fb33aa120d9 (diff) | |
download | CMake-93ee2b369c8f2937d848026bad40b09586a5c487.zip CMake-93ee2b369c8f2937d848026bad40b09586a5c487.tar.gz CMake-93ee2b369c8f2937d848026bad40b09586a5c487.tar.bz2 |
Source: Fix -Wdangling-reference warnings exposed by gcc 13
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CPack/cmCPackInnoSetupGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmCommandArgumentParserHelper.cxx | 3 | ||||
-rw-r--r-- | Source/cmCommonTargetGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmConditionEvaluator.cxx | 4 | ||||
-rw-r--r-- | Source/cmGlobalCommonGenerator.cxx | 6 |
5 files changed, 9 insertions, 8 deletions
diff --git a/Source/CPack/cmCPackInnoSetupGenerator.cxx b/Source/CPack/cmCPackInnoSetupGenerator.cxx index d8825d4..5d2c208 100644 --- a/Source/CPack/cmCPackInnoSetupGenerator.cxx +++ b/Source/CPack/cmCPackInnoSetupGenerator.cxx @@ -277,7 +277,7 @@ bool cmCPackInnoSetupGenerator::ProcessSetupSection() return false; } - const std::string& architecture = GetOption("CPACK_INNOSETUP_ARCHITECTURE"); + cmValue const architecture = GetOption("CPACK_INNOSETUP_ARCHITECTURE"); if (architecture != "x86" && architecture != "x64" && architecture != "arm64" && architecture != "ia64") { cmCPackLogger(cmCPackLog::LOG_ERROR, diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index 2ed04e5..a20f5a5 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -96,7 +96,8 @@ const char* cmCommandArgumentParserHelper::ExpandVariable(const char* var) } if (this->FileLine >= 0 && strcmp(var, "CMAKE_CURRENT_LIST_LINE") == 0) { std::string line; - cmListFileContext const& top = this->Makefile->GetBacktrace().Top(); + cmListFileBacktrace bt = this->Makefile->GetBacktrace(); + cmListFileContext const& top = bt.Top(); if (top.DeferId) { line = cmStrCat("DEFERRED:"_s, *top.DeferId); } else { diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 2615494..e635dd9 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -236,7 +236,7 @@ std::string cmCommonTargetGenerator::GetManifests(const std::string& config) manifests.reserve(manifest_srcs.size()); std::string lang = this->GeneratorTarget->GetLinkerLanguage(config); - std::string const& manifestFlag = + std::string manifestFlag = this->Makefile->GetDefinition("CMAKE_" + lang + "_LINKER_MANIFEST_FLAG"); for (cmSourceFile const* manifest_src : manifest_srcs) { manifests.push_back(manifestFlag + diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index 288e107..6f9f541 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -741,8 +741,8 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs, keyVERSION_LESS_EQUAL, keyVERSION_GREATER, keyVERSION_GREATER_EQUAL, keyVERSION_EQUAL))) { const auto op = MATCH2CMPOP[matchNo - 1]; - const std::string& lhs = this->GetVariableOrString(*args.current); - const std::string& rhs = this->GetVariableOrString(*args.nextnext); + const cmValue lhs = this->GetVariableOrString(*args.current); + const cmValue rhs = this->GetVariableOrString(*args.nextnext); const auto result = cmSystemTools::VersionCompare(op, lhs, rhs); newArgs.ReduceTwoArgs(result, args); } diff --git a/Source/cmGlobalCommonGenerator.cxx b/Source/cmGlobalCommonGenerator.cxx index 7a44452..513e3bf 100644 --- a/Source/cmGlobalCommonGenerator.cxx +++ b/Source/cmGlobalCommonGenerator.cxx @@ -34,8 +34,8 @@ cmGlobalCommonGenerator::ComputeDirectoryTargets() const { std::map<std::string, DirectoryTarget> dirTargets; for (const auto& lg : this->LocalGenerators) { - std::string const& currentBinaryDir( - lg->GetStateSnapshot().GetDirectory().GetCurrentBinary()); + std::string currentBinaryDir = + lg->GetStateSnapshot().GetDirectory().GetCurrentBinary(); DirectoryTarget& dirTarget = dirTargets[currentBinaryDir]; dirTarget.LG = lg.get(); const std::vector<std::string>& configs = @@ -68,7 +68,7 @@ cmGlobalCommonGenerator::ComputeDirectoryTargets() const for (cmStateSnapshot dir = lg->GetStateSnapshot().GetBuildsystemDirectoryParent(); dir.IsValid(); dir = dir.GetBuildsystemDirectoryParent()) { - std::string const& d = dir.GetDirectory().GetCurrentBinary(); + std::string d = dir.GetDirectory().GetCurrentBinary(); dirTargets[d].Targets.emplace_back(t); } } |