Skip to content

Commit

Permalink
thread_id_pool.h: mark variable as [[maybe_unused]]
Browse files Browse the repository at this point in the history
mark a variable only used in an assert as [[maybe_unused]] so that non debug builds don't give warnings when compiling with `-Wunused-but-set-variable`

```
parlaylib/include/parlay/internal/../internal/../internal/thread_id_pool.h:50:12: warning: variable 'num_destroyed' set but not used [-Wunused-but-set-variable]
   50 |     size_t num_destroyed = 0;
```
  • Loading branch information
wheatman authored Jan 9, 2024
1 parent f8e38c7 commit 7c64b50
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/parlay/internal/thread_id_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ThreadIdPool : public std::enable_shared_from_this<ThreadIdPool> {


~ThreadIdPool() noexcept {
size_t num_destroyed = 0;
[[maybe_unused]] size_t num_destroyed = 0;
for (auto current = available_ids.load(std::memory_order_relaxed); current; num_destroyed++) {
auto old = std::exchange(current, current->next);
delete old;
Expand Down

0 comments on commit 7c64b50

Please sign in to comment.