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 <kunpai@ucdavis.edu> Tested-by: kokoro <noreply+kokoro@google.com> Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
This commit is contained in:
committed by
Bobby Bruce
parent
d2a6d2f7ee
commit
abad2d6532
@@ -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 @@ Ip6Hdr::extensionLength() const
|
||||
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 @@ Ip6Hdr::getExt(uint8_t ext_type) const
|
||||
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 @@ Ip6Hdr::proto() const
|
||||
{
|
||||
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;
|
||||
|
||||
@@ -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 @@ Sequencer::wakeup()
|
||||
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) {
|
||||
|
||||
@@ -162,11 +162,9 @@ SnoopFilter::finishRequest(bool will_retry, Addr addr, bool is_secure)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user