Giacomo Travaglini has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/56104 )

Change subject: mem-ruby: Fix -Werror=unused-variable from recent ruby 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 <[email protected]>
Change-Id: I882158cc2aeccc58d30318f29470505c53baf3e2
---
M src/mem/ruby/network/simple/SimpleNetwork.cc
1 file changed, 30 insertions(+), 10 deletions(-)



diff --git a/src/mem/ruby/network/simple/SimpleNetwork.cc b/src/mem/ruby/network/simple/SimpleNetwork.cc
index ce7bf2c..1ddd53e 100644
--- a/src/mem/ruby/network/simple/SimpleNetwork.cc
+++ b/src/mem/ruby/network/simple/SimpleNetwork.cc
@@ -179,9 +179,9 @@
             ;

         // 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 @@
 void
 SimpleNetwork::collateStats()
 {
-    for (auto& [id, sw]: m_switches) {
-        sw->collateStats();
+    for (auto& it : m_switches) {
+        it.second->collateStats();
     }
 }

@@ -212,8 +212,8 @@
 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 @@
 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 @@
 {
     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) {

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/56104
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I882158cc2aeccc58d30318f29470505c53baf3e2
Gerrit-Change-Number: 56104
Gerrit-PatchSet: 1
Gerrit-Owner: Giacomo Travaglini <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to