Skip to content

Commit

Permalink
Merge pull request #10112 from edolstra/fix-gcc12-warnings
Browse files Browse the repository at this point in the history
Fix gcc 12 warnings
  • Loading branch information
thufschmitt committed Feb 29, 2024
2 parents b1586a6 + 65bb12b commit bf48501
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/libstore/build-result.hh
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ struct KeyedBuildResult : BuildResult
* The derivation we built or the store path we substituted.
*/
DerivedPath path;

// Hack to work around a gcc "may be used uninitialized" warning.
KeyedBuildResult(BuildResult res, DerivedPath path)
: BuildResult(std::move(res)), path(std::move(path))
{ }
};

}
1 change: 1 addition & 0 deletions src/libstore/build/local-derivation-goal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2480,6 +2480,7 @@ SingleDrvOutputs LocalDerivationGoal::registerOutputs()
CanonPath { tmpDir + "/tmp" }).hash;
}
}
assert(false);
}();

ValidPathInfo newInfo0 {
Expand Down
2 changes: 2 additions & 0 deletions src/libstore/daemon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,8 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
// Use NAR; Git is not a serialization method
dumpMethod = FileSerialisationMethod::Recursive;
break;
default:
assert(false);
}
// TODO these two steps are essentially RemoteStore::addCAToStore. Move it up to Store.
auto path = store->addToStoreFromDump(source, name, dumpMethod, contentAddressMethod, hashAlgo, refs, repair);
Expand Down
2 changes: 2 additions & 0 deletions src/libstore/remote-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,8 @@ StorePath RemoteStore::addToStoreFromDump(
// Use NAR; Git is not a serialization method
fsm = FileSerialisationMethod::Recursive;
break;
default:
assert(false);
}
if (fsm != dumpMethod)
unsupported("RemoteStore::addToStoreFromDump doesn't support this `dumpMethod` `hashMethod` combination");
Expand Down
2 changes: 1 addition & 1 deletion src/libutil/file-content-address.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Hash hashPath(
case FileIngestionMethod::Git:
return git::dumpHash(ht, accessor, path, filter).hash;
}

assert(false);
}

}

0 comments on commit bf48501

Please sign in to comment.