Repository navigation
Commit e6644e7
authored
Fix -Wunused-result warning in ThreadPool::AddTask (colmap#4958)
## Summary
The finished-task checker in ThreadPool::AddTask calls
shared_future::get() only to rethrow task exceptions through
Wait()/Stop(); the return value is already available via the returned
future. For non-void tasks, get() is [[nodiscard]], which produced
-Wunused-result warnings (e.g. for bool and std::optional<InitInfo>
tasks). Discard the value explicitly with a (void) cast, matching the
existing idiom in undistorters.cc. Apply the same discard to the
NoArgReturn and ArgReturn tests, and add
WaitPropagatesExceptionWithReturnValue to cover exception propagation
from a value-returning task.
## Tests
- Rebuilt undistorters.cc and incremental_mapper_impl.cc with no
-Wunused-result warnings.
- colmap_util_threading_test: 35 tests passed, including the new test.1 parent 30a1a81 commit e6644e7
2 files changed
Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
363 | | - | |
| 363 | + | |
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
523 | 523 | | |
524 | 524 | | |
525 | 525 | | |
526 | | - | |
| 526 | + | |
527 | 527 | | |
528 | 528 | | |
529 | 529 | | |
| |||
543 | 543 | | |
544 | 544 | | |
545 | 545 | | |
546 | | - | |
| 546 | + | |
547 | 547 | | |
548 | 548 | | |
549 | 549 | | |
| |||
647 | 647 | | |
648 | 648 | | |
649 | 649 | | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
650 | 657 | | |
651 | 658 | | |
652 | 659 | | |
| |||
0 commit comments