Skip to content

Commit 2f3d4e1

Browse files
hjmjohnsonclaude
andcommitted
COMP: Silence nodiscard warnings for Future.get() in PoolMultiThreader
Cast Future.get() return values to void where the call is only used for its side effect of waiting for thread completion and propagating exceptions. Fixes the following warnings: ``` ITK/Modules/Core/Common/src/itkPoolMultiThreader.cxx:148:55: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result] ITK/Modules/Core/Common/src/itkPoolMultiThreader.cxx:303:11: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result] This is for clang-22 compilers. ``` Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7ed3dab commit 2f3d4e1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Modules/Core/Common/src/itkPoolMultiThreader.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ PoolMultiThreader::SingleMethodExecute()
145145
// so now it waits for each of the other work units to finish
146146
for (threadLoop = 1; threadLoop < m_NumberOfWorkUnits; ++threadLoop)
147147
{
148-
exceptionHandler.TryAndCatch([this, threadLoop] { m_ThreadInfoArray[threadLoop].Future.get(); });
148+
exceptionHandler.TryAndCatch([this, threadLoop] { (void)m_ThreadInfoArray[threadLoop].Future.get(); });
149149
}
150150

151151
exceptionHandler.RethrowFirstCaughtException();
@@ -300,7 +300,7 @@ PoolMultiThreader::ParallelizeImageRegion(unsigned int dimension,
300300
filter->IncrementProgress(0);
301301
}
302302
} while (status != std::future_status::ready);
303-
m_ThreadInfoArray[i].Future.get();
303+
(void)m_ThreadInfoArray[i].Future.get();
304304
reporter.CompletedPixel();
305305
});
306306
}

0 commit comments

Comments
 (0)