Skip to content

Commit 75f7a46

Browse files
author
abacus_fixer
committed
fix: eliminate variadic macro warnings in REQUIRES_OK
Two related warnings were triggered: - -Wvariadic-macro-arguments-omitted: memory.h called REQUIRES_OK with only one argument (no variadic arg) - -Wgnu-zero-variadic-macro-arguments: macros.h used GNU extension '##__VA_ARGS__' to swallow the comma when __VA_ARGS__ was empty Fix: 1. Add a message argument to the single-arg REQUIRES_OK call site 2. Drop the '##' GNU extension since all call sites now pass at least one variadic argument
1 parent 5f3af73 commit 75f7a46

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

source/source_base/module_container/ATen/kernels/memory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ struct synchronize_memory_stride {
8181
const std::vector<int64_t>& out_size,
8282
const std::vector<int64_t>& in_size)
8383
{
84-
REQUIRES_OK(in_size.size() == out_size.size() && in_size.size() <= 2);
84+
REQUIRES_OK(in_size.size() == out_size.size() && in_size.size() <= 2, "rank mismatch: in_size and out_size must have the same rank <= 2");
8585
if (in_size.size() == 1) {
8686
synchronize_memory<T, Device_out, Device_in>()(arr_out, arr_in, in_size[0]);
8787
}

source/source_base/module_container/base/macros/macros.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
__func__, \
7171
__FILE__, \
7272
static_cast<uint32_t>(__LINE__), \
73-
CHECK_MSG(expr, ##__VA_ARGS__)); \
73+
CHECK_MSG(expr, __VA_ARGS__)); \
7474
}
7575

7676
// The macro TEMPLATE_1() expands to a switch statement conditioned on

0 commit comments

Comments
 (0)