From 84fdf3b7da3472790ff894220b445035d30d8e70 Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Tue, 21 Feb 2023 12:38:25 +0100 Subject: fix false positive warning with gcc12 --- test/buildtool/execution_engine/executor/executor.test.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'test/buildtool/execution_engine/executor/executor.test.cpp') diff --git a/test/buildtool/execution_engine/executor/executor.test.cpp b/test/buildtool/execution_engine/executor/executor.test.cpp index 8e187115..6793014b 100644 --- a/test/buildtool/execution_engine/executor/executor.test.cpp +++ b/test/buildtool/execution_engine/executor/executor.test.cpp @@ -143,10 +143,15 @@ class TestApi : public IExecutionApi { bool /*unused*/) noexcept -> bool final { return false; // not needed by Executor } - auto RetrieveToCas(std::vector const& /*unused*/, + auto RetrieveToCas(std::vector const& unused, gsl::not_null const& /*unused*/) noexcept -> bool final { - return false; // not needed by Executor + // Note that a false-positive "free-nonheap-object" warning is thrown by + // gcc 12.2 with GNU libstdc++, if the caller passes a temporary vector + // that is not used by this function. Therefore, we explicitly use this + // vector here to suppress this warning. The actual value returned is + // irrelevant for testing though. + return unused.empty(); // not needed by Executor } auto Upload(BlobContainer const& blobs, bool /*unused*/) noexcept -> bool final { -- cgit v1.2.3