From 7129e2559e232cfcb22886948ff472c40582c069 Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Thu, 27 Jan 2022 16:20:18 +0000 Subject: [PATCH] mem-ruby: Fix -Werror=unused-variable from recent ruby patch One of the recent ruby patches [1] adopted iteration over an unordered_map via structured binding. As of now it is not possible to ignore one of the unpacked variables, and, if unused, a warning might be triggered by some compilers. With this patch we are fixing the building error by using range-based for loops without structured binding [1]: https://gem5-review.googlesource.com/c/public/gem5/+/55723 Signed-off-by: Giacomo Travaglini Change-Id: I882158cc2aeccc58d30318f29470505c53baf3e2 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56104 Maintainer: Bobby Bruce Tested-by: kokoro Reviewed-by: Meatboy 106 --- src/mem/ruby/network/simple/SimpleNetwork.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/mem/ruby/network/simple/SimpleNetwork.cc b/src/mem/ruby/network/simple/SimpleNetwork.cc index ce7bf2c6c1..1ddd53e06c 100644 --- a/src/mem/ruby/network/simple/SimpleNetwork.cc +++ b/src/mem/ruby/network/simple/SimpleNetwork.cc @@ -179,9 +179,9 @@ SimpleNetwork::regStats() ; // Now state what the formula is. - for (auto& [id, sw]: m_switches) { + for (auto& it : m_switches) { *(networkStats.m_msg_counts[(unsigned int) type]) += - sum(sw->getMsgCount(type)); + sum(it.second->getMsgCount(type)); } *(networkStats.m_msg_bytes[(unsigned int) type]) = @@ -193,8 +193,8 @@ SimpleNetwork::regStats() void SimpleNetwork::collateStats() { - for (auto& [id, sw]: m_switches) { - sw->collateStats(); + for (auto& it : m_switches) { + it.second->collateStats(); } } @@ -212,8 +212,8 @@ SimpleNetwork::print(std::ostream& out) const bool SimpleNetwork::functionalRead(Packet *pkt) { - for (auto& [id, sw]: m_switches) { - if (sw->functionalRead(pkt)) + for (auto& it : m_switches) { + if (it.second->functionalRead(pkt)) return true; } for (unsigned int i = 0; i < m_int_link_buffers.size(); ++i) { @@ -228,8 +228,8 @@ bool SimpleNetwork::functionalRead(Packet *pkt, WriteMask &mask) { bool read = false; - for (auto& [id, sw]: m_switches) { - if (sw->functionalRead(pkt, mask)) + for (auto& it : m_switches) { + if (it.second->functionalRead(pkt, mask)) read = true; } for (unsigned int i = 0; i < m_int_link_buffers.size(); ++i) { @@ -244,8 +244,8 @@ SimpleNetwork::functionalWrite(Packet *pkt) { uint32_t num_functional_writes = 0; - for (auto& [id, sw]: m_switches) { - num_functional_writes += sw->functionalWrite(pkt); + for (auto& it : m_switches) { + num_functional_writes += it.second->functionalWrite(pkt); } for (unsigned int i = 0; i < m_int_link_buffers.size(); ++i) {