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 e8f7a1f commit 19f1cbf
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 21 deletions.
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
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
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
2 changes: 1 addition & 1 deletion src/vt/vrt/collection/manager.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ GroupType CollectionManager::createGroupCollection(
template <typename ColT, typename IndexT, typename MsgT>
/*static*/ void CollectionManager::collectionAutoMsgDeliver(
MsgT* msg, Indexable<IndexT>* base, HandlerType han, NodeType from,
trace::TraceEventIDType event, bool immediate
[[maybe_unused]] trace::TraceEventIDType event, bool immediate
) {
// Expand out the index for tracing purposes; Projections takes up to
// 4-dimensions
Expand Down

0 comments on commit 19f1cbf

Please sign in to comment.