Skip to content

Commit

Permalink
#2264: fix unused variable warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed May 14, 2024
1 parent 6fe9ed0 commit 5bff41e
Show file tree
Hide file tree
Showing 118 changed files with 345 additions and 209 deletions.
2 changes: 1 addition & 1 deletion examples/callback/callback.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ struct MyObj {
struct MyCol : vt::Collection<MyCol, vt::Index1D> { };

// Collection handler callback endpoint
void colHan(MyCol* col, TestMsg* msg) {
void colHan([[maybe_unused]] MyCol* col, [[maybe_unused]] TestMsg* msg) {
printOutput(msg, "MyCol colHan (non-intrusive)");
}

Expand Down
2 changes: 1 addition & 1 deletion examples/collection/jacobi1d_vt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ struct LinearPb1DJacobi : vt::Collection<LinearPb1DJacobi,vt::Index1D> {

}

void doIter(BlankMsg *msg) {
void doIter([[maybe_unused]] BlankMsg *msg) {

//
// Treat the particular case of 1 object
Expand Down
2 changes: 1 addition & 1 deletion examples/collection/jacobi2d_vt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ struct LinearPb2DJacobi : vt::Collection<LinearPb2DJacobi,vt::Index2D> {

}

void doIter(BlankMsg *msg) {
void doIter([[maybe_unused]] BlankMsg *msg) {

//
// Treat the particular case of 1 object
Expand Down
4 changes: 3 additions & 1 deletion examples/collection/lb_iter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ struct IterCol : vt::Collection<IterCol, vt::Index1D> {

static double weight = 1.0f;

void IterCol::iterWork(int64_t work_amt, int64_t iter, int subphase) {
void IterCol::iterWork(
int64_t work_amt, [[maybe_unused]] int64_t iter, int subphase
) {
this->lb_data_.setSubPhase(subphase);
double val = 0.1f;
double val2 = 0.4f * work_amt;
Expand Down
6 changes: 4 additions & 2 deletions examples/collection/transpose.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ struct Block : vt::Collection<Block, vt::Index1D> {
}
}

void solve(SolveMsg<Block>* msg) {
void solve([[maybe_unused]] SolveMsg<Block>* msg) {
// Invoke initialize here so that the index is ready
initialize();
// Wait for all initializations to complete
Expand All @@ -190,7 +190,9 @@ struct Block : vt::Collection<Block, vt::Index1D> {

//using ActiveMapTypedFnType = NodeType(IndexT*, IndexT*, NodeType);
template <typename IndexT>
vt::NodeType my_map(IndexT* idx, IndexT* max_idx, vt::NodeType num_nodes) {
vt::NodeType my_map(
IndexT* idx, [[maybe_unused]] IndexT* max_idx, vt::NodeType num_nodes
) {
// simple round-robin for 1-d only.
return idx->x() % num_nodes;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/group/group_collective.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
/// [Collective group creation]
struct HelloGroupMsg : vt::Message { };

static void hello_group_handler(HelloGroupMsg* msg) {
static void hello_group_handler([[maybe_unused]] HelloGroupMsg* msg) {
fmt::print("{}: Hello from group handler\n", vt::theContext()->getNode());
}

Expand Down
2 changes: 1 addition & 1 deletion examples/hello_world/hello_world_functor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct MultipleFunctions {
fmt::print("{}: MultipleFunctions -> Hello from node {}\n", vt::theContext()->getNode(), msg->from);
}

void operator()(AnotherMsg* msg) const {
void operator()([[maybe_unused]] AnotherMsg* msg) const {
fmt::print("{}: MultipleFunctions with AnotherMsg\n", vt::theContext()->getNode());
}
};
Expand Down
2 changes: 1 addition & 1 deletion examples/rdma/rdma_simple_get.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static void tell_handle(HandleMsg* msg) {
static std::unique_ptr<double[]> my_data = nullptr;

static vt::RDMA_GetType test_get_fn(
vt::BaseMessage*, vt::ByteType num_bytes, vt::ByteType offset, vt::TagType tag,
vt::BaseMessage*, vt::ByteType num_bytes, [[maybe_unused]] vt::ByteType offset, vt::TagType tag,
bool
) {
vt::NodeType this_node = vt::theContext()->getNode();
Expand Down
4 changes: 3 additions & 1 deletion src/vt/collective/barrier/barrier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ Barrier::BarrierStateType& Barrier::insertFindBarrier(
}

void Barrier::removeBarrier(
bool const& is_named, bool const& is_wait, BarrierType const& barrier
bool const& is_named,
[[maybe_unused]] bool const& is_wait,
BarrierType const& barrier
) {
auto& state = is_named ? named_barrier_state_ : unnamed_barrier_state_;

Expand Down
2 changes: 1 addition & 1 deletion src/vt/collective/reduce/operators/callback_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace vt { namespace collective { namespace reduce { namespace operators {

template <typename T = void>
struct ReduceCallback {
void operator()(T* t) const { /* do nothing */ }
void operator()([[maybe_unused]] T* t) const { /* do nothing */ }
};

}}}} /* end namespace vt::collective::reduce::operators */
Expand Down
2 changes: 1 addition & 1 deletion src/vt/collective/reduce/operators/functors/none_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct None {
"Must be empty data"
);

void operator()(T& v1, T const& v2) {}
void operator()([[maybe_unused]] T& v1, [[maybe_unused]] T const& v2) {}
};

}}}} /* end namespace vt::collective::reduce::operators */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ struct ApplyOp<Op, cur, max, std::enable_if_t<cur != max>> {
template <typename Op, int cur, int max>
struct ApplyOp<Op, cur, max, std::enable_if_t<cur == max>> {
template <typename Tuple1, typename Tuple2>
static void apply(Tuple1& t1, Tuple2 const& t2) { }
static void apply(
[[maybe_unused]] Tuple1& t1, [[maybe_unused]] Tuple2 const& t2
) { }
};

//
Expand Down
9 changes: 7 additions & 2 deletions src/vt/configs/arguments/args.cc
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,10 @@ void addRuntimeArgs(CLI::App& app, AppConfig& appConfig) {
a3->group(configRuntime);
}

void addThreadingArgs(CLI::App& app, AppConfig& appConfig) {
void addThreadingArgs(
[[maybe_unused]] CLI::App& app,
[[maybe_unused]] AppConfig& appConfig
) {
#if (vt_feature_fcontext != 0)
auto ult_disable = "Disable running handlers in user-level threads";
auto stack_size = "The default stack size for user-level threads";
Expand All @@ -701,7 +704,9 @@ ArgConfig::construct(std::unique_ptr<ArgConfig> arg) {

class VtFormatter : public CLI::Formatter {
public:
std::string make_usage(const CLI::App *, std::string name) const override {
std::string make_usage(
const CLI::App *, [[maybe_unused]] std::string name
) const override {
std::stringstream u;
u << "\n"
"Usage:"
Expand Down
2 changes: 1 addition & 1 deletion src/vt/configs/error/assert_out.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ std::enable_if_t<std::tuple_size<std::tuple<Args...>>::value == 0>
assertOut(
bool fail, std::string const cond, std::string const& str,
std::string const& file, int const line, std::string const& func,
ErrorCodeType error, std::tuple<Args...>&& tup
ErrorCodeType error, [[maybe_unused]] std::tuple<Args...>&& tup
) {
auto msg = "Assertion failed:";
auto assert_fail_str = stringizeMessage(msg,str,cond,file,line,func,error);
Expand Down
3 changes: 2 additions & 1 deletion src/vt/configs/error/assert_out_info.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ std::enable_if_t<std::tuple_size<std::tuple<Args...>>::value == 0>
assertOutInfo(
bool fail, std::string const cond, std::string const& str,
std::string const& file, int const line, std::string const& func,
ErrorCodeType error, std::tuple<Args2...>&& tup, std::tuple<Args...>&& t2
ErrorCodeType error, [[maybe_unused]] std::tuple<Args2...>&& tup,
std::tuple<Args...>&& t2
) {
return assertOut(
fail,cond,str,file,line,func,error,std::forward<std::tuple<Args...>>(t2)
Expand Down
6 changes: 4 additions & 2 deletions src/vt/configs/error/error.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ namespace vt { namespace error {
template <typename... Args>
inline
std::enable_if_t<std::tuple_size<std::tuple<Args...>>::value == 0>
display(std::string const& str, ErrorCodeType error, Args&&... args) {
display(
std::string const& str, ErrorCodeType error, [[maybe_unused]] Args&&... args
) {
std::string const inf = ::fmt::format("FATAL ERROR: {}\n",str);
return ::vt::abort(inf,error);
}
Expand All @@ -81,7 +83,7 @@ std::enable_if_t<std::tuple_size<std::tuple<Args...>>::value == 0>
displayLoc(
std::string const& str, ErrorCodeType error,
std::string const& file, int const line, std::string const& func,
std::tuple<Args...>&& tup
[[maybe_unused]] std::tuple<Args...>&& tup
) {
auto msg = "vtAbort() Invoked";
auto const inf = debug::stringizeMessage(msg,str,"",file,line,func,error);
Expand Down
2 changes: 1 addition & 1 deletion src/vt/configs/error/soft_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ inline std::enable_if_t<std::tuple_size<std::tuple<Args...>>::value == 0>
warningImpl(
std::string const& str, ErrorCodeType error, bool quit,
std::string const& file, int const line, std::string const& func,
Args&&... args
[[maybe_unused]] Args&&... args
) {
auto msg = "vtWarn() Invoked";
auto inf = debug::stringizeMessage(msg,str,"",file,line,func,error);
Expand Down
2 changes: 1 addition & 1 deletion src/vt/context/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct RunnableNew {};

namespace vt { namespace ctx {

Context::Context(bool const is_interop, MPI_Comm comm) {
Context::Context([[maybe_unused]] bool const is_interop, MPI_Comm comm) {
#if DEBUG_VT_CONTEXT
fmt::print(
"Context::Context is_interop={}, comm={}\n", print_bool(is_interop), comm
Expand Down
2 changes: 1 addition & 1 deletion src/vt/event/event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ void AsyncEvent::finalize() {
event_container_.clear();
}

int AsyncEvent::progress(TimeType current_time) {
int AsyncEvent::progress([[maybe_unused]] TimeType current_time) {
theEvent()->testEventsTrigger();
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions src/vt/group/collective/group_info_collective.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ void InfoColl::setupCollective() {
);
GroupOnlyTMsg::registerContinuationT(
new_tree_cont_,
[group_](MsgSharedPtr<GroupOnlyMsg> msg){
[group_]([[maybe_unused]] MsgSharedPtr<GroupOnlyMsg> msg){
auto iter = theGroup()->local_collective_group_info_.find(group_);
vtAssertExpr(iter != theGroup()->local_collective_group_info_.end());
auto const& from = theContext()->getFromNodeCurrentTask();
Expand Down Expand Up @@ -766,7 +766,7 @@ void InfoColl::finalizeTree(GroupOnlyMsg* msg) {
finalize();
}

void InfoColl::downTreeFinished(GroupOnlyMsg* msg) {
void InfoColl::downTreeFinished([[maybe_unused]] GroupOnlyMsg* msg) {
send_down_finished_++;
finalize();
}
Expand Down
11 changes: 6 additions & 5 deletions src/vt/group/group_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ void GroupManager::triggerContinuation(RemoteOperationIDType const op) {
}

void GroupManager::initializeRemoteGroup(
GroupType const group, RegionPtrType in_region, bool const is_static,
RegionType::SizeType const group_size
GroupType const group, RegionPtrType in_region,
[[maybe_unused]] bool const is_static, RegionType::SizeType const group_size
) {
auto group_info = std::make_unique<GroupInfoType>(
info_rooted_remote_cons, default_comm_,
Expand Down Expand Up @@ -227,8 +227,8 @@ MPI_Comm GroupManager::getGroupComm(GroupType const group_id) {
}

void GroupManager::initializeLocalGroupCollective(
GroupType const group, bool const is_static, ActionType action,
bool const in_group, bool make_mpi_group
GroupType const group, [[maybe_unused]] bool const is_static,
ActionType action, bool const in_group, bool make_mpi_group
) {
auto group_info = std::make_unique<GroupInfoType>(
info_collective_cons, default_comm_,
Expand All @@ -244,7 +244,8 @@ void GroupManager::initializeLocalGroupCollective(
}

void GroupManager::initializeLocalGroup(
GroupType const group, RegionPtrType in_region, bool const is_static, ActionType action
GroupType const group, RegionPtrType in_region,
[[maybe_unused]] bool const is_static, ActionType action
) {

auto const group_size = in_region->getSize();
Expand Down
6 changes: 4 additions & 2 deletions src/vt/messaging/active.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,7 @@ bool ActiveMessenger::testPendingAsyncOps() {
);
}

int ActiveMessenger::progress(TimeType current_time) {
int ActiveMessenger::progress([[maybe_unused]] TimeType current_time) {
bool const started_irecv_active_msg = tryProcessIncomingActiveMsg();
bool const started_irecv_data_msg = tryProcessDataMsgRecv();
bool const received_active_msg = testPendingActiveMsgAsyncRecv();
Expand All @@ -1167,7 +1167,9 @@ void ActiveMessenger::registerAsyncOp(std::unique_ptr<AsyncOp> in) {
in_progress_ops.emplace(AsyncOpWrapper{std::move(in)});
}

void ActiveMessenger::blockOnAsyncOp(std::unique_ptr<AsyncOp> op) {
void ActiveMessenger::blockOnAsyncOp(
[[maybe_unused]] std::unique_ptr<AsyncOp> op
) {
#if vt_check_enabled(fcontext)
using TA = sched::ThreadAction;
auto tid = TA::getActiveThreadID();
Expand Down
4 changes: 2 additions & 2 deletions src/vt/messaging/active.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ ActiveMessenger::PendingSendType ActiveMessenger::sendMsgAuto(
template <typename MsgT, ActiveTypedFnType<MsgT>* f>
ActiveMessenger::PendingSendType ActiveMessenger::broadcastMsgSz(
MsgPtrThief<MsgT> msg,
ByteType msg_size,
[[maybe_unused]] ByteType msg_size,
bool deliver_to_sender,
TagType tag
) {
Expand Down Expand Up @@ -265,7 +265,7 @@ template <typename MsgT, ActiveTypedFnType<MsgT>* f>
ActiveMessenger::PendingSendType ActiveMessenger::sendMsgSz(
NodeType dest,
MsgPtrThief<MsgT> msg,
ByteType msg_size,
[[maybe_unused]] ByteType msg_size,
TagType tag
) {
auto const han = auto_registry::makeAutoHandler<MsgT,f>();
Expand Down
31 changes: 23 additions & 8 deletions src/vt/messaging/message/message_priority.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,27 @@
namespace vt { namespace messaging {

template <typename MsgT>
void msgSetPriorityLevel(MsgT ptr, PriorityLevelType level) {
void msgSetPriorityLevel(
[[maybe_unused]] MsgT ptr, [[maybe_unused]] PriorityLevelType level
) {
# if vt_check_enabled(priorities)
envelopeSetPriorityLevel(ptr->env, level);
# endif
}

template <typename MsgT>
void msgSetPriorityAllLevels(MsgT ptr, PriorityType priority) {
void msgSetPriorityAllLevels(
[[maybe_unused]] MsgT ptr, [[maybe_unused]] PriorityType priority
) {
# if vt_check_enabled(priorities)
envelopeSetPriority(ptr->env, priority);
# endif
}

template <typename MsgT, typename MsgU>
bool msgIncPriorityLevel(MsgT old_msg, MsgU new_msg) {
bool msgIncPriorityLevel(
[[maybe_unused]] MsgT old_msg, [[maybe_unused]] MsgU new_msg
) {
# if vt_check_enabled(priorities)
auto const level = envelopeGetPriorityLevel(old_msg->env);
if (level + 1 < sched::priority_num_levels) {
Expand All @@ -78,7 +84,11 @@ bool msgIncPriorityLevel(MsgT old_msg, MsgU new_msg) {
}

template <typename MsgU>
void msgSetPriority(MsgU new_msg, PriorityType priority, bool increment_level) {
void msgSetPriority(
[[maybe_unused]] MsgU new_msg,
[[maybe_unused]] PriorityType priority,
[[maybe_unused]] bool increment_level
) {
# if vt_check_enabled(priorities)
PriorityLevelType const level = increment_level ? 1 : 0;
PriorityType old_priority = vt::min_priority;
Expand All @@ -88,8 +98,10 @@ void msgSetPriority(MsgU new_msg, PriorityType priority, bool increment_level) {

template <typename MsgU>
void msgSetPriorityImpl(
MsgU new_msg, PriorityType new_priority, PriorityType old_priority,
PriorityLevelType level
[[maybe_unused]] MsgU new_msg,
[[maybe_unused]] PriorityType new_priority,
[[maybe_unused]] PriorityType old_priority,
[[maybe_unused]] PriorityLevelType level
) {
# if vt_check_enabled(priorities)

Expand All @@ -115,7 +127,8 @@ void msgSetPriorityImpl(

template <typename MsgT, typename MsgU>
void msgSetPriorityFrom(
MsgT old_msg, MsgU new_msg, PriorityType priority, bool increment_level
[[maybe_unused]] MsgT old_msg, [[maybe_unused]] MsgU new_msg,
[[maybe_unused]] PriorityType priority, [[maybe_unused]] bool increment_level
) {
# if vt_check_enabled(priorities)
vtAssert(old_msg != nullptr, "Must have a valid message");
Expand All @@ -130,7 +143,9 @@ void msgSetPriorityFrom(
}

template <typename MsgT>
void msgSystemSetPriority(MsgT ptr, PriorityType priority) {
void msgSystemSetPriority(
[[maybe_unused]] MsgT ptr, [[maybe_unused]] PriorityType priority
) {
# if vt_check_enabled(priorities)
PriorityType prior = no_priority;
envelopeSetPriorityLevel(ptr->env, 0);
Expand Down
6 changes: 4 additions & 2 deletions src/vt/messaging/param_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,16 @@ struct MsgProps {
return std::move(*this);
}

MsgProps&& withPriority(PriorityType in_priority) {
MsgProps&& withPriority([[maybe_unused]] PriorityType in_priority) {
#if vt_check_enabled(priorities)
priority_ = in_priority;
#endif
return std::move(*this);
}

MsgProps&& withPriorityLevel(PriorityLevelType in_priority_level) {
MsgProps&& withPriorityLevel(
[[maybe_unused]] PriorityLevelType in_priority_level
) {
#if vt_check_enabled(priorities)
priority_level_ = in_priority_level;
#endif
Expand Down
Loading

0 comments on commit 5bff41e

Please sign in to comment.