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 <giacomo.travaglini@arm.com>
Change-Id: I882158cc2aeccc58d30318f29470505c53baf3e2
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56104
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Meatboy 106 <garbage2collector@gmail.com>
This commit is contained in:
Giacomo Travaglini
2022-01-27 16:20:18 +00:00
parent 8a7fcd340f
commit 7129e2559e

View File

@@ -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) {