diff options
| author | Stefan Boberg <[email protected]> | 2025-11-01 14:04:35 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-11-01 14:04:35 +0100 |
| commit | a58da97f98697580bf128ed5723ba720cc30f0dc (patch) | |
| tree | 798e392ddf76128a506293dc0803aaf852203dcd /src/zenstore | |
| parent | fix use-after-free in TEST_CASE("compactcas.threadedinsert") (#620) (diff) | |
| download | zen-a58da97f98697580bf128ed5723ba720cc30f0dc.tar.xz zen-a58da97f98697580bf128ed5723ba720cc30f0dc.zip | |
Various fixes to address issues flagged by gcc / non-UE toolchain build (#621)
* gcc: avoid using memset on nontrivial struct
* redundant `return std::move`
* fixed various compilation issues flagged by gcc
* fix issue in xmake.lua detecting whether we are building with the UE toolchain or not
* add GCC ignore -Wundef (comment is inaccurate)
* remove redundant std::move
* don't catch exceptions by value
* unreferenced variables
* initialize "by the book" instead of memset
* remove unused exception reference
* add #include <cstring> to fix gcc build
* explicitly poulate KeyValueMap by traversing input spans fixes gcc compilation
* remove unreferenced variable
* eliminate redundant `std::move` which gcc complains about
* fix gcc compilation by including <cstring>
* tag unreferenced variable to fix gcc compilation
* fixes for various cases of naming members the same as their type
Diffstat (limited to 'src/zenstore')
| -rw-r--r-- | src/zenstore/buildstore/buildstore.cpp | 4 | ||||
| -rw-r--r-- | src/zenstore/cache/structuredcachestore.cpp | 1 | ||||
| -rw-r--r-- | src/zenstore/filecas.cpp | 2 | ||||
| -rw-r--r-- | src/zenstore/projectstore.cpp | 5 | ||||
| -rw-r--r-- | src/zenstore/workspaces.cpp | 6 |
5 files changed, 13 insertions, 5 deletions
diff --git a/src/zenstore/buildstore/buildstore.cpp b/src/zenstore/buildstore/buildstore.cpp index aa28d8900..99cf7f16e 100644 --- a/src/zenstore/buildstore/buildstore.cpp +++ b/src/zenstore/buildstore/buildstore.cpp @@ -231,7 +231,7 @@ BuildStore::PutBlob(const IoHash& BlobHash, const IoBuffer& Payload) uint64_t PayloadSize = Payload.GetSize(); CidStore::InsertResult Result = m_BlobStore.AddChunk(Payload, BlobHash); PayloadEntry Entry = PayloadEntry(0, PayloadSize); - ; + ZEN_UNUSED(Result); IoHash MetadataHash; { @@ -1095,8 +1095,6 @@ public: ZEN_TRACE_CPU("Builds::UpdateLockedState"); ZEN_MEMSCOPE(GetBuildstoreTag()); - auto Log = [&Ctx]() { return Ctx.Logger; }; - ZEN_ASSERT(m_Store.m_TrackedBlobKeys); m_AddedReferences = std::move(*m_Store.m_TrackedBlobKeys); diff --git a/src/zenstore/cache/structuredcachestore.cpp b/src/zenstore/cache/structuredcachestore.cpp index 07e72ebb5..a164f66c3 100644 --- a/src/zenstore/cache/structuredcachestore.cpp +++ b/src/zenstore/cache/structuredcachestore.cpp @@ -1073,6 +1073,7 @@ ZenCacheStore::LockState(GcCtx& Ctx) ZEN_TRACE_CPU("CacheStore::LockState"); auto Log = [&Ctx]() { return Ctx.Logger; }; + ZEN_UNUSED(Log); std::vector<RwLock::SharedLockScope> Locks; Locks.emplace_back(RwLock::SharedLockScope(m_NamespacesLock)); diff --git a/src/zenstore/filecas.cpp b/src/zenstore/filecas.cpp index a895b81e0..13d881e0c 100644 --- a/src/zenstore/filecas.cpp +++ b/src/zenstore/filecas.cpp @@ -449,7 +449,7 @@ FileCasStrategy::InsertChunk(IoBuffer Chunk, const IoHash& ChunkHash, CasStore:: ChunkRemain -= ByteCount; } } - catch (const std::exception Ex) + catch (const std::exception&) { PayloadFile.Close(); std::error_code DummyEc; diff --git a/src/zenstore/projectstore.cpp b/src/zenstore/projectstore.cpp index 8ae74c8cf..7570b8513 100644 --- a/src/zenstore/projectstore.cpp +++ b/src/zenstore/projectstore.cpp @@ -4709,6 +4709,7 @@ ProjectStore::GetChunkInfo(LoggerRef InLog, Project& Project, Oplog& Oplog, cons using namespace std::literals; auto Log = [&InLog]() { return InLog; }; + ZEN_UNUSED(Log); IoBuffer Chunk = Oplog.FindChunk(Project.RootDir, ChunkId, nullptr); if (!Chunk) @@ -4869,6 +4870,7 @@ ProjectStore::GetChunkRange(LoggerRef InLog, ZEN_TRACE_CPU("ProjectStore::GetChunkRange"); auto Log = [&InLog]() { return InLog; }; + ZEN_UNUSED(Log); uint64_t OldTag = OptionalInOutModificationTag == nullptr ? 0 : *OptionalInOutModificationTag; IoBuffer Chunk = Oplog.FindChunk(Project.RootDir, ChunkId, OptionalInOutModificationTag); @@ -6066,6 +6068,7 @@ ProjectStore::LockState(GcCtx& Ctx) ZEN_TRACE_CPU("Store::LockState"); auto Log = [&Ctx]() { return Ctx.Logger; }; + ZEN_UNUSED(Log); std::vector<RwLock::SharedLockScope> Locks; Locks.emplace_back(RwLock::SharedLockScope(m_ProjectsLock)); @@ -6198,6 +6201,7 @@ ProjectStore::CreateReferenceValidators(GcCtx& Ctx) } auto Log = [&Ctx]() { return Ctx.Logger; }; + ZEN_UNUSED(Log); DiscoverProjects(); @@ -6408,6 +6412,7 @@ TEST_CASE("project.opkeys") Cbo << "key"sv << LongKey.substr(0, i); const Oid KeyId = ComputeOpKey(Cbo.Save()); + ZEN_UNUSED(KeyId); } { diff --git a/src/zenstore/workspaces.cpp b/src/zenstore/workspaces.cpp index c2391588c..f0f975af4 100644 --- a/src/zenstore/workspaces.cpp +++ b/src/zenstore/workspaces.cpp @@ -332,6 +332,7 @@ ScanFolder(LoggerRef InLog, const std::filesystem::path& Path, WorkerThreadPool& ZEN_TRACE_CPU("workspaces::ScanFolderImpl"); auto Log = [&InLog]() { return InLog; }; + ZEN_UNUSED(Log); FolderScanner Data(InLog, WorkerPool, Path); Data.Traverse(); @@ -353,6 +354,7 @@ WorkspaceShare::GetAbsolutePath(const std::filesystem::path& RootPath, const Oid const FolderStructure::FileEntry* Entry = m_FolderStructure->FindEntry(Id); if (Entry == nullptr) { + OutSize = 0; return {}; } OutSize = Entry->Size; @@ -589,7 +591,7 @@ Workspaces::GetWorkspaceShareChunks(const Oid& WorkspaceId, auto GetOne = [this](const std::filesystem::path& RootPath, WorkspaceShare& Share, const ChunkRequest& Request) -> IoBuffer { uint64_t Size; - std::filesystem::path Path = Share.GetAbsolutePath(RootPath, Request.ChunkId, Size); + std::filesystem::path Path = Share.GetAbsolutePath(RootPath, Request.ChunkId, /* out */ Size); if (!Path.empty()) { uint64_t RequestedOffset = Request.Offset; @@ -1042,6 +1044,7 @@ Workspaces::WorkspaceConfiguration Workspaces::FindWorkspace(const LoggerRef& InLog, const std::filesystem::path& WorkspaceStatePath, const Oid& WorkspaceId) { auto Log = [&InLog]() { return InLog; }; + ZEN_UNUSED(Log); std::string Error; std::vector<WorkspaceConfiguration> Workspaces = ReadConfig(InLog, WorkspaceStatePath, Error); @@ -1067,6 +1070,7 @@ Workspaces::FindWorkspace(const LoggerRef& InLog, const std::filesystem::path& WorkspaceRoot) { auto Log = [&InLog]() { return InLog; }; + ZEN_UNUSED(Log); std::string Error; std::vector<WorkspaceConfiguration> Workspaces = ReadConfig(InLog, WorkspaceStatePath, Error); |