From: Gabe Black Date: Thu, 21 Jan 2021 12:40:10 +0000 (-0800) Subject: cpu: Stop "using namespace std" X-Git-Tag: develop-gem5-snapshot~239 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2343ee2705e910faf4947b9554e9d442d00c4103;p=gem5.git cpu: Stop "using namespace std" Change-Id: I1b648914d353672076d903ed581aa61cdd7c1d0f Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39562 Reviewed-by: Daniel Carvalho Maintainer: Gabe Black Tested-by: kokoro --- diff --git a/src/cpu/activity.cc b/src/cpu/activity.cc index 4e8b558b3..2c8df0e2d 100644 --- a/src/cpu/activity.cc +++ b/src/cpu/activity.cc @@ -33,9 +33,7 @@ #include "cpu/timebuf.hh" #include "debug/Activity.hh" -using namespace std; - -ActivityRecorder::ActivityRecorder(const string &name, int num_stages, +ActivityRecorder::ActivityRecorder(const std::string &name, int num_stages, int longest_latency, int activity) : _name(name), activityBuffer(longest_latency, 0), longestLatency(longest_latency), activityCount(activity), diff --git a/src/cpu/base.cc b/src/cpu/base.cc index 0c998be4c..af928f1b3 100644 --- a/src/cpu/base.cc +++ b/src/cpu/base.cc @@ -71,11 +71,9 @@ // Hack #include "sim/stat_control.hh" -using namespace std; - std::unique_ptr BaseCPU::globalStats; -vector BaseCPU::cpuList; +std::vector BaseCPU::cpuList; // This variable reflects the max number of threads in any CPU. Be // careful to only use it once all the CPUs that you care about have @@ -156,7 +154,7 @@ BaseCPU::BaseCPU(const Params &p, bool is_checker) functionTracingEnabled = false; if (p.function_trace) { - const string fname = csprintf("ftrace.%s", name()); + const std::string fname = csprintf("ftrace.%s", name()); functionTraceStream = simout.findOrCreate(fname)->stream(); currentFunctionStart = currentFunctionEnd = 0; @@ -395,7 +393,7 @@ BaseCPU::regStats() int size = threadContexts.size(); if (size > 1) { for (int i = 0; i < size; ++i) { - stringstream namestr; + std::stringstream namestr; ccprintf(namestr, "%s.ctx%d", name(), i); threadContexts[i]->regStats(namestr.str()); } @@ -404,7 +402,7 @@ BaseCPU::regStats() } Port & -BaseCPU::getPort(const string &if_name, PortID idx) +BaseCPU::getPort(const std::string &if_name, PortID idx) { // Get the right port based on name. This applies to all the // subclasses of the base CPU and relies on their implementation @@ -708,7 +706,7 @@ BaseCPU::traceFunctionsInternal(Addr pc) auto it = Loader::debugSymbolTable.findNearest( pc, currentFunctionEnd); - string sym_str; + std::string sym_str; if (it == Loader::debugSymbolTable.end()) { // no symbol found: use addr as label sym_str = csprintf("%#x", pc); diff --git a/src/cpu/checker/cpu.cc b/src/cpu/checker/cpu.cc index ccbc649a0..8815530b5 100644 --- a/src/cpu/checker/cpu.cc +++ b/src/cpu/checker/cpu.cc @@ -52,7 +52,6 @@ #include "params/CheckerCPU.hh" #include "sim/full_system.hh" -using namespace std; using namespace TheISA; void @@ -124,7 +123,7 @@ CheckerCPU::setDcachePort(RequestPort *dcache_port) } void -CheckerCPU::serialize(ostream &os) const +CheckerCPU::serialize(std::ostream &os) const { } diff --git a/src/cpu/checker/cpu_impl.hh b/src/cpu/checker/cpu_impl.hh index 70dc45161..733cf1c1c 100644 --- a/src/cpu/checker/cpu_impl.hh +++ b/src/cpu/checker/cpu_impl.hh @@ -59,7 +59,6 @@ #include "sim/sim_object.hh" #include "sim/stats.hh" -using namespace std; using namespace TheISA; template diff --git a/src/cpu/exetrace.cc b/src/cpu/exetrace.cc index 4980c917e..02ede1a0c 100644 --- a/src/cpu/exetrace.cc +++ b/src/cpu/exetrace.cc @@ -53,7 +53,6 @@ #include "debug/FmtTicksOff.hh" #include "enums/OpClass.hh" -using namespace std; using namespace TheISA; namespace Trace { @@ -70,7 +69,7 @@ Trace::ExeTracerRecord::traceInst(const StaticInstPtr &inst, bool ran) } if (Debug::ExecAsid) - outs << "A" << dec << TheISA::getExecutingAsid(thread) << " "; + outs << "A" << std::dec << TheISA::getExecutingAsid(thread) << " "; if (Debug::ExecThread) outs << "T" << thread->threadId() << " : "; @@ -100,7 +99,7 @@ Trace::ExeTracerRecord::traceInst(const StaticInstPtr &inst, bool ran) // Print decoded instruction // - outs << setw(26) << left; + outs << std::setw(26) << std::left; outs << inst->disassemble(cur_pc, &Loader::debugSymbolTable); if (ran) { @@ -150,13 +149,13 @@ Trace::ExeTracerRecord::traceInst(const StaticInstPtr &inst, bool ran) } if (Debug::ExecEffAddr && getMemValid()) - outs << " A=0x" << hex << addr; + outs << " A=0x" << std::hex << addr; if (Debug::ExecFetchSeq && fetch_seq_valid) - outs << " FetchSeq=" << dec << fetch_seq; + outs << " FetchSeq=" << std::dec << fetch_seq; if (Debug::ExecCPSeq && cp_seq_valid) - outs << " CPSeq=" << dec << cp_seq; + outs << " CPSeq=" << std::dec << cp_seq; if (Debug::ExecFlags) { outs << " flags=("; @@ -168,7 +167,7 @@ Trace::ExeTracerRecord::traceInst(const StaticInstPtr &inst, bool ran) // // End of line... // - outs << endl; + outs << std::endl; Trace::getDebugLogger()->dprintf_flag( when, thread->getCpuPtr()->name(), "ExecEnable", "%s", diff --git a/src/cpu/func_unit.cc b/src/cpu/func_unit.cc index d131d7675..7d979bc30 100644 --- a/src/cpu/func_unit.cc +++ b/src/cpu/func_unit.cc @@ -32,9 +32,6 @@ #include "base/logging.hh" -using namespace std; - - //////////////////////////////////////////////////////////////////////////// // // The funciton unit @@ -78,7 +75,7 @@ FuncUnit::provides(OpClass capability) return capabilityList[capability]; } -bitset +std::bitset FuncUnit::capabilities() { return capabilityList; diff --git a/src/cpu/inteltrace.cc b/src/cpu/inteltrace.cc index 68da26196..4e36a9d1f 100644 --- a/src/cpu/inteltrace.cc +++ b/src/cpu/inteltrace.cc @@ -34,7 +34,6 @@ #include "cpu/exetrace.hh" #include "cpu/static_inst.hh" -using namespace std; using namespace TheISA; namespace Trace { @@ -42,15 +41,15 @@ namespace Trace { void Trace::IntelTraceRecord::dump() { - ostream &outs = Trace::output(); + std::ostream &outs = Trace::output(); ccprintf(outs, "%7d ) ", when); - outs << "0x" << hex << pc.instAddr() << ":\t"; + outs << "0x" << std::hex << pc.instAddr() << ":\t"; if (staticInst->isLoad()) { ccprintf(outs, "", addr); } else if (staticInst->isStore()) { ccprintf(outs, "", addr); } - outs << endl; + outs << std::endl; } } // namespace Trace diff --git a/src/cpu/intr_control.cc b/src/cpu/intr_control.cc index b62483594..74e045799 100644 --- a/src/cpu/intr_control.cc +++ b/src/cpu/intr_control.cc @@ -37,8 +37,6 @@ #include "debug/IntrControl.hh" #include "sim/sim_object.hh" -using namespace std; - IntrControl::IntrControl(const Params &p) : SimObject(p), sys(p.sys) {} diff --git a/src/cpu/intr_control_noisa.cc b/src/cpu/intr_control_noisa.cc index 998641c73..71d2c02ce 100644 --- a/src/cpu/intr_control_noisa.cc +++ b/src/cpu/intr_control_noisa.cc @@ -28,8 +28,6 @@ #include "cpu/intr_control.hh" -using namespace std; - IntrControl::IntrControl(const Params &p) : SimObject(p), sys(p.sys) {} diff --git a/src/cpu/nativetrace.cc b/src/cpu/nativetrace.cc index 65b28338b..49870ea09 100644 --- a/src/cpu/nativetrace.cc +++ b/src/cpu/nativetrace.cc @@ -33,8 +33,6 @@ #include "debug/GDBMisc.hh" #include "params/NativeTrace.hh" -using namespace std; - namespace Trace { NativeTrace::NativeTrace(const Params &p) @@ -49,7 +47,7 @@ NativeTrace::NativeTrace(const Params &p) DPRINTF(GDBMisc, "Can't bind port %d\n", port); port++; } - ccprintf(cerr, "Listening for native process on port %d\n", port); + ccprintf(std::cerr, "Listening for native process on port %d\n", port); fd = native_listener.accept(); } diff --git a/src/cpu/o3/commit_impl.hh b/src/cpu/o3/commit_impl.hh index 717ae3334..ccf5363bc 100644 --- a/src/cpu/o3/commit_impl.hh +++ b/src/cpu/o3/commit_impl.hh @@ -66,8 +66,6 @@ #include "sim/faults.hh" #include "sim/full_system.hh" -using namespace std; - template void DefaultCommit::processTrapEvent(ThreadID tid) @@ -292,7 +290,7 @@ DefaultCommit::setIEWStage(IEW *iew_stage) template void -DefaultCommit::setActiveThreads(list *at_ptr) +DefaultCommit::setActiveThreads(std::list *at_ptr) { activeThreads = at_ptr; } @@ -428,7 +426,7 @@ template void DefaultCommit::deactivateThread(ThreadID tid) { - list::iterator thread_it = std::find(priority_list.begin(), + std::list::iterator thread_it = std::find(priority_list.begin(), priority_list.end(), tid); if (thread_it != priority_list.end()) { @@ -463,8 +461,8 @@ void DefaultCommit::updateStatus() { // reset ROB changed variable - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -493,8 +491,8 @@ template bool DefaultCommit::changedROBEntries() { - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -524,7 +522,7 @@ DefaultCommit::generateTrapEvent(ThreadID tid, Fault inst_fault) [this, tid]{ processTrapEvent(tid); }, "Trap", true, Event::CPU_Tick_Pri); - Cycles latency = dynamic_pointer_cast(inst_fault) ? + Cycles latency = std::dynamic_pointer_cast(inst_fault) ? cpu->syscallRetryLatency : trapLatency; // hardware transactional memory @@ -661,8 +659,8 @@ DefaultCommit::tick() if (activeThreads->empty()) return; - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); // Check if any of the threads are done squashing. Change the // status if they are done. @@ -822,8 +820,8 @@ DefaultCommit::commit() //////////////////////////////////// // Check for any possible squashes, handle them first //////////////////////////////////// - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); int num_squashing_threads = 0; @@ -1528,8 +1526,8 @@ template ThreadID DefaultCommit::roundRobin() { - list::iterator pri_iter = priority_list.begin(); - list::iterator end = priority_list.end(); + std::list::iterator pri_iter = priority_list.begin(); + std::list::iterator end = priority_list.end(); while (pri_iter != end) { ThreadID tid = *pri_iter; @@ -1559,8 +1557,8 @@ DefaultCommit::oldestReady() unsigned oldest = 0; bool first = true; - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; diff --git a/src/cpu/o3/cpu.cc b/src/cpu/o3/cpu.cc index 4068b306d..56cf46c1e 100644 --- a/src/cpu/o3/cpu.cc +++ b/src/cpu/o3/cpu.cc @@ -65,7 +65,6 @@ struct BaseCPUParams; using namespace TheISA; -using namespace std; BaseO3CPU::BaseO3CPU(const BaseCPUParams ¶ms) : BaseCPU(params) @@ -581,7 +580,7 @@ template void FullO3CPU::activateThread(ThreadID tid) { - list::iterator isActive = + std::list::iterator isActive = std::find(activeThreads.begin(), activeThreads.end(), tid); DPRINTF(O3CPU, "[tid:%i] Calling activate thread.\n", tid); @@ -604,7 +603,7 @@ FullO3CPU::deactivateThread(ThreadID tid) assert(!commit.executingHtmTransaction(tid)); //Remove From Active List, if Active - list::iterator thread_it = + std::list::iterator thread_it = std::find(activeThreads.begin(), activeThreads.end(), tid); DPRINTF(O3CPU, "[tid:%i] Calling deactivate thread.\n", tid); @@ -1722,7 +1721,7 @@ FullO3CPU::updateThreadPriority() if (activeThreads.size() > 1) { //DEFAULT TO ROUND ROBIN SCHEME //e.g. Move highest priority to end of thread list - list::iterator list_begin = activeThreads.begin(); + std::list::iterator list_begin = activeThreads.begin(); unsigned high_thread = *list_begin; diff --git a/src/cpu/o3/fetch_impl.hh b/src/cpu/o3/fetch_impl.hh index 6f03e78c9..23ab06bc4 100644 --- a/src/cpu/o3/fetch_impl.hh +++ b/src/cpu/o3/fetch_impl.hh @@ -71,8 +71,6 @@ #include "sim/system.hh" #include "cpu/o3/isa_specific.hh" -using namespace std; - template DefaultFetch::DefaultFetch(O3CPU *_cpu, const DerivO3CPUParams ¶ms) : fetchPolicy(params.smtFetchPolicy), @@ -804,8 +802,8 @@ typename DefaultFetch::FetchStatus DefaultFetch::updateFetchStatus() { //Check Running - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -857,8 +855,8 @@ template void DefaultFetch::tick() { - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); bool status_change = false; wroteToTimeBuffer = false; @@ -1423,7 +1421,7 @@ DefaultFetch::getFetchingThread() return InvalidThreadID; } } else { - list::iterator thread = activeThreads->begin(); + std::list::iterator thread = activeThreads->begin(); if (thread == activeThreads->end()) { return InvalidThreadID; } @@ -1445,8 +1443,8 @@ template ThreadID DefaultFetch::roundRobin() { - list::iterator pri_iter = priorityList.begin(); - list::iterator end = priorityList.end(); + std::list::iterator pri_iter = priorityList.begin(); + std::list::iterator end = priorityList.end(); ThreadID high_pri; @@ -1476,12 +1474,12 @@ ThreadID DefaultFetch::iqCount() { //sorted from lowest->highest - std::priority_queue, + std::priority_queue, std::greater > PQ; std::map threadMap; - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -1513,12 +1511,12 @@ ThreadID DefaultFetch::lsqCount() { //sorted from lowest->highest - std::priority_queue, + std::priority_queue, std::greater > PQ; std::map threadMap; - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; diff --git a/src/cpu/o3/fu_pool.cc b/src/cpu/o3/fu_pool.cc index caab18147..7ffd25dd1 100644 --- a/src/cpu/o3/fu_pool.cc +++ b/src/cpu/o3/fu_pool.cc @@ -44,8 +44,6 @@ #include "cpu/func_unit.hh" -using namespace std; - //////////////////////////////////////////////////////////////////////////// // // A pool of function units @@ -92,7 +90,7 @@ FUPool::FUPool(const Params &p) // // Iterate through the list of FUDescData structures // - const vector ¶mList = p.FUList; + const std::vector ¶mList = p.FUList; for (FUDDiterator i = paramList.begin(); i != paramList.end(); ++i) { // @@ -136,7 +134,7 @@ FUPool::FUPool(const Params &p) funcUnits.push_back(fu); for (int c = 1; c < (*i)->number; ++c) { - ostringstream s; + std::ostringstream s; numFU++; FuncUnit *fu2 = new FuncUnit(*fu); @@ -205,34 +203,34 @@ FUPool::processFreeUnits() void FUPool::dump() { - cout << "Function Unit Pool (" << name() << ")\n"; - cout << "======================================\n"; - cout << "Free List:\n"; + std::cout << "Function Unit Pool (" << name() << ")\n"; + std::cout << "======================================\n"; + std::cout << "Free List:\n"; for (int i = 0; i < numFU; ++i) { if (unitBusy[i]) { continue; } - cout << " [" << i << "] : "; + std::cout << " [" << i << "] : "; - cout << funcUnits[i]->name << " "; + std::cout << funcUnits[i]->name << " "; - cout << "\n"; + std::cout << "\n"; } - cout << "======================================\n"; - cout << "Busy List:\n"; + std::cout << "======================================\n"; + std::cout << "Busy List:\n"; for (int i = 0; i < numFU; ++i) { if (!unitBusy[i]) { continue; } - cout << " [" << i << "] : "; + std::cout << " [" << i << "] : "; - cout << funcUnits[i]->name << " "; + std::cout << funcUnits[i]->name << " "; - cout << "\n"; + std::cout << "\n"; } } diff --git a/src/cpu/o3/iew_impl.hh b/src/cpu/o3/iew_impl.hh index 9e56ed097..5ab59ffcf 100644 --- a/src/cpu/o3/iew_impl.hh +++ b/src/cpu/o3/iew_impl.hh @@ -60,8 +60,6 @@ #include "debug/O3PipeView.hh" #include "params/DerivO3CPU.hh" -using namespace std; - template DefaultIEW::DefaultIEW(O3CPU *_cpu, const DerivO3CPUParams ¶ms) : issueToExecQueue(params.backComSize, params.forwardComSize), @@ -319,7 +317,7 @@ DefaultIEW::setIEWQueue(TimeBuffer *iq_ptr) template void -DefaultIEW::setActiveThreads(list *at_ptr) +DefaultIEW::setActiveThreads(std::list *at_ptr) { activeThreads = at_ptr; @@ -632,8 +630,8 @@ DefaultIEW::skidCount() { int max=0; - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -649,8 +647,8 @@ template bool DefaultIEW::skidsEmpty() { - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -668,8 +666,8 @@ DefaultIEW::updateStatus() { bool any_unblocking = false; - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -1166,8 +1164,8 @@ DefaultIEW::executeInsts() wbNumInst = 0; wbCycle = 0; - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -1473,8 +1471,8 @@ DefaultIEW::tick() // Free function units marked as being freed this cycle. fuPool->processFreeUnits(); - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); // Check stall and squash signals, dispatch any instructions. while (threads != end) { diff --git a/src/cpu/o3/lsq_impl.hh b/src/cpu/o3/lsq_impl.hh index b67edc417..f2e369918 100644 --- a/src/cpu/o3/lsq_impl.hh +++ b/src/cpu/o3/lsq_impl.hh @@ -56,8 +56,6 @@ #include "debug/Writeback.hh" #include "params/DerivO3CPU.hh" -using namespace std; - template LSQ::LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, const DerivO3CPUParams ¶ms) : cpu(cpu_ptr), iewStage(iew_ptr), @@ -118,7 +116,7 @@ LSQ::name() const template void -LSQ::setActiveThreads(list *at_ptr) +LSQ::setActiveThreads(std::list *at_ptr) { activeThreads = at_ptr; assert(activeThreads != 0); @@ -256,8 +254,8 @@ template void LSQ::writebackStores() { - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -276,8 +274,8 @@ bool LSQ::violation() { /* Answers: Does Anybody Have a Violation?*/ - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -371,8 +369,8 @@ LSQ::getCount() { unsigned total = 0; - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -389,8 +387,8 @@ LSQ::numLoads() { unsigned total = 0; - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -407,8 +405,8 @@ LSQ::numStores() { unsigned total = 0; - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -425,8 +423,8 @@ LSQ::numFreeLoadEntries() { unsigned total = 0; - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -443,8 +441,8 @@ LSQ::numFreeStoreEntries() { unsigned total = 0; - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -473,8 +471,8 @@ template bool LSQ::isFull() { - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -509,8 +507,8 @@ template bool LSQ::lqEmpty() const { - list::const_iterator threads = activeThreads->begin(); - list::const_iterator end = activeThreads->end(); + std::list::const_iterator threads = activeThreads->begin(); + std::list::const_iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -526,8 +524,8 @@ template bool LSQ::sqEmpty() const { - list::const_iterator threads = activeThreads->begin(); - list::const_iterator end = activeThreads->end(); + std::list::const_iterator threads = activeThreads->begin(); + std::list::const_iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -543,8 +541,8 @@ template bool LSQ::lqFull() { - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -572,8 +570,8 @@ template bool LSQ::sqFull() { - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -601,8 +599,8 @@ template bool LSQ::isStalled() { - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -628,8 +626,8 @@ template bool LSQ::hasStoresToWB() { - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -645,8 +643,8 @@ template bool LSQ::willWB() { - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -662,8 +660,8 @@ template void LSQ::dumpInsts() const { - list::const_iterator threads = activeThreads->begin(); - list::const_iterator end = activeThreads->end(); + std::list::const_iterator threads = activeThreads->begin(); + std::list::const_iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; diff --git a/src/cpu/o3/rename_impl.hh b/src/cpu/o3/rename_impl.hh index 68150f993..4035667eb 100644 --- a/src/cpu/o3/rename_impl.hh +++ b/src/cpu/o3/rename_impl.hh @@ -53,8 +53,6 @@ #include "debug/O3PipeView.hh" #include "params/DerivO3CPU.hh" -using namespace std; - template DefaultRename::DefaultRename(O3CPU *_cpu, const DerivO3CPUParams ¶ms) : cpu(_cpu), @@ -271,7 +269,7 @@ DefaultRename::resetStage() template void -DefaultRename::setActiveThreads(list *at_ptr) +DefaultRename::setActiveThreads(std::list *at_ptr) { activeThreads = at_ptr; } @@ -401,8 +399,8 @@ DefaultRename::tick() sortInsts(); - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); // Check stall and squash signals. while (threads != end) { @@ -817,8 +815,8 @@ template bool DefaultRename::skidsEmpty() { - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -836,8 +834,8 @@ DefaultRename::updateStatus() { bool any_unblocking = false; - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; diff --git a/src/cpu/o3/rename_map.cc b/src/cpu/o3/rename_map.cc index dbea832ef..23d7c37ad 100644 --- a/src/cpu/o3/rename_map.cc +++ b/src/cpu/o3/rename_map.cc @@ -46,8 +46,6 @@ #include "cpu/reg_class.hh" #include "debug/Rename.hh" -using namespace std; - /**** SimpleRenameMap methods ****/ SimpleRenameMap::SimpleRenameMap() diff --git a/src/cpu/o3/rob_impl.hh b/src/cpu/o3/rob_impl.hh index 73c8a4bff..348f7253e 100644 --- a/src/cpu/o3/rob_impl.hh +++ b/src/cpu/o3/rob_impl.hh @@ -49,8 +49,6 @@ #include "debug/ROB.hh" #include "params/DerivO3CPU.hh" -using namespace std; - template ROB::ROB(O3CPU *_cpu, const DerivO3CPUParams ¶ms) : robPolicy(params.smtROBPolicy), @@ -124,7 +122,7 @@ ROB::name() const template void -ROB::setActiveThreads(list *at_ptr) +ROB::setActiveThreads(std::list *at_ptr) { DPRINTF(ROB, "Setting active threads list pointer.\n"); activeThreads = at_ptr; @@ -153,8 +151,8 @@ ROB::resetEntries() if (robPolicy != SMTQueuePolicy::Dynamic || numThreads > 1) { auto active_threads = activeThreads->size(); - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -288,8 +286,8 @@ bool ROB::canCommit() { //@todo: set ActiveThreads through ROB or CPU - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -411,8 +409,8 @@ ROB::updateHead() bool first_valid = true; // @todo: set ActiveThreads through ROB or CPU - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; @@ -452,8 +450,8 @@ ROB::updateTail() tail = instList[0].end(); bool first_valid = true; - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + std::list::iterator threads = activeThreads->begin(); + std::list::iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; diff --git a/src/cpu/pc_event.cc b/src/cpu/pc_event.cc index 71433ed29..dd52c71a5 100644 --- a/src/cpu/pc_event.cc +++ b/src/cpu/pc_event.cc @@ -38,8 +38,6 @@ #include "sim/core.hh" #include "sim/system.hh" -using namespace std; - PCEventQueue::PCEventQueue() {} @@ -70,7 +68,7 @@ bool PCEventQueue::schedule(PCEvent *event) { pcMap.push_back(event); - sort(pcMap.begin(), pcMap.end(), MapCompare()); + std::sort(pcMap.begin(), pcMap.end(), MapCompare()); DPRINTF(PCEvent, "PC based event scheduled for %#x: %s\n", event->pc(), event->descr()); diff --git a/src/cpu/simple/atomic.cc b/src/cpu/simple/atomic.cc index c3cbd496a..ae4ffec67 100644 --- a/src/cpu/simple/atomic.cc +++ b/src/cpu/simple/atomic.cc @@ -58,7 +58,6 @@ #include "sim/full_system.hh" #include "sim/system.hh" -using namespace std; using namespace TheISA; void @@ -693,7 +692,7 @@ AtomicSimpleCPU::tick() } if (fault != NoFault && - dynamic_pointer_cast(fault)) { + std::dynamic_pointer_cast(fault)) { // Retry execution of system calls after a delay. // Prevents immediate re-execution since conditions which // caused the retry are unlikely to change every tick. @@ -759,7 +758,7 @@ AtomicSimpleCPU::regProbePoints() { BaseCPU::regProbePoints(); - ppCommit = new ProbePointArg> + ppCommit = new ProbePointArg> (getProbeManager(), "Commit"); } diff --git a/src/cpu/simple/base.cc b/src/cpu/simple/base.cc index 7f4797b62..113f8e656 100644 --- a/src/cpu/simple/base.cc +++ b/src/cpu/simple/base.cc @@ -77,7 +77,6 @@ #include "sim/stats.hh" #include "sim/system.hh" -using namespace std; using namespace TheISA; BaseSimpleCPU::BaseSimpleCPU(const BaseSimpleCPUParams &p) diff --git a/src/cpu/simple/timing.cc b/src/cpu/simple/timing.cc index 0fd83cae5..aaabda56a 100644 --- a/src/cpu/simple/timing.cc +++ b/src/cpu/simple/timing.cc @@ -58,7 +58,6 @@ #include "sim/full_system.hh" #include "sim/system.hh" -using namespace std; using namespace TheISA; void @@ -601,7 +600,7 @@ TimingSimpleCPU::initiateMemAMO(Addr addr, unsigned size, if (traceData) traceData->setMem(addr, size, flags); - RequestPtr req = make_shared(addr, size, flags, + RequestPtr req = std::make_shared(addr, size, flags, dataRequestorId(), pc, thread->contextId(), std::move(amo_op)); @@ -788,7 +787,7 @@ TimingSimpleCPU::advanceInst(const Fault &fault) if (_status != Idle) { DPRINTF(SimpleCPU, "Scheduling fetch event after the Fault\n"); - Tick stall = dynamic_pointer_cast(fault) ? + Tick stall = std::dynamic_pointer_cast(fault) ? clockEdge(syscallRetryLatency) : clockEdge(); reschedule(fetchEvent, stall, true); _status = Faulting; diff --git a/src/cpu/simple_thread.cc b/src/cpu/simple_thread.cc index 8a54076df..f15be91c9 100644 --- a/src/cpu/simple_thread.cc +++ b/src/cpu/simple_thread.cc @@ -62,8 +62,6 @@ #include "sim/sim_exit.hh" #include "sim/system.hh" -using namespace std; - // constructor SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, System *_sys, Process *_process, BaseMMU *_mmu, diff --git a/src/cpu/static_inst.cc b/src/cpu/static_inst.cc index 7c6b0bfdc..86cc4c2bd 100644 --- a/src/cpu/static_inst.cc +++ b/src/cpu/static_inst.cc @@ -69,8 +69,6 @@ class NopStaticInst : public StaticInst StaticInstPtr StaticInst::nullStaticInstPtr; StaticInstPtr StaticInst::nopStaticInstPtr = new NopStaticInst; -using namespace std; - StaticInst::~StaticInst() { if (cachedDisassembly) @@ -115,11 +113,11 @@ StaticInst::branchTarget(ThreadContext *tc) const "that is not an indirect branch."); } -const string & +const std::string & StaticInst::disassemble(Addr pc, const Loader::SymbolTable *symtab) const { if (!cachedDisassembly) - cachedDisassembly = new string(generateDisassembly(pc, symtab)); + cachedDisassembly = new std::string(generateDisassembly(pc, symtab)); return *cachedDisassembly; } diff --git a/src/cpu/testers/garnet_synthetic_traffic/GarnetSyntheticTraffic.cc b/src/cpu/testers/garnet_synthetic_traffic/GarnetSyntheticTraffic.cc index b4f3511d4..7b534f9aa 100644 --- a/src/cpu/testers/garnet_synthetic_traffic/GarnetSyntheticTraffic.cc +++ b/src/cpu/testers/garnet_synthetic_traffic/GarnetSyntheticTraffic.cc @@ -45,8 +45,6 @@ #include "sim/stats.hh" #include "sim/system.hh" -using namespace std; - int TESTER_NETWORK=0; bool diff --git a/src/cpu/testers/memtest/memtest.cc b/src/cpu/testers/memtest/memtest.cc index d2002a28f..6297829a0 100644 --- a/src/cpu/testers/memtest/memtest.cc +++ b/src/cpu/testers/memtest/memtest.cc @@ -48,8 +48,6 @@ #include "sim/stats.hh" #include "sim/system.hh" -using namespace std; - unsigned int TESTER_ALLOCATOR = 0; bool @@ -163,8 +161,9 @@ MemTest::completeRequest(PacketPtr pkt, bool functional) stats.numReads++; if (numReads == (uint64_t)nextProgressMessage) { - ccprintf(cerr, "%s: completed %d read, %d write accesses @%d\n", - name(), numReads, numWrites, curTick()); + ccprintf(std::cerr, + "%s: completed %d read, %d write accesses @%d\n", + name(), numReads, numWrites, curTick()); nextProgressMessage += progressInterval; } diff --git a/src/cpu/testers/traffic_gen/base.cc b/src/cpu/testers/traffic_gen/base.cc index 737adbb68..e81706616 100644 --- a/src/cpu/testers/traffic_gen/base.cc +++ b/src/cpu/testers/traffic_gen/base.cc @@ -64,8 +64,6 @@ #endif -using namespace std; - BaseTrafficGen::BaseTrafficGen(const BaseTrafficGenParams &p) : ClockedObject(p), system(p.system), @@ -90,7 +88,7 @@ BaseTrafficGen::~BaseTrafficGen() } Port & -BaseTrafficGen::getPort(const string &if_name, PortID idx) +BaseTrafficGen::getPort(const std::string &if_name, PortID idx) { if (if_name == "port") { return port; diff --git a/src/cpu/testers/traffic_gen/hybrid_gen.cc b/src/cpu/testers/traffic_gen/hybrid_gen.cc index 638d7a327..7b03f3855 100644 --- a/src/cpu/testers/traffic_gen/hybrid_gen.cc +++ b/src/cpu/testers/traffic_gen/hybrid_gen.cc @@ -46,8 +46,6 @@ #include "debug/TrafficGen.hh" #include "enums/AddrMap.hh" -using namespace std; - HybridGen::HybridGen(SimObject &obj, RequestorID requestor_id, Tick _duration, Addr start_addr_dram, Addr end_addr_dram, diff --git a/src/cpu/testers/traffic_gen/traffic_gen.cc b/src/cpu/testers/traffic_gen/traffic_gen.cc index 500566555..1ea4d5eab 100644 --- a/src/cpu/testers/traffic_gen/traffic_gen.cc +++ b/src/cpu/testers/traffic_gen/traffic_gen.cc @@ -49,8 +49,6 @@ #include "sim/stats.hh" #include "sim/system.hh" -using namespace std; - TrafficGen::TrafficGen(const TrafficGenParams &p) : BaseTrafficGen(p), configFile(p.config_file), @@ -126,11 +124,11 @@ TrafficGen::parseConfig() { // keep track of the transitions parsed to create the matrix when // done - vector transitions; + std::vector transitions; // open input file - ifstream infile; - infile.open(configFile.c_str(), ifstream::in); + std::ifstream infile; + infile.open(configFile.c_str(), std::ifstream::in); if (!infile.is_open()) { fatal("Traffic generator %s config file not found at %s\n", name(), configFile); @@ -140,14 +138,14 @@ TrafficGen::parseConfig() // read line by line and determine the action based on the first // keyword - string keyword; - string line; + std::string keyword; + std::string line; while (getline(infile, line).good()) { // see if this line is a comment line, and if so skip it if (line.find('#') != 1) { // create an input stream for the tokenization - istringstream is(line); + std::istringstream is(line); // determine the keyword is >> keyword; @@ -156,12 +154,12 @@ TrafficGen::parseConfig() // parse the behaviour of this state uint32_t id; Tick duration; - string mode; + std::string mode; is >> id >> duration >> mode; if (mode == "TRACE") { - string traceFile; + std::string traceFile; Addr addrOffset; is >> traceFile >> addrOffset; @@ -319,7 +317,7 @@ TrafficGen::parseConfig() transitionMatrix[i].resize(states.size()); } - for (vector::iterator t = transitions.begin(); + for (std::vector::iterator t = transitions.begin(); t != transitions.end(); ++t) { transitionMatrix[t->from][t->to] = t->p; }