Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/39562 )

Change subject: cpu: Stop "using namespace std"
......................................................................

cpu: Stop "using namespace std"

Change-Id: I1b648914d353672076d903ed581aa61cdd7c1d0f
---
M src/cpu/activity.cc
M src/cpu/base.cc
M src/cpu/checker/cpu.cc
M src/cpu/checker/cpu_impl.hh
M src/cpu/exetrace.cc
M src/cpu/func_unit.cc
M src/cpu/inteltrace.cc
M src/cpu/intr_control.cc
M src/cpu/intr_control_noisa.cc
M src/cpu/nativetrace.cc
M src/cpu/o3/commit_impl.hh
M src/cpu/o3/cpu.cc
M src/cpu/o3/fetch_impl.hh
M src/cpu/o3/fu_pool.cc
M src/cpu/o3/iew_impl.hh
M src/cpu/o3/lsq_impl.hh
M src/cpu/o3/rename_impl.hh
M src/cpu/o3/rename_map.cc
M src/cpu/o3/rob_impl.hh
M src/cpu/pc_event.cc
M src/cpu/simple/atomic.cc
M src/cpu/simple/base.cc
M src/cpu/simple/timing.cc
M src/cpu/simple_thread.cc
M src/cpu/static_inst.cc
M src/cpu/testers/garnet_synthetic_traffic/GarnetSyntheticTraffic.cc
M src/cpu/testers/memtest/memtest.cc
M src/cpu/testers/traffic_gen/base.cc
M src/cpu/testers/traffic_gen/hybrid_gen.cc
M src/cpu/testers/traffic_gen/traffic_gen.cc
30 files changed, 142 insertions(+), 194 deletions(-)



diff --git a/src/cpu/activity.cc b/src/cpu/activity.cc
index 4e8b558..2c8df0e 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 0c998be..af928f1 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> BaseCPU::globalStats;

-vector<BaseCPU *> BaseCPU::cpuList;
+std::vector<BaseCPU *> 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 @@

     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 @@
     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 @@
 }

 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 @@
         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 ccbc649..8815530 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 @@
 }

 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 70dc451..733cf1c 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 <class Impl>
diff --git a/src/cpu/exetrace.cc b/src/cpu/exetrace.cc
index 4980c91..02ede1a 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 @@
     }

     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 @@
     //  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 @@
         }

         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 @@
     //
     //  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 d131d76..7d979bc 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 @@
     return capabilityList[capability];
 }

-bitset<Num_OpClasses>
+std::bitset<Num_OpClasses>
 FuncUnit::capabilities()
 {
     return capabilityList;
diff --git a/src/cpu/inteltrace.cc b/src/cpu/inteltrace.cc
index 68da261..4e36a9d 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 @@
 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, "<RD %#x>", addr);
     } else if (staticInst->isStore()) {
         ccprintf(outs, "<WR %#x>", addr);
     }
-    outs << endl;
+    outs << std::endl;
 }

 } // namespace Trace
diff --git a/src/cpu/intr_control.cc b/src/cpu/intr_control.cc
index b624835..74e0457 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 998641c..71d2c02 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 65b2833..49870ea 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 @@
         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 717ae33..ccf5363 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 <class Impl>
 void
 DefaultCommit<Impl>::processTrapEvent(ThreadID tid)
@@ -292,7 +290,7 @@

 template<class Impl>
 void
-DefaultCommit<Impl>::setActiveThreads(list<ThreadID> *at_ptr)
+DefaultCommit<Impl>::setActiveThreads(std::list<ThreadID> *at_ptr)
 {
     activeThreads = at_ptr;
 }
@@ -428,7 +426,7 @@
 void
 DefaultCommit<Impl>::deactivateThread(ThreadID tid)
 {
-    list<ThreadID>::iterator thread_it = std::find(priority_list.begin(),
+ std::list<ThreadID>::iterator thread_it = std::find(priority_list.begin(),
             priority_list.end(), tid);

     if (thread_it != priority_list.end()) {
@@ -463,8 +461,8 @@
 DefaultCommit<Impl>::updateStatus()
 {
     // reset ROB changed variable
-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -493,8 +491,8 @@
 bool
 DefaultCommit<Impl>::changedROBEntries()
 {
-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -524,7 +522,7 @@
         [this, tid]{ processTrapEvent(tid); },
         "Trap", true, Event::CPU_Tick_Pri);

-    Cycles latency = dynamic_pointer_cast<SyscallRetryFault>(inst_fault) ?
+ Cycles latency = std::dynamic_pointer_cast<SyscallRetryFault>(inst_fault) ?
                      cpu->syscallRetryLatency : trapLatency;

     // hardware transactional memory
@@ -661,8 +659,8 @@
     if (activeThreads->empty())
         return;

-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     // Check if any of the threads are done squashing.  Change the
     // status if they are done.
@@ -822,8 +820,8 @@
     ////////////////////////////////////
     // Check for any possible squashes, handle them first
     ////////////////////////////////////
-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     int num_squashing_threads = 0;

@@ -1528,8 +1526,8 @@
 ThreadID
 DefaultCommit<Impl>::roundRobin()
 {
-    list<ThreadID>::iterator pri_iter = priority_list.begin();
-    list<ThreadID>::iterator end      = priority_list.end();
+    std::list<ThreadID>::iterator pri_iter = priority_list.begin();
+    std::list<ThreadID>::iterator end      = priority_list.end();

     while (pri_iter != end) {
         ThreadID tid = *pri_iter;
@@ -1559,8 +1557,8 @@
     unsigned oldest = 0;
     bool first = true;

-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::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 4068b30..56cf46c 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 &params)
     : BaseCPU(params)
@@ -581,7 +580,7 @@
 void
 FullO3CPU<Impl>::activateThread(ThreadID tid)
 {
-    list<ThreadID>::iterator isActive =
+    std::list<ThreadID>::iterator isActive =
         std::find(activeThreads.begin(), activeThreads.end(), tid);

     DPRINTF(O3CPU, "[tid:%i] Calling activate thread.\n", tid);
@@ -604,7 +603,7 @@
     assert(!commit.executingHtmTransaction(tid));

     //Remove From Active List, if Active
-    list<ThreadID>::iterator thread_it =
+    std::list<ThreadID>::iterator thread_it =
         std::find(activeThreads.begin(), activeThreads.end(), tid);

     DPRINTF(O3CPU, "[tid:%i] Calling deactivate thread.\n", tid);
@@ -1722,7 +1721,7 @@
     if (activeThreads.size() > 1) {
         //DEFAULT TO ROUND ROBIN SCHEME
         //e.g. Move highest priority to end of thread list
-        list<ThreadID>::iterator list_begin = activeThreads.begin();
+        std::list<ThreadID>::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 6f03e78..23ab06b 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<class Impl>
DefaultFetch<Impl>::DefaultFetch(O3CPU *_cpu, const DerivO3CPUParams &params)
     : fetchPolicy(params.smtFetchPolicy),
@@ -804,8 +802,8 @@
 DefaultFetch<Impl>::updateFetchStatus()
 {
     //Check Running
-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -857,8 +855,8 @@
 void
 DefaultFetch<Impl>::tick()
 {
-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();
     bool status_change = false;

     wroteToTimeBuffer = false;
@@ -1423,7 +1421,7 @@
             return InvalidThreadID;
         }
     } else {
-        list<ThreadID>::iterator thread = activeThreads->begin();
+        std::list<ThreadID>::iterator thread = activeThreads->begin();
         if (thread == activeThreads->end()) {
             return InvalidThreadID;
         }
@@ -1445,8 +1443,8 @@
 ThreadID
 DefaultFetch<Impl>::roundRobin()
 {
-    list<ThreadID>::iterator pri_iter = priorityList.begin();
-    list<ThreadID>::iterator end      = priorityList.end();
+    std::list<ThreadID>::iterator pri_iter = priorityList.begin();
+    std::list<ThreadID>::iterator end      = priorityList.end();

     ThreadID high_pri;

@@ -1476,12 +1474,12 @@
 DefaultFetch<Impl>::iqCount()
 {
     //sorted from lowest->highest
-    std::priority_queue<unsigned,vector<unsigned>,
+    std::priority_queue<unsigned, std::vector<unsigned>,
                         std::greater<unsigned> > PQ;
     std::map<unsigned, ThreadID> threadMap;

-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -1513,12 +1511,12 @@
 DefaultFetch<Impl>::lsqCount()
 {
     //sorted from lowest->highest
-    std::priority_queue<unsigned,vector<unsigned>,
+    std::priority_queue<unsigned, std::vector<unsigned>,
                         std::greater<unsigned> > PQ;
     std::map<unsigned, ThreadID> threadMap;

-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::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 caab181..7ffd25d 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 @@
     //
     //  Iterate through the list of FUDescData structures
     //
-    const vector<FUDesc *> &paramList =  p.FUList;
+    const std::vector<FUDesc *> &paramList =  p.FUList;
     for (FUDDiterator i = paramList.begin(); i != paramList.end(); ++i) {

         //
@@ -136,7 +134,7 @@
             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 @@
 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 9e56ed0..5ab59ff 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<class Impl>
 DefaultIEW<Impl>::DefaultIEW(O3CPU *_cpu, const DerivO3CPUParams &params)
     : issueToExecQueue(params.backComSize, params.forwardComSize),
@@ -319,7 +317,7 @@

 template<class Impl>
 void
-DefaultIEW<Impl>::setActiveThreads(list<ThreadID> *at_ptr)
+DefaultIEW<Impl>::setActiveThreads(std::list<ThreadID> *at_ptr)
 {
     activeThreads = at_ptr;

@@ -632,8 +630,8 @@
 {
     int max=0;

-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -649,8 +647,8 @@
 bool
 DefaultIEW<Impl>::skidsEmpty()
 {
-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -668,8 +666,8 @@
 {
     bool any_unblocking = false;

-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -1166,8 +1164,8 @@
     wbNumInst = 0;
     wbCycle = 0;

-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -1473,8 +1471,8 @@
     // Free function units marked as being freed this cycle.
     fuPool->processFreeUnits();

-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::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 b67edc4..f2e3699 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 <class Impl>
LSQ<Impl>::LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, const DerivO3CPUParams &params)
     : cpu(cpu_ptr), iewStage(iew_ptr),
@@ -118,7 +116,7 @@

 template<class Impl>
 void
-LSQ<Impl>::setActiveThreads(list<ThreadID> *at_ptr)
+LSQ<Impl>::setActiveThreads(std::list<ThreadID> *at_ptr)
 {
     activeThreads = at_ptr;
     assert(activeThreads != 0);
@@ -256,8 +254,8 @@
 void
 LSQ<Impl>::writebackStores()
 {
-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -276,8 +274,8 @@
 LSQ<Impl>::violation()
 {
     /* Answers: Does Anybody Have a Violation?*/
-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -371,8 +369,8 @@
 {
     unsigned total = 0;

-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -389,8 +387,8 @@
 {
     unsigned total = 0;

-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -407,8 +405,8 @@
 {
     unsigned total = 0;

-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -425,8 +423,8 @@
 {
     unsigned total = 0;

-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -443,8 +441,8 @@
 {
     unsigned total = 0;

-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -473,8 +471,8 @@
 bool
 LSQ<Impl>::isFull()
 {
-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -509,8 +507,8 @@
 bool
 LSQ<Impl>::lqEmpty() const
 {
-    list<ThreadID>::const_iterator threads = activeThreads->begin();
-    list<ThreadID>::const_iterator end = activeThreads->end();
+    std::list<ThreadID>::const_iterator threads = activeThreads->begin();
+    std::list<ThreadID>::const_iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -526,8 +524,8 @@
 bool
 LSQ<Impl>::sqEmpty() const
 {
-    list<ThreadID>::const_iterator threads = activeThreads->begin();
-    list<ThreadID>::const_iterator end = activeThreads->end();
+    std::list<ThreadID>::const_iterator threads = activeThreads->begin();
+    std::list<ThreadID>::const_iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -543,8 +541,8 @@
 bool
 LSQ<Impl>::lqFull()
 {
-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -572,8 +570,8 @@
 bool
 LSQ<Impl>::sqFull()
 {
-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -601,8 +599,8 @@
 bool
 LSQ<Impl>::isStalled()
 {
-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -628,8 +626,8 @@
 bool
 LSQ<Impl>::hasStoresToWB()
 {
-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -645,8 +643,8 @@
 bool
 LSQ<Impl>::willWB()
 {
-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -662,8 +660,8 @@
 void
 LSQ<Impl>::dumpInsts() const
 {
-    list<ThreadID>::const_iterator threads = activeThreads->begin();
-    list<ThreadID>::const_iterator end = activeThreads->end();
+    std::list<ThreadID>::const_iterator threads = activeThreads->begin();
+    std::list<ThreadID>::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 68150f9..4035667 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 <class Impl>
DefaultRename<Impl>::DefaultRename(O3CPU *_cpu, const DerivO3CPUParams &params)
     : cpu(_cpu),
@@ -271,7 +269,7 @@

 template<class Impl>
 void
-DefaultRename<Impl>::setActiveThreads(list<ThreadID> *at_ptr)
+DefaultRename<Impl>::setActiveThreads(std::list<ThreadID> *at_ptr)
 {
     activeThreads = at_ptr;
 }
@@ -401,8 +399,8 @@

     sortInsts();

-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     // Check stall and squash signals.
     while (threads != end) {
@@ -817,8 +815,8 @@
 bool
 DefaultRename<Impl>::skidsEmpty()
 {
-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -836,8 +834,8 @@
 {
     bool any_unblocking = false;

-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::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 dbea832..23d7c37 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 73c8a4b..348f725 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 <class Impl>
 ROB<Impl>::ROB(O3CPU *_cpu, const DerivO3CPUParams &params)
     : robPolicy(params.smtROBPolicy),
@@ -124,7 +122,7 @@

 template <class Impl>
 void
-ROB<Impl>::setActiveThreads(list<ThreadID> *at_ptr)
+ROB<Impl>::setActiveThreads(std::list<ThreadID> *at_ptr)
 {
     DPRINTF(ROB, "Setting active threads list pointer.\n");
     activeThreads = at_ptr;
@@ -153,8 +151,8 @@
     if (robPolicy != SMTQueuePolicy::Dynamic || numThreads > 1) {
         auto active_threads = activeThreads->size();

-        list<ThreadID>::iterator threads = activeThreads->begin();
-        list<ThreadID>::iterator end = activeThreads->end();
+        std::list<ThreadID>::iterator threads = activeThreads->begin();
+        std::list<ThreadID>::iterator end = activeThreads->end();

         while (threads != end) {
             ThreadID tid = *threads++;
@@ -288,8 +286,8 @@
 ROB<Impl>::canCommit()
 {
     //@todo: set ActiveThreads through ROB or CPU
-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -411,8 +409,8 @@
     bool first_valid = true;

     // @todo: set ActiveThreads through ROB or CPU
-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::iterator end = activeThreads->end();

     while (threads != end) {
         ThreadID tid = *threads++;
@@ -452,8 +450,8 @@
     tail = instList[0].end();
     bool first_valid = true;

-    list<ThreadID>::iterator threads = activeThreads->begin();
-    list<ThreadID>::iterator end = activeThreads->end();
+    std::list<ThreadID>::iterator threads = activeThreads->begin();
+    std::list<ThreadID>::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 71433ed..dd52c71 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 @@
 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 c3cbd49..ae4ffec 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 @@
                 }

                 if (fault != NoFault &&
-                    dynamic_pointer_cast<SyscallRetryFault>(fault)) {
+                    std::dynamic_pointer_cast<SyscallRetryFault>(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 @@
 {
     BaseCPU::regProbePoints();

-    ppCommit = new ProbePointArg<pair<SimpleThread*, const StaticInstPtr>>
+ ppCommit = new ProbePointArg<std::pair<SimpleThread*, const StaticInstPtr>>
                                 (getProbeManager(), "Commit");
 }

diff --git a/src/cpu/simple/base.cc b/src/cpu/simple/base.cc
index 7f4797b..113f8e6 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 0fd83ca..aaabda5 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 @@
     if (traceData)
         traceData->setMem(addr, size, flags);

-    RequestPtr req = make_shared<Request>(addr, size, flags,
+    RequestPtr req = std::make_shared<Request>(addr, size, flags,
                             dataRequestorId(), pc, thread->contextId(),
                             std::move(amo_op));

@@ -788,7 +787,7 @@
         if (_status != Idle) {
             DPRINTF(SimpleCPU, "Scheduling fetch event after the Fault\n");

-            Tick stall = dynamic_pointer_cast<SyscallRetryFault>(fault) ?
+ Tick stall = std::dynamic_pointer_cast<SyscallRetryFault>(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 8a54076..f15be91 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 7c6b0bf..86cc4c2 100644
--- a/src/cpu/static_inst.cc
+++ b/src/cpu/static_inst.cc
@@ -69,8 +69,6 @@
 StaticInstPtr StaticInst::nullStaticInstPtr;
 StaticInstPtr StaticInst::nopStaticInstPtr = new NopStaticInst;

-using namespace std;
-
 StaticInst::~StaticInst()
 {
     if (cachedDisassembly)
@@ -115,11 +113,11 @@
           "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 b4f3511..7b534f9 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 d2002a2..6297829 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 @@
             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 737adbb..e817066 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 @@
 }

 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 638d7a3..7b03f38 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 5005665..1ea4d5e 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 @@
 {
     // keep track of the transitions parsed to create the matrix when
     // done
-    vector<Transition> transitions;
+    std::vector<Transition> 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 @@

     // 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 @@
                 // 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 @@
         transitionMatrix[i].resize(states.size());
     }

-    for (vector<Transition>::iterator t = transitions.begin();
+    for (std::vector<Transition>::iterator t = transitions.begin();
          t != transitions.end(); ++t) {
         transitionMatrix[t->from][t->to] = t->p;
     }

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39562
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: I1b648914d353672076d903ed581aa61cdd7c1d0f
Gerrit-Change-Number: 39562
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[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