Bobby Bruce has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/64171?usp=email )
Change subject: mem: Fix 'unused variable' warnings
......................................................................
mem: Fix 'unused variable' warnings
The `Addr line_addr` in "src/mem/snoop_filter.cc" variable was only
used in an assert, stripped when compiling gem5.fast.
Clang-13 throws a warning for this variable. This has been fixed by
merging the variable and associated logic into the assert statement.
The variables in inet.cc and Sequencer.cc were also causing an 'unused
variable' warning to be thrown due to variables that were only used in
assert statements. In these cases the logic could not be moved into the
assert statement and, as such, the `GEM5_VAR_USED` MACRO is used to
remove this warning.
Change-Id: I6511d0863608c38b79e4558c7dcf35a323fe8362
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/64171
Reviewed-by: Kunal Pai <kun...@ucdavis.edu>
Tested-by: kokoro <noreply+kok...@google.com>
Maintainer: Bobby Bruce <bbr...@ucdavis.edu>
---
M src/base/inet.cc
M src/mem/ruby/system/Sequencer.cc
M src/mem/snoop_filter.cc
3 files changed, 33 insertions(+), 9 deletions(-)
Approvals:
kokoro: Regressions pass
Kunal Pai: Looks good to me, approved
Bobby Bruce: Looks good to me, approved
diff --git a/src/base/inet.cc b/src/base/inet.cc
index ca83fa4..ab4bfe4 100644
--- a/src/base/inet.cc
+++ b/src/base/inet.cc
@@ -46,6 +46,7 @@
#include <sstream>
#include <string>
+#include "base/compiler.hh"
#include "base/cprintf.hh"
#include "base/logging.hh"
#include "base/types.hh"
@@ -301,7 +302,7 @@
const uint8_t *data = bytes() + IP6_HDR_LEN;
uint8_t nxt = ip6_nxt;
int len = 0;
- int all = plen();
+ GEM5_VAR_USED int all = plen();
while (ip6Extension(nxt)) {
const Ip6Opt *ext = (const Ip6Opt *)data;
@@ -324,7 +325,7 @@
const uint8_t *data = bytes() + IP6_HDR_LEN;
uint8_t nxt = ip6_nxt;
Ip6Opt* opt = NULL;
- int all = plen();
+ GEM5_VAR_USED int all = plen();
while (ip6Extension(nxt)) {
opt = (Ip6Opt *)data;
@@ -349,7 +350,7 @@
{
const uint8_t *data = bytes() + IP6_HDR_LEN;
uint8_t nxt = ip6_nxt;
- int all = plen();
+ GEM5_VAR_USED int all = plen();
while (ip6Extension(nxt)) {
const Ip6Opt *ext = (const Ip6Opt *)data;
diff --git a/src/mem/ruby/system/Sequencer.cc
b/src/mem/ruby/system/Sequencer.cc
index 32b9dfc..24439d6 100644
--- a/src/mem/ruby/system/Sequencer.cc
+++ b/src/mem/ruby/system/Sequencer.cc
@@ -42,6 +42,7 @@
#include "mem/ruby/system/Sequencer.hh"
#include "arch/x86/ldstflags.hh"
+#include "base/compiler.hh"
#include "base/logging.hh"
#include "base/str.hh"
#include "cpu/testers/rubytest/RubyTester.hh"
@@ -229,7 +230,7 @@
Cycles current_time = curCycle();
// Check across all outstanding requests
- int total_outstanding = 0;
+ GEM5_VAR_USED int total_outstanding = 0;
for (const auto &table_entry : m_RequestTable) {
for (const auto &seq_req : table_entry.second) {
diff --git a/src/mem/snoop_filter.cc b/src/mem/snoop_filter.cc
index e2568b6..273c087 100644
--- a/src/mem/snoop_filter.cc
+++ b/src/mem/snoop_filter.cc
@@ -162,11 +162,9 @@
if (reqLookupResult.it != cachedLocations.end()) {
// since we rely on the caller, do a basic check to ensure
// that finishRequest is being called following lookupRequest
- Addr line_addr = (addr & ~(Addr(linesize - 1)));
- if (is_secure) {
- line_addr |= LineSecure;
- }
- assert(reqLookupResult.it->first == line_addr);
+ assert(reqLookupResult.it->first == \
+ (is_secure ? ((addr & ~(Addr(linesize - 1))) |
LineSecure) : \
+ (addr & ~(Addr(linesize - 1)))));
if (will_retry) {
SnoopItem retry_item = reqLookupResult.retryItem;
// Undo any changes made in lookupRequest to the snoop filter
--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/64171?usp=email
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: I6511d0863608c38b79e4558c7dcf35a323fe8362
Gerrit-Change-Number: 64171
Gerrit-PatchSet: 4
Gerrit-Owner: Bobby Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Bobby Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Kunal Pai <kun...@ucdavis.edu>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org