scons: Fix up numerous warnings about name shadowing

This patch address the most important name shadowing warnings (as
produced when using gcc/clang with -Wshadow). There are many
locations where constructor parameters and function parameters shadow
local variables, but these are left unchanged.
This commit is contained in:
Andreas Hansson 2013-02-19 05:56:06 -05:00
parent 860155a5fc
commit c10098f28b
20 changed files with 41 additions and 58 deletions

View file

@ -158,11 +158,10 @@ class Interrupts : public SimObject
} }
} }
uint64_t interrupts = intstatus; if (intstatus) {
if (interrupts) {
for (uint64_t i = INTLEVEL_EXTERNAL_MIN; for (uint64_t i = INTLEVEL_EXTERNAL_MIN;
i < INTLEVEL_EXTERNAL_MAX; i++) { i < INTLEVEL_EXTERNAL_MAX; i++) {
if (interrupts & (ULL(1) << i)) { if (intstatus & (ULL(1) << i)) {
// See table 4-19 of 21164 hardware reference // See table 4-19 of 21164 hardware reference
ipl = i; ipl = i;
summary |= (ULL(1) << i); summary |= (ULL(1) << i);

View file

@ -197,7 +197,7 @@ StackTrace::trace(ThreadContext *_tc, bool is_call)
return; return;
} }
bool kernel = sys->kernelStart <= pc && pc <= sys->kernelEnd; kernel = sys->kernelStart <= pc && pc <= sys->kernelEnd;
if (!kernel) if (!kernel)
return; return;

View file

@ -995,7 +995,6 @@ FpOp::binaryOp(FPSCR &fpscr, fpType op1, fpType op2,
// Get NAN behavior right. This varies between x86 and ARM. // Get NAN behavior right. This varies between x86 and ARM.
if (std::isnan(dest)) { if (std::isnan(dest)) {
const bool single = (sizeof(fpType) == sizeof(float));
const uint64_t qnan = const uint64_t qnan =
single ? 0x7fc00000 : ULL(0x7ff8000000000000); single ? 0x7fc00000 : ULL(0x7ff8000000000000);
const bool nan1 = std::isnan(op1); const bool nan1 = std::isnan(op1);
@ -1066,7 +1065,6 @@ FpOp::unaryOp(FPSCR &fpscr, fpType op1, fpType (*func)(fpType),
// Get NAN behavior right. This varies between x86 and ARM. // Get NAN behavior right. This varies between x86 and ARM.
if (std::isnan(dest)) { if (std::isnan(dest)) {
const bool single = (sizeof(fpType) == sizeof(float));
const uint64_t qnan = const uint64_t qnan =
single ? 0x7fc00000 : ULL(0x7ff8000000000000); single ? 0x7fc00000 : ULL(0x7ff8000000000000);
const bool nan = std::isnan(op1); const bool nan = std::isnan(op1);

View file

@ -1570,13 +1570,6 @@ let {{
} }
case 0x6: case 0x6:
if (b == 0xc) { if (b == 0xc) {
const IntRegIndex vd =
(IntRegIndex)(2 * (bits(machInst, 15, 12) |
(bits(machInst, 22) << 4)));
const IntRegIndex vm =
(IntRegIndex)(2 * (bits(machInst, 3, 0) |
(bits(machInst, 5) << 4)));
unsigned size = bits(machInst, 19, 18);
return decodeNeonSTwoShiftUSReg<NVshll>( return decodeNeonSTwoShiftUSReg<NVshll>(
size, machInst, vd, vm, 8 << size); size, machInst, vd, vm, 8 << size);
} else { } else {
@ -1866,7 +1859,6 @@ let {{
case 0x3: case 0x3:
const bool up = (bits(machInst, 23) == 1); const bool up = (bits(machInst, 23) == 1);
const uint32_t imm = bits(machInst, 7, 0) << 2; const uint32_t imm = bits(machInst, 7, 0) << 2;
RegIndex vd;
if (single) { if (single) {
vd = (RegIndex)(uint32_t)((bits(machInst, 15, 12) << 1) | vd = (RegIndex)(uint32_t)((bits(machInst, 15, 12) << 1) |
(bits(machInst, 22))); (bits(machInst, 22)));

View file

@ -254,7 +254,7 @@ IniFile::Section::printUnreferenced(const string &sectionName)
for (EntryTable::iterator ei = table.begin(); for (EntryTable::iterator ei = table.begin();
ei != table.end(); ++ei) { ei != table.end(); ++ei) {
const string &entryName = ei->first; const string &entryName = ei->first;
Entry *entry = ei->second; entry = ei->second;
if (entryName == "unref_section_ok" || if (entryName == "unref_section_ok" ||
entryName == "unref_entries_ok") entryName == "unref_entries_ok")

View file

@ -233,27 +233,27 @@ OutputDirectory::remove(const string &name, bool recursive)
} else { } else {
// assume 'name' is a directory // assume 'name' is a directory
if (recursive) { if (recursive) {
DIR *dir = opendir(fname.c_str()); DIR *subdir = opendir(fname.c_str());
// silently ignore removal request for non-existent directory // silently ignore removal request for non-existent directory
if ((!dir) && (errno == ENOENT)) if ((!subdir) && (errno == ENOENT))
return; return;
// fail on other errors // fail on other errors
if (!dir) { if (!subdir) {
perror("opendir"); perror("opendir");
fatal("Error opening directory for recursive removal '%s'\n", fatal("Error opening directory for recursive removal '%s'\n",
fname); fname);
} }
struct dirent *de = readdir(dir); struct dirent *de = readdir(subdir);
while (de != NULL) { while (de != NULL) {
// ignore files starting with a '.'; user must delete those // ignore files starting with a '.'; user must delete those
// manually if they really want to // manually if they really want to
if (de->d_name[0] != '.') if (de->d_name[0] != '.')
remove(name + PATH_SEPARATOR + de->d_name, recursive); remove(name + PATH_SEPARATOR + de->d_name, recursive);
de = readdir(dir); de = readdir(subdir);
} }
} }

View file

@ -1416,9 +1416,8 @@ class DistStor
data.underflow = underflow; data.underflow = underflow;
data.overflow = overflow; data.overflow = overflow;
size_type buckets = params->buckets; data.cvec.resize(params->buckets);
data.cvec.resize(buckets); for (off_type i = 0; i < params->buckets; ++i)
for (off_type i = 0; i < buckets; ++i)
data.cvec[i] = cvec[i]; data.cvec[i] = cvec[i];
data.sum = sum; data.sum = sum;
@ -2372,13 +2371,13 @@ class SumNode : public Node
size_type size = lvec.size(); size_type size = lvec.size();
assert(size > 0); assert(size > 0);
Result vresult = 0.0; Result result = 0.0;
Op op; Op op;
for (off_type i = 0; i < size; ++i) for (off_type i = 0; i < size; ++i)
vresult = op(vresult, lvec[i]); result = op(result, lvec[i]);
return vresult; return result;
} }
size_type size() const { return 1; } size_type size() const { return 1; }

View file

@ -135,10 +135,7 @@ FUPool::FUPool(const Params *p)
numFU++; numFU++;
// Add the appropriate number of copies of this FU to the list // Add the appropriate number of copies of this FU to the list
ostringstream s; fu->name = (*i)->name() + "(0)";
s << (*i)->name() << "(0)";
fu->name = s.str();
funcUnits.push_back(fu); funcUnits.push_back(fu);
for (int c = 1; c < (*i)->number; ++c) { for (int c = 1; c < (*i)->number; ++c) {

View file

@ -404,7 +404,6 @@ template <class Impl>
void void
ROB<Impl>::updateHead() ROB<Impl>::updateHead()
{ {
DynInstPtr head_inst;
InstSeqNum lowest_num = 0; InstSeqNum lowest_num = 0;
bool first_valid = true; bool first_valid = true;

View file

@ -231,7 +231,6 @@ Pl390::readDistributor(PacketPtr pkt)
cpuTarget[int_num+3] << 24) ; cpuTarget[int_num+3] << 24) ;
} }
} else { } else {
int ctx_id = pkt->req->contextId();
assert(ctx_id < sys->numRunningContexts()); assert(ctx_id < sys->numRunningContexts());
pkt->set<uint32_t>(ctx_id); pkt->set<uint32_t>(ctx_id);
} }

View file

@ -186,17 +186,17 @@ Printk(stringstream &out, Arguments args)
case 'c': { case 'c': {
uint64_t mask = (*p == 'C') ? 0xffL : 0x7fL; uint64_t mask = (*p == 'C') ? 0xffL : 0x7fL;
uint64_t num; uint64_t num;
int width; int cwidth;
if (islong) { if (islong) {
num = (uint64_t)args; num = (uint64_t)args;
width = sizeof(uint64_t); cwidth = sizeof(uint64_t);
} else { } else {
num = (uint32_t)args; num = (uint32_t)args;
width = sizeof(uint32_t); cwidth = sizeof(uint32_t);
} }
while (width-- > 0) { while (cwidth-- > 0) {
char c = (char)(num & mask); char c = (char)(num & mask);
if (c) if (c)
out << c; out << c;

View file

@ -319,8 +319,8 @@ Cache<TagStore>::access(PacketPtr pkt, BlkType *&blk,
incMissCount(pkt); incMissCount(pkt);
return false; return false;
} }
int id = pkt->req->masterId(); int master_id = pkt->req->masterId();
tags->insertBlock(pkt->getAddr(), blk, id); tags->insertBlock(pkt->getAddr(), blk, master_id);
blk->status = BlkValid | BlkReadable; blk->status = BlkValid | BlkReadable;
} }
std::memcpy(blk->data, pkt->getPtr<uint8_t>(), blkSize); std::memcpy(blk->data, pkt->getPtr<uint8_t>(), blkSize);
@ -1005,7 +1005,7 @@ Cache<TagStore>::recvTimingResp(PacketPtr pkt)
if (blk) { if (blk) {
blk->status &= ~BlkReadable; blk->status &= ~BlkReadable;
} }
MSHRQueue *mq = mshr->queue; mq = mshr->queue;
mq->markPending(mshr); mq->markPending(mshr);
requestMemSideBus((RequestCause)mq->index, curTick() + requestMemSideBus((RequestCause)mq->index, curTick() +
pkt->busLastWordDelay); pkt->busLastWordDelay);

View file

@ -270,16 +270,16 @@ bool
FALRU::check() FALRU::check()
{ {
FALRUBlk* blk = head; FALRUBlk* blk = head;
int size = 0; int tot_size = 0;
int boundary = 1<<17; int boundary = 1<<17;
int j = 0; int j = 0;
int flags = cacheMask; int flags = cacheMask;
while (blk) { while (blk) {
size += blkSize; tot_size += blkSize;
if (blk->inCache != flags) { if (blk->inCache != flags) {
return false; return false;
} }
if (size == boundary && blk != tail) { if (tot_size == boundary && blk != tail) {
if (cacheBoundaries[j] != blk) { if (cacheBoundaries[j] != blk) {
return false; return false;
} }

View file

@ -306,7 +306,7 @@ double Crossbar::calc_ctr_cap(double cap_wire_, bool prev_ctr_, bool next_ctr_)
//FIXME Wmemcellr and resize //FIXME Wmemcellr and resize
double Wmemcellr = m_tech_param_ptr->get_Wmemcellr(); double Wmemcellr = m_tech_param_ptr->get_Wmemcellr();
double nsize = Wmemcellr; double nsize = Wmemcellr;
double trans_cap = m_tech_param_ptr->calc_gatecap(nsize, 0); trans_cap = m_tech_param_ptr->calc_gatecap(nsize, 0);
if (m_trans_type == NP_GATE) if (m_trans_type == NP_GATE)
{ {
double Wdecinvn = m_tech_param_ptr->get_Wdecinvn(); double Wdecinvn = m_tech_param_ptr->get_Wdecinvn();

View file

@ -98,7 +98,7 @@ class OrionRouter
uint32_t m_num_out_port; uint32_t m_num_out_port;
uint32_t m_flit_width; uint32_t m_flit_width;
uint32_t m_num_vclass; uint32_t m_num_vclass;
uint32_t num_vc_per_vclass_; uint32_t num_vc_per_vclass;
uint32_t m_total_num_vc; uint32_t m_total_num_vc;
uint32_t* m_num_vc_per_vclass_ary; uint32_t* m_num_vc_per_vclass_ary;
uint32_t* m_in_buf_num_set_ary; uint32_t* m_in_buf_num_set_ary;

View file

@ -100,9 +100,9 @@ printSorted(ostream& out, int num_of_sequencers, const AddressMap &record_map,
std::vector<int64> m_touched_weighted_vec; std::vector<int64> m_touched_weighted_vec;
m_touched_vec.resize(num_of_sequencers+1); m_touched_vec.resize(num_of_sequencers+1);
m_touched_weighted_vec.resize(num_of_sequencers+1); m_touched_weighted_vec.resize(num_of_sequencers+1);
for (int i = 0; i < m_touched_vec.size(); i++) { for (int j = 0; j < m_touched_vec.size(); j++) {
m_touched_vec[i] = 0; m_touched_vec[j] = 0;
m_touched_weighted_vec[i] = 0; m_touched_weighted_vec[j] = 0;
} }
int counter = 0; int counter = 0;

View file

@ -482,8 +482,8 @@ RubySystem::functionalRead(PacketPtr pkt)
DPRINTF(RubySystem, "reading from %s block %s\n", DPRINTF(RubySystem, "reading from %s block %s\n",
m_abs_cntrl_vec[i]->name(), block); m_abs_cntrl_vec[i]->name(), block);
for (unsigned i = 0; i < size_in_bytes; ++i) { for (unsigned j = 0; j < size_in_bytes; ++j) {
data[i] = block.getByte(i + startByte); data[j] = block.getByte(j + startByte);
} }
return true; return true;
} }
@ -507,8 +507,8 @@ RubySystem::functionalRead(PacketPtr pkt)
DPRINTF(RubySystem, "reading from %s block %s\n", DPRINTF(RubySystem, "reading from %s block %s\n",
m_abs_cntrl_vec[i]->name(), block); m_abs_cntrl_vec[i]->name(), block);
for (unsigned i = 0; i < size_in_bytes; ++i) { for (unsigned j = 0; j < size_in_bytes; ++j) {
data[i] = block.getByte(i + startByte); data[j] = block.getByte(j + startByte);
} }
return true; return true;
} }
@ -545,8 +545,8 @@ RubySystem::functionalWrite(PacketPtr pkt)
DataBlock& block = m_abs_cntrl_vec[i]->getDataBlock(line_addr); DataBlock& block = m_abs_cntrl_vec[i]->getDataBlock(line_addr);
DPRINTF(RubySystem, "%s\n",block); DPRINTF(RubySystem, "%s\n",block);
for (unsigned i = 0; i < size_in_bytes; ++i) { for (unsigned j = 0; j < size_in_bytes; ++j) {
block.setByte(i + startByte, data[i]); block.setByte(j + startByte, data[j]);
} }
DPRINTF(RubySystem, "%s\n",block); DPRINTF(RubySystem, "%s\n",block);
} }

View file

@ -130,8 +130,8 @@ class Arguments
template <class T> template <class T>
operator T() { operator T() {
assert(sizeof(T) <= sizeof(uint64_t)); assert(sizeof(T) <= sizeof(uint64_t));
T data = static_cast<T>(getArg(sizeof(T))); T d = static_cast<T>(getArg(sizeof(T)));
return data; return d;
} }
template <class T> template <class T>

View file

@ -184,8 +184,8 @@ class ClockedObject : public SimObject
inline Tick clockPeriod() const { return clock; } inline Tick clockPeriod() const { return clock; }
inline Cycles ticksToCycles(Tick tick) const inline Cycles ticksToCycles(Tick t) const
{ return Cycles(tick / clock); } { return Cycles(t / clock); }
}; };

View file

@ -167,7 +167,7 @@ Process::Process(ProcessParams * params)
// mark remaining fds as free // mark remaining fds as free
for (int i = 3; i <= MAX_FD; ++i) { for (int i = 3; i <= MAX_FD; ++i) {
Process::FdMap *fdo = &fd_map[i]; fdo = &fd_map[i];
fdo->fd = -1; fdo->fd = -1;
} }