Source: Fix -Wdangling-reference warnings exposed by gcc 13

This commit is contained in:
Brad King 2023-05-22 13:17:41 -04:00
parent 7b3ec2b891
commit 93ee2b369c
5 changed files with 9 additions and 8 deletions

View File

@ -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,

View File

@ -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 {

View File

@ -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 +

View File

@ -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);
}

View File

@ -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);
}
}