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 authored and cwschilly committed Sep 20, 2024
1 parent 7724632 commit c843314
Show file tree
Hide file tree
Showing 18 changed files with 94 additions and 45 deletions.
2 changes: 1 addition & 1 deletion src/vt/context/runnable_context/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ struct Trace {
struct Trace {

template <typename... Args>
Trace(Args&&... args) {}
Trace([[maybe_unused]] Args&&... args) {}

};

Expand Down
4 changes: 3 additions & 1 deletion src/vt/messaging/active.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ void ActiveMessenger::startup() {
/*virtual*/ ActiveMessenger::~ActiveMessenger() {}

trace::TraceEventIDType ActiveMessenger::makeTraceCreationSend(
HandlerType const handler, ByteType serialized_msg_size, bool is_bcast
[[maybe_unused]] HandlerType const handler,
[[maybe_unused]] ByteType serialized_msg_size,
[[maybe_unused]] bool is_bcast
) {
#if vt_check_enabled(trace_enabled)
trace::TraceEntryIDType ep = auto_registry::handlerTraceID(handler);
Expand Down
12 changes: 9 additions & 3 deletions src/vt/messaging/active.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,27 @@ void ActiveMessenger::markAsTermMessage(MsgPtrT const msg) {
}

template <typename MsgPtrT>
void ActiveMessenger::markAsLocationMessage(MsgPtrT const msg) {
void ActiveMessenger::markAsLocationMessage(
[[maybe_unused]] MsgPtrT const msg
) {
#if vt_check_enabled(trace_enabled)
envelopeSetTraceRuntimeEnabled(msg->env, theConfig()->traceLocation());
#endif
}

template <typename MsgPtrT>
void ActiveMessenger::markAsSerialMsgMessage(MsgPtrT const msg) {
void ActiveMessenger::markAsSerialMsgMessage(
[[maybe_unused]] MsgPtrT const msg
) {
#if vt_check_enabled(trace_enabled)
envelopeSetTraceRuntimeEnabled(msg->env, theConfig()->traceSerialMsg());
#endif
}

template <typename MsgPtrT>
void ActiveMessenger::markAsCollectionMessage(MsgPtrT const msg) {
void ActiveMessenger::markAsCollectionMessage(
[[maybe_unused]] MsgPtrT const msg
) {
#if vt_check_enabled(trace_enabled)
envelopeSetTraceRuntimeEnabled(msg->env, theConfig()->traceCollection());
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/vt/pipe/pipe_manager_tl.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ auto PipeManagerTL::makeCallbackProxy(ProxyT proxy) {
}

template <auto f, bool is_bcast>
auto PipeManagerTL::makeCallbackSingle(NodeType node) {
auto PipeManagerTL::makeCallbackSingle([[maybe_unused]] NodeType node) {
auto const new_pipe_id = makePipeID(true,false);

using Trait = FuncTraits<decltype(f)>;
Expand Down
4 changes: 3 additions & 1 deletion src/vt/pool/pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ void Pool::dealloc(std::byte* const buf) {
}
}

Pool::SizeType Pool::remainingSize(std::byte* const buf) const {
Pool::SizeType Pool::remainingSize(
[[maybe_unused]] std::byte* const buf
) const {
#if vt_check_enabled(memory_pool)
auto const& actual_alloc_size = HeaderManagerType::getHeaderBytes(buf);
auto const& oversize = HeaderManagerType::getHeaderOversizeBytes(buf);
Expand Down
4 changes: 2 additions & 2 deletions src/vt/rdma/state/rdma_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ bool State::testReadyPutData(TagType const& tag) {

void State::getData(
GetMessage* msg, bool const& is_user_msg, RDMA_InfoType const& info,
NodeType const& from_node
[[maybe_unused]] NodeType const& from_node
) {
auto const& tag = info.tag;

Expand Down Expand Up @@ -289,7 +289,7 @@ void State::getData(

void State::putData(
PutMessage* msg, bool const& is_user_msg, RDMA_InfoType const& info,
NodeType const& from_node
[[maybe_unused]] NodeType const& from_node
) {
auto const& tag = info.tag;

Expand Down
14 changes: 11 additions & 3 deletions src/vt/registry/auto/auto_registry_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ inline AutoActiveType const& getAutoHandler(HandlerType const handler) {

template <typename ObjT, typename MsgT, objgroup::ActiveObjType<MsgT, ObjT> f>
void setHandlerTraceNameObjGroup(
HandlerControlType ctrl, std::string const& name, std::string const& parent
[[maybe_unused]] HandlerControlType ctrl,
[[maybe_unused]] std::string const& name,
[[maybe_unused]] std::string const& parent
) {
#if vt_check_enabled(trace_enabled)
auto const handler = makeAutoHandlerObjGroup<ObjT,MsgT,f>(ctrl);
Expand All @@ -210,7 +212,10 @@ void setHandlerTraceNameObjGroup(
}

template <typename MsgT, ActiveTypedFnType<MsgT>* f>
void setHandlerTraceName(std::string const& name, std::string const& parent) {
void setHandlerTraceName(
[[maybe_unused]] std::string const& name,
[[maybe_unused]] std::string const& parent
) {
#if vt_check_enabled(trace_enabled)
auto const handler = makeAutoHandler<MsgT,f>();
auto const trace_id = handlerTraceID(handler);
Expand All @@ -219,7 +224,10 @@ void setHandlerTraceName(std::string const& name, std::string const& parent) {
}

template <typename T, T value>
void setHandlerTraceName(std::string const& name, std::string const& parent) {
void setHandlerTraceName(
[[maybe_unused]] std::string const& name,
[[maybe_unused]] std::string const& parent
) {
#if vt_check_enabled(trace_enabled)
auto const handler = makeAutoHandlerParam<T,value>();
auto const trace_id = handlerTraceID(handler);
Expand Down
10 changes: 8 additions & 2 deletions src/vt/registry/auto/collection/auto_registry_collection.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ inline HandlerType makeAutoHandlerCollectionMemParam() {
}

template <typename ColT, typename MsgT, ActiveColTypedFnType<MsgT, ColT>* f>
void setHandlerTraceNameColl(std::string const& name, std::string const& parent) {
void setHandlerTraceNameColl(
[[maybe_unused]] std::string const& name,
[[maybe_unused]] std::string const& parent
) {
#if vt_check_enabled(trace_enabled)
auto const handler = makeAutoHandlerCollection<ColT,MsgT,f>();
auto const trace_id = handlerTraceID(handler);
Expand All @@ -121,7 +124,10 @@ void setHandlerTraceNameColl(std::string const& name, std::string const& parent)
}

template <typename ColT, typename MsgT, ActiveColMemberTypedFnType<MsgT, ColT> f>
void setHandlerTraceNameCollMem(std::string const& name, std::string const& parent) {
void setHandlerTraceNameCollMem(
[[maybe_unused]] std::string const& name,
[[maybe_unused]] std::string const& parent
) {
#if vt_check_enabled(trace_enabled)
auto const handler = makeAutoHandlerCollectionMem<ColT,MsgT,f>();
auto const trace_id = handlerTraceID(handler);
Expand Down
10 changes: 7 additions & 3 deletions src/vt/runnable/make_runnable.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ struct RunnableMaker {
* captured one)
*/
template <typename ElmT, typename MsgU>
RunnableMaker&& withLBData(ElmT* elm, MsgU* msg) {
RunnableMaker&& withLBData(
[[maybe_unused]] ElmT* elm, [[maybe_unused]] MsgU* msg
) {
#if vt_check_enabled(lblite)
impl_->addContextLB(elm, msg);
#endif
Expand All @@ -204,7 +206,9 @@ struct RunnableMaker {
* \param[in] elm_id the element ID
*/
template <typename LBDataT, typename T>
RunnableMaker&& withLBData(LBDataT* lb_data, T elm_id) {
RunnableMaker&& withLBData(
[[maybe_unused]] LBDataT* lb_data, [[maybe_unused]] T elm_id
) {
#if vt_check_enabled(lblite)
impl_->addContextLB(lb_data, elm_id);
#endif
Expand All @@ -217,7 +221,7 @@ struct RunnableMaker {
* \param[in] elm the element
*/
template <typename ElmT>
RunnableMaker&& withLBData(ElmT* elm) {
RunnableMaker&& withLBData([[maybe_unused]] ElmT* elm) {
#if vt_check_enabled(lblite)
impl_->addContextLB(elm, msg_.get());
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/vt/runtime/component/meter/counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ struct Counter : DiagnosticMeter {
*
* \param[in] val amount to increment
*/
void increment(T val = 1) {
void increment([[maybe_unused]] T val = 1) {
# if vt_check_enabled(diagnostics)
if (impl_) {
impl_->update(val);
Expand All @@ -90,7 +90,7 @@ struct Counter : DiagnosticMeter {
*
* \param[in] val amount to decrement
*/
void decrement(T val = 1) {
void decrement([[maybe_unused]] T val = 1) {
# if vt_check_enabled(diagnostics)
if (impl_) {
impl_->update(-val);
Expand Down
2 changes: 1 addition & 1 deletion src/vt/runtime/component/meter/gauge.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct Gauge : DiagnosticStatsPack<T> {
*
* \param[in] val the new value
*/
void update(T val) {
void update([[maybe_unused]] T val) {
# if vt_check_enabled(diagnostics)
this->updateStats(val);
# endif
Expand Down
2 changes: 1 addition & 1 deletion src/vt/runtime/component/meter/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct Timer : DiagnosticStatsPack<T> {
* \param[in] begin begin time of event being tracked
* \param[in] end end time of event being tracked
*/
void update(T begin, T end) {
void update([[maybe_unused]] T begin, [[maybe_unused]] T end) {
# if vt_check_enabled(diagnostics)
auto const duration = end - begin;
this->updateStats(duration);
Expand Down
5 changes: 4 additions & 1 deletion src/vt/trace/trace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,10 @@ void Trace::registerUserEventManual(
user_event_.user(name, id);
}

void insertNewUserEvent(UserEventIDType event, std::string const& name) {
void insertNewUserEvent(
[[maybe_unused]] UserEventIDType event,
[[maybe_unused]] std::string const& name
) {
#if vt_check_enabled(trace_enabled)
theTrace()->user_event_.insertEvent(event, name);
#endif
Expand Down
4 changes: 3 additions & 1 deletion src/vt/trace/trace_registry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ TraceRegistry::registerEventHashed(

/*static*/ void
TraceRegistry::setTraceName(
TraceEntryIDType id, std::string const& name, std::string const& type_name
[[maybe_unused]] TraceEntryIDType id,
[[maybe_unused]] std::string const& name,
[[maybe_unused]] std::string const& type_name
) {
#if vt_check_enabled(trace_enabled)
auto* events = TraceContainers::getEventContainer();
Expand Down
34 changes: 23 additions & 11 deletions src/vt/trace/trace_user.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,57 +51,63 @@

namespace vt { namespace trace {

UserEventIDType registerEventCollective(std::string const& name) {
UserEventIDType registerEventCollective(
[[maybe_unused]] std::string const& name
) {
#if vt_check_enabled(trace_enabled)
return theTrace()->registerUserEventColl(name);
#else
return 0;
#endif
}

UserEventIDType registerEventRooted(std::string const& name) {
UserEventIDType registerEventRooted([[maybe_unused]] std::string const& name) {
#if vt_check_enabled(trace_enabled)
return theTrace()->registerUserEventRoot(name);
#else
return 0;
#endif
}

UserEventIDType registerEventHashed(std::string const& name) {
UserEventIDType registerEventHashed([[maybe_unused]] std::string const& name) {
#if vt_check_enabled(trace_enabled)
return theTrace()->registerUserEventHash(name);
#else
return 0;
#endif
}

void addUserEvent(UserEventIDType event) {
void addUserEvent([[maybe_unused]] UserEventIDType event) {
#if vt_check_enabled(trace_enabled)
theTrace()->addUserEvent(event);
#endif
}

void addUserEventBracketed(UserEventIDType event, TimeType begin, TimeType end) {
void addUserEventBracketed(
[[maybe_unused]] UserEventIDType event, [[maybe_unused]] TimeType begin,
[[maybe_unused]] TimeType end
) {
#if vt_check_enabled(trace_enabled)
theTrace()->addUserEventBracketed(event, begin, end);
#endif
}

void addUserNote(std::string const& note) {
void addUserNote([[maybe_unused]] std::string const& note) {
#if vt_check_enabled(trace_enabled)
theTrace()->addUserNote(note);
#endif
}

void addUserData(int32_t data) {
void addUserData([[maybe_unused]] int32_t data) {
#if vt_check_enabled(trace_enabled)
theTrace()->addUserData(data);
#endif
}

void addUserBracketedNote(
TimeType const begin, TimeType const end, std::string const& note,
TraceEventIDType const event
[[maybe_unused]] TimeType const begin, [[maybe_unused]] TimeType const end,
[[maybe_unused]] std::string const& note,
[[maybe_unused]] TraceEventIDType const event
) {
#if vt_check_enabled(trace_enabled)
theTrace()->addUserBracketedNote(begin, end, note, event);
Expand All @@ -116,7 +122,10 @@ struct UserSplitHolder final {
/*static*/ std::unordered_map<std::string, TimeType> UserSplitHolder::split_ = {};
#endif

void addUserNotePre(std::string const& note, TraceEventIDType const) {
void addUserNotePre(
[[maybe_unused]] std::string const& note,
[[maybe_unused]] TraceEventIDType const
) {
#if vt_check_enabled(trace_enabled)
auto iter = UserSplitHolder::split_.find(note);
vtAssertExpr(iter == UserSplitHolder::split_.end());
Expand All @@ -128,7 +137,10 @@ void addUserNotePre(std::string const& note, TraceEventIDType const) {
#endif
}

void addUserNoteEpi(std::string const& in_note, TraceEventIDType const event) {
void addUserNoteEpi(
[[maybe_unused]] std::string const& in_note,
[[maybe_unused]] TraceEventIDType const event
) {
#if vt_check_enabled(trace_enabled)
auto iter = UserSplitHolder::split_.find(in_note);
vtAssertExpr(iter != UserSplitHolder::split_.end());
Expand Down
2 changes: 1 addition & 1 deletion src/vt/trace/trace_user.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ struct TraceScopedNote final {
TraceScopedNote(std::string const&, TraceEventIDType const = no_trace_event) { }

void end() { }
void setEvent(TraceEventIDType const in_event) { }
void setEvent([[maybe_unused]] TraceEventIDType const in_event) { }
};

struct TraceScopedEvent final {
Expand Down
15 changes: 9 additions & 6 deletions src/vt/vrt/collection/balance/zoltanlb/zoltanlb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,9 @@ std::unique_ptr<ZoltanLB::Graph> ZoltanLB::makeGraph() {
}

/*static*/ void ZoltanLB::getVertexList(
void *data, int gid_size, int lid_size, ZOLTAN_ID_PTR global_id,
ZOLTAN_ID_PTR local_id, int weight_dim, float *obj_weights, int *ierr
void *data, [[maybe_unused]] int gid_size, [[maybe_unused]] int lid_size,
ZOLTAN_ID_PTR global_id, ZOLTAN_ID_PTR local_id,
[[maybe_unused]] int weight_dim, float *obj_weights, int *ierr
) {
Graph* graph = reinterpret_cast<Graph*>(data);
for (int i = 0; i < graph->num_vertices; i++) {
Expand All @@ -618,8 +619,9 @@ std::unique_ptr<ZoltanLB::Graph> ZoltanLB::makeGraph() {
}

/*static*/ void ZoltanLB::getHypergraph(
void *data, int gid_size, int num_edges, int num_nonzeroes, int format,
ZOLTAN_ID_PTR edge_gid, int *vertex_ptr, ZOLTAN_ID_PTR vertex_gid, int *ierr
void *data, [[maybe_unused]] int gid_size, int num_edges, int num_nonzeroes,
int format, ZOLTAN_ID_PTR edge_gid, int *vertex_ptr,
ZOLTAN_ID_PTR vertex_gid, int *ierr
) {
Graph* graph = reinterpret_cast<Graph*>(data);
bool const edge_equal = num_edges == graph->num_edges;
Expand Down Expand Up @@ -656,8 +658,9 @@ std::unique_ptr<ZoltanLB::Graph> ZoltanLB::makeGraph() {
}

/*static*/ void ZoltanLB::getHypergraphEdgeWeights(
void *data, int num_gid, int num_lid, int num_edges, int edge_weight_dim,
ZOLTAN_ID_PTR edge_gid, ZOLTAN_ID_PTR edge_lid, float *edge_weights, int *ierr
void *data, [[maybe_unused]] int num_gid, [[maybe_unused]] int num_lid,
int num_edges, [[maybe_unused]] int edge_weight_dim, ZOLTAN_ID_PTR edge_gid,
ZOLTAN_ID_PTR edge_lid, float *edge_weights, int *ierr
) {
Graph* graph = reinterpret_cast<Graph*>(data);
for (int i = 0; i < num_edges; i++) {
Expand Down
Loading

0 comments on commit c843314

Please sign in to comment.