Skip to content

Commit d9da54e

Browse files
treat unused parameter as error (#1608)
--------- Signed-off-by: romintomasetti <romin.tomasetti@gmail.com> Co-authored-by: Eric Niebler <eniebler@nvidia.com>
1 parent 730b263 commit d9da54e

14 files changed

Lines changed: 17 additions & 18 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ add_library(stdexec_executable_flags INTERFACE)
226226

227227
# Enable warnings
228228
target_compile_options(stdexec_executable_flags INTERFACE
229-
$<$<STREQUAL:${stdexec_compiler_frontend},GNU>:-Wall>
229+
$<$<STREQUAL:${stdexec_compiler_frontend},GNU>:-Wall;-Werror=unused-parameter>
230230
$<$<STREQUAL:${stdexec_compiler_frontend},AppleClang>:-Wall>
231231
$<$<STREQUAL:${stdexec_compiler_frontend},MSVC>:/W4>)
232232

examples/nvexec/launch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ auto main() -> int {
4949
auto snd = stdexec::transfer_just(stream.get_scheduler(), first, last)
5050
| nvexec::launch(
5151
{.grid_size = NUM_BLOCKS, .block_size = THREAD_BLOCK_SIZE},
52-
[](cudaStream_t stm, int* first, int* last) {
52+
[](cudaStream_t, int* first, int* last) {
5353
assert(nvexec::is_on_gpu());
5454
int32_t idx = blockIdx.x * blockDim.x + threadIdx.x;
5555
if (idx < (last - first)) {

examples/nvexec/maxwell/common.cuh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ class result_dumper_t {
366366
, accessor_(accessor) {
367367
}
368368

369-
void operator()(bool update_time = true) const {
369+
void operator()([[maybe_unused]] bool update_time = true) const {
370370
int rank_ = 0;
371371
const std::string filename = std::string("output_") + std::to_string(rank_) + "_"
372372
+ std::to_string(0) + ".vtk";

examples/nvexec/maxwell/stdpar.cuh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include <thrust/iterator/counting_iterator.h>
3333

3434
template <class Policy>
35-
auto is_gpu_policy(Policy&& policy) -> bool {
35+
auto is_gpu_policy([[maybe_unused]] Policy&& policy) -> bool {
3636
#if defined(_NVHPC_CUDA) || defined(__CUDACC__)
3737
bool* flag{};
3838
STDEXEC_TRY_CUDA_API(cudaMallocHost(&flag, sizeof(bool)));

include/exec/start_now.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ namespace exec {
8989
__storage_base<_EnvId>* __stg_;
9090

9191
template <class... _As>
92-
void set_value(_As&&... __as) noexcept {
92+
void set_value(_As&&...) noexcept {
9393
__stg_->__complete();
9494
}
9595

include/exec/task.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ namespace exec {
157157
struct __default_awaiter_context {
158158
template <__scheduler_affinity _Affinity>
159159
explicit __default_awaiter_context(
160-
__default_task_context_impl<_Affinity>& __self,
161-
_ParentPromise& __parent) noexcept {
160+
__default_task_context_impl<_Affinity>&,
161+
_ParentPromise&) noexcept {
162162
}
163163
};
164164

@@ -225,8 +225,8 @@ namespace exec {
225225
struct __default_awaiter_context<void> {
226226
template <__scheduler_affinity _Affinity, class _ParentPromise>
227227
explicit __default_awaiter_context(
228-
__default_task_context_impl<_Affinity>& __self,
229-
_ParentPromise& __parent) noexcept {
228+
__default_task_context_impl<_Affinity>&,
229+
_ParentPromise&) noexcept {
230230
}
231231

232232
template <__scheduler_affinity _Affinity, __indirect_stop_token_provider _ParentPromise>

include/nvexec/detail/memory.cuh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ namespace nvexec::_strm {
314314
, live_blocks(ptr_comparator_t{}) {
315315
}
316316

317-
auto do_allocate(const std::size_t bytes, const std::size_t alignment) -> void* override {
317+
auto do_allocate(const std::size_t bytes, [[maybe_unused]]const std::size_t alignment) -> void* override {
318318
assert(alignment <= block_alignment);
319319

320320
std::lock_guard<std::mutex> lock(mutex);

include/nvexec/detail/queue.cuh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ namespace nvexec::_strm::queue {
6868

6969
struct root_task_t : task_base_t {
7070
root_task_t() {
71-
this->execute_ = [](task_base_t* t) noexcept {
72-
};
71+
this->execute_ = [](task_base_t*) noexcept {};
7372
this->free_ = [](task_base_t* t) noexcept {
7473
STDEXEC_ASSERT_CUDA_API(cudaFree(static_cast<void*>(t->atom_next_)));
7574
};

include/nvexec/detail/throw_on_cuda_error.cuh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ namespace nvexec::detail {
6565
}
6666

6767
[[nodiscard]]
68-
inline auto log_on_cuda_error(cudaError_t status, char const * file_name, int line) noexcept
68+
inline auto log_on_cuda_error(cudaError_t status, [[maybe_unused]] char const *const file_name, [[maybe_unused]] const int line) noexcept
6969
-> ::cudaError_t {
7070
// Clear the global CUDA error state which may have been set by the last
7171
// call. Otherwise, errors may "leak" to unrelated calls.

include/stdexec/__detail/__submit.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ namespace stdexec {
135135
: __result_(connect(static_cast<_Sender&&>(__sndr), static_cast<_Receiver&&>(__rcvr))) {
136136
}
137137

138-
void submit(_Sender&& __sndr, _Receiver&&) noexcept {
138+
void submit(_Sender&&, _Receiver&&) noexcept {
139139
stdexec::start(__result_);
140140
}
141141

0 commit comments

Comments
 (0)