[gem5-dev] Change in gem5/gem5[develop]: tests: Stop "using namespace std" in unittest/.

2021-01-23 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/39565 )


Change subject: tests: Stop "using namespace std" in unittest/.
..

tests: Stop "using namespace std" in unittest/.

These are the historical "unit test"s, which aren't really unit tests,
they're actually complete builds of gem5 with main functions which run a
fairly specific test instead of a simulation. They test a single unit,
but they do it with all the other units in place and potentially
participating in the test.

Change-Id: Ib0ea68f26091a79992396d932627e4ce180f7825
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39565
Reviewed-by: Giacomo Travaglini 
Maintainer: Giacomo Travaglini 
Tested-by: kokoro 
---
M src/unittest/cprintftime.cc
M src/unittest/nmtest.cc
M src/unittest/stattest.cc
M src/unittest/symtest.cc
4 files changed, 13 insertions(+), 17 deletions(-)

Approvals:
  Giacomo Travaglini: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/unittest/cprintftime.cc b/src/unittest/cprintftime.cc
index f8f1492..a09c4cb 100644
--- a/src/unittest/cprintftime.cc
+++ b/src/unittest/cprintftime.cc
@@ -36,8 +36,6 @@

 #include "base/cprintf.hh"

-using namespace std;
-
 volatile int stop = false;

 void
@@ -56,14 +54,14 @@
 int
 main()
 {
-stringstream result;
+std::stringstream result;
 int iterations = 0;

 signal(SIGALRM, handle_alarm);

 do_test(10);
 while (!stop) {
-stringstream result;
+std::stringstream result;
 ccprintf(result,
  "this is a %s of %d iterations %3.2f %p\n",
  "test", iterations, 51.934, );
diff --git a/src/unittest/nmtest.cc b/src/unittest/nmtest.cc
index f25c5e1..fd24524 100644
--- a/src/unittest/nmtest.cc
+++ b/src/unittest/nmtest.cc
@@ -34,8 +34,6 @@
 #include "base/logging.hh"
 #include "base/str.hh"

-using namespace std;
-
 int
 main(int argc, char *argv[])
 {
@@ -50,7 +48,7 @@
 for (const Loader::Symbol : obj->symtab())
 cprintf("%#x %s\n", symbol.address, symbol.name);
 } else {
-string symbol = argv[2];
+std::string symbol = argv[2];
 Addr address;

 if (symbol[0] == '0' && symbol[1] == 'x') {
diff --git a/src/unittest/stattest.cc b/src/unittest/stattest.cc
index e58a5a6..650c137 100644
--- a/src/unittest/stattest.cc
+++ b/src/unittest/stattest.cc
@@ -50,7 +50,6 @@
 0 // sentinel is required
 };

-using namespace std;
 using namespace Stats;

 double testfunc();
diff --git a/src/unittest/symtest.cc b/src/unittest/symtest.cc
index 369e1a4..6de3c8d 100644
--- a/src/unittest/symtest.cc
+++ b/src/unittest/symtest.cc
@@ -31,14 +31,13 @@
 #include "base/loader/symtab.hh"
 #include "base/str.hh"

-using namespace std;
-
 void usage(const char *progname);

 void
 usage(const char *progname)
 {
-cout << "Usage: " << progname << "  " << endl;
+std::cout << "Usage: " << progname << "  "
+<< std::endl;

 exit(1);
 }
@@ -52,29 +51,31 @@
 usage(argv[0]);

 if (!symtab.load(argv[1])) {
-cout << "could not load symbol file: " << argv[1] << endl;
+std::cout << "could not load symbol file: " << argv[1] <<  
std::endl;

 exit(1);
 }

-string symbol = argv[2];
+std::string symbol = argv[2];
 Addr address;

 if (!to_number(symbol, address)) {
 auto it = symtab.find(symbol);
 if (it == symtab.end()) {
-cout << "could not find symbol: " << symbol << endl;
+std::cout << "could not find symbol: " << symbol << std::endl;
 exit(1);
 }

-cout << symbol << " -> " << "0x" << hex << it->address << endl;
+std::cout << symbol << " -> " << "0x" << std::hex << it->address <<
+std::endl;
 } else {
 auto it = symtab.find(address);
 if (it == symtab.end()) {
-cout << "could not find address: " << address << endl;
+std::cout << "could not find address: " << address <<  
std::endl;

 exit(1);
 }

-cout << "0x" << hex << address << " -> " << it->name << endl;
+std::cout << "0x" << std::hex << address << " -> " << it->name <<
+std::endl;
 }

 return 0;

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39565
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: Ib0ea68f26091a79992396d932627e4ce180f7825
Gerrit-Change-Number: 39565
Gerrit-PatchSet: 7
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Bobby R. Bruce 
Gerrit-Reviewer: Daniel Carvalho 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Giacomo Travaglini 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged

[gem5-dev] Change in gem5/gem5[develop]: misc: Stop "using namespace std" in protoio.cc.

2021-01-23 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/39563 )


Change subject: misc: Stop "using namespace std" in protoio.cc.
..

misc: Stop "using namespace std" in protoio.cc.

Change-Id: I4f27979910230860c631b63bb500f87b45c24e33
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39563
Reviewed-by: Daniel Carvalho 
Maintainer: Gabe Black 
Tested-by: kokoro 
---
M src/proto/protoio.cc
1 file changed, 8 insertions(+), 8 deletions(-)

Approvals:
  Daniel Carvalho: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/proto/protoio.cc b/src/proto/protoio.cc
index 691d4ee..72e463b 100644
--- a/src/proto/protoio.cc
+++ b/src/proto/protoio.cc
@@ -39,11 +39,11 @@

 #include "base/logging.hh"

-using namespace std;
 using namespace google::protobuf;

-ProtoOutputStream::ProtoOutputStream(const string& filename) :
-fileStream(filename.c_str(), ios::out | ios::binary | ios::trunc),
+ProtoOutputStream::ProtoOutputStream(const std::string& filename) :
+fileStream(filename.c_str(),
+std::ios::out | std::ios::binary | std::ios::trunc),
 wrappedFileStream(NULL), gzipStream(NULL), zeroCopyStream(NULL)
 {
 if (!fileStream.good())
@@ -98,9 +98,9 @@
 msg.SerializeWithCachedSizes();
 }

-ProtoInputStream::ProtoInputStream(const string& filename) :
-fileStream(filename.c_str(), ios::in | ios::binary),  
fileName(filename),

-useGzip(false),
+ProtoInputStream::ProtoInputStream(const std::string& filename) :
+fileStream(filename.c_str(), std::ios::in | std::ios::binary),
+fileName(filename), useGzip(false),
 wrappedFileStream(NULL), gzipStream(NULL), zeroCopyStream(NULL)
 {
 if (!fileStream.good())
@@ -113,7 +113,7 @@

 // seek to the start of the input file and clear any flags
 fileStream.clear();
-fileStream.seekg(0, ifstream::beg);
+fileStream.seekg(0, std::ifstream::beg);

 createStreams();
 }
@@ -172,7 +172,7 @@
 destroyStreams();
 // seek to the start of the input file and clear any flags
 fileStream.clear();
-fileStream.seekg(0, ifstream::beg);
+fileStream.seekg(0, std::ifstream::beg);
 createStreams();
 }


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39563
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: I4f27979910230860c631b63bb500f87b45c24e33
Gerrit-Change-Number: 39563
Gerrit-PatchSet: 7
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Bobby R. Bruce 
Gerrit-Reviewer: Daniel Carvalho 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Giacomo Travaglini 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: cpu: Stop "using namespace std"

2021-01-23 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/39562 )


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

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 
---
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(-)

Approvals:
  Daniel Carvalho: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass



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 , int num_stages,
+ActivityRecorder::ActivityRecorder(const std::string , 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;

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

 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 _name, PortID idx)
+BaseCPU::getPort(const std::string _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 ) const
+CheckerCPU::serialize(std::ostream ) 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 
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" << 

[gem5-dev] Change in gem5/gem5[develop]: arch-arm: Stop "using namespace std"

2021-01-23 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/39561 )


Change subject: arch-arm: Stop "using namespace std"
..

arch-arm: Stop "using namespace std"

Change-Id: If0f373bdaadce81c5ebbc37b03810335c42dd10a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39561
Reviewed-by: Giacomo Travaglini 
Maintainer: Giacomo Travaglini 
Tested-by: kokoro 
---
M src/arch/arm/insts/macromem.cc
M src/arch/arm/insts/mem.cc
M src/arch/arm/insts/mem64.cc
M src/arch/arm/linux/process.cc
M src/arch/arm/miscregs.cc
M src/arch/arm/pauth_helpers.cc
M src/arch/arm/process.cc
M src/arch/arm/qarma.cc
M src/arch/arm/remote_gdb.cc
M src/arch/arm/self_debug.cc
M src/arch/arm/system.cc
M src/arch/arm/tlb.cc
M src/arch/arm/tracers/tarmac_parser.cc
13 files changed, 45 insertions(+), 60 deletions(-)

Approvals:
  Giacomo Travaglini: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/arch/arm/insts/macromem.cc b/src/arch/arm/insts/macromem.cc
index 1ce9705..e20aef9 100644
--- a/src/arch/arm/insts/macromem.cc
+++ b/src/arch/arm/insts/macromem.cc
@@ -45,7 +45,6 @@
 #include "arch/arm/generated/decoder.hh"
 #include "arch/arm/insts/neon64_mem.hh"

-using namespace std;
 using namespace ArmISAInst;

 namespace ArmISA
diff --git a/src/arch/arm/insts/mem.cc b/src/arch/arm/insts/mem.cc
index e44fc96..8ee3f49 100644
--- a/src/arch/arm/insts/mem.cc
+++ b/src/arch/arm/insts/mem.cc
@@ -42,8 +42,6 @@

 #include "base/loader/symtab.hh"

-using namespace std;
-
 namespace ArmISA
 {

@@ -75,10 +73,10 @@
 }
 }

-string
+std::string
 RfeOp::generateDisassembly(Addr pc, const Loader::SymbolTable *symtab)  
const

 {
-stringstream ss;
+std::stringstream ss;
 switch (mode) {
   case DecrementAfter:
 printMnemonic(ss, "da");
@@ -100,10 +98,10 @@
 return ss.str();
 }

-string
+std::string
 SrsOp::generateDisassembly(Addr pc, const Loader::SymbolTable *symtab)  
const

 {
-stringstream ss;
+std::stringstream ss;
 switch (mode) {
   case DecrementAfter:
 printMnemonic(ss, "da");
diff --git a/src/arch/arm/insts/mem64.cc b/src/arch/arm/insts/mem64.cc
index ed159be..44fe735 100644
--- a/src/arch/arm/insts/mem64.cc
+++ b/src/arch/arm/insts/mem64.cc
@@ -41,8 +41,6 @@
 #include "base/loader/symtab.hh"
 #include "mem/request.hh"

-using namespace std;
-
 namespace ArmISA
 {

diff --git a/src/arch/arm/linux/process.cc b/src/arch/arm/linux/process.cc
index 7f86c24..cba3d14 100644
--- a/src/arch/arm/linux/process.cc
+++ b/src/arch/arm/linux/process.cc
@@ -54,7 +54,6 @@
 #include "sim/syscall_emul.hh"
 #include "sim/system.hh"

-using namespace std;
 using namespace ArmISA;

 const Addr ArmLinuxProcess32::commPage = 0x;
diff --git a/src/arch/arm/miscregs.cc b/src/arch/arm/miscregs.cc
index b5af9b6..5dfbd48 100644
--- a/src/arch/arm/miscregs.cc
+++ b/src/arch/arm/miscregs.cc
@@ -333,8 +333,6 @@
 return MISCREG_CP14_UNIMPL;
 }

-using namespace std;
-
 MiscRegIndex
 decodeCP15Reg(unsigned crn, unsigned opc1, unsigned crm, unsigned opc2)
 {
@@ -3393,7 +3391,7 @@
 return MISCREG_UNKNOWN;
 }

-bitset miscRegInfo[NUM_MISCREGS]; // initialized below
+std::bitset miscRegInfo[NUM_MISCREGS]; // initialized  
below


 void
 ISA::initializeMiscRegMetadata()
diff --git a/src/arch/arm/pauth_helpers.cc b/src/arch/arm/pauth_helpers.cc
index 7424eb3..aa93384 100644
--- a/src/arch/arm/pauth_helpers.cc
+++ b/src/arch/arm/pauth_helpers.cc
@@ -41,7 +41,6 @@
 #include "base/bitfield.hh"

 using namespace ArmISA;
-using namespace std;

 bool
 ArmISA::calculateTBI(ThreadContext* tc, ExceptionLevel el,
@@ -101,11 +100,11 @@
 using64k  = el == EL2 ? tcr2.tg0 == 0x1 : tcr3.tg0 == 0x1 ;
 }
 uint32_t max_limit_tsz_field = using64k ? 47 : 48;
-tsz_field = min(tsz_field, max_limit_tsz_field);
+tsz_field = std::min(tsz_field, max_limit_tsz_field);
 const AA64MMFR2 mm_fr2 = tc->readMiscReg(MISCREG_ID_AA64MMFR2_EL1);

 uint32_t tszmin = (using64k && (bool)mm_fr2.varange) ? 12 : 16;
-tsz_field = max(tsz_field, tszmin);
+tsz_field = std::max(tsz_field, tszmin);

 return (64-tsz_field);
 }
diff --git a/src/arch/arm/process.cc b/src/arch/arm/process.cc
index 6f37d11..86bc8e2 100644
--- a/src/arch/arm/process.cc
+++ b/src/arch/arm/process.cc
@@ -55,7 +55,6 @@
 #include "sim/syscall_return.hh"
 #include "sim/system.hh"

-using namespace std;
 using namespace ArmISA;

 ArmProcess::ArmProcess(const ProcessParams ,
@@ -78,9 +77,9 @@
 Addr next_thread_stack_base = stack_base - max_stack_size;
 Addr mmap_end = 0x4000L;

-memState = make_shared(this, brk_point, stack_base,
- max_stack_size,  
next_thread_stack_base,

- mmap_end);
+memState = std::make_shared(
+this, brk_point, stack_base, max_stack_size,
+

[gem5-dev] Change in gem5/gem5[develop]: arch-sparc: Stop "using namespace std"

2021-01-23 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/39560 )


Change subject: arch-sparc: Stop "using namespace std"
..

arch-sparc: Stop "using namespace std"

Change-Id: I4a1019b5978b08b4999edfe5f65ef7eae06481c2
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39560
Reviewed-by: Daniel Carvalho 
Maintainer: Gabe Black 
Tested-by: kokoro 
---
M src/arch/sparc/faults.cc
M src/arch/sparc/isa/includes.isa
M src/arch/sparc/process.cc
M src/arch/sparc/remote_gdb.cc
M src/arch/sparc/ua2005.cc
5 files changed, 6 insertions(+), 12 deletions(-)

Approvals:
  Daniel Carvalho: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/arch/sparc/faults.cc b/src/arch/sparc/faults.cc
index b480558..a80e649 100644
--- a/src/arch/sparc/faults.cc
+++ b/src/arch/sparc/faults.cc
@@ -42,8 +42,6 @@
 #include "sim/full_system.hh"
 #include "sim/process.hh"

-using namespace std;
-
 namespace SparcISA
 {

@@ -340,7 +338,7 @@
 tc->setMiscRegNoEffect(MISCREG_TT, tt);

 // Update GL
-tc->setMiscReg(MISCREG_GL, min(GL+1, MaxGL));
+tc->setMiscReg(MISCREG_GL, std::min(GL+1, MaxGL));

 bool priv = pstate.priv; // just save the priv bit
 pstate = 0;
@@ -424,9 +422,9 @@

 // Update the global register level
 if (!gotoHpriv)
-tc->setMiscReg(MISCREG_GL, min(GL + 1, MaxPGL));
+tc->setMiscReg(MISCREG_GL, std::min(GL + 1, MaxPGL));
 else
-tc->setMiscReg(MISCREG_GL, min(GL + 1, MaxGL));
+tc->setMiscReg(MISCREG_GL, std::min(GL + 1, MaxGL));

 // pstate.mm is unchanged
 pstate.pef = 1; // PSTATE.pef = whether or not an fpu is present
diff --git a/src/arch/sparc/isa/includes.isa  
b/src/arch/sparc/isa/includes.isa

index da814e3..1cef0fc 100644
--- a/src/arch/sparc/isa/includes.isa
+++ b/src/arch/sparc/isa/includes.isa
@@ -86,6 +86,5 @@
 #include "sim/sim_exit.hh"

 using namespace SparcISA;
-using namespace std;
 }};

diff --git a/src/arch/sparc/process.cc b/src/arch/sparc/process.cc
index b292c86..0923eeb 100644
--- a/src/arch/sparc/process.cc
+++ b/src/arch/sparc/process.cc
@@ -45,7 +45,6 @@
 #include "sim/syscall_return.hh"
 #include "sim/system.hh"

-using namespace std;
 using namespace SparcISA;

 SparcProcess::SparcProcess(const ProcessParams ,
@@ -142,7 +141,7 @@

 std::vector> auxv;

-string filename;
+std::string filename;
 if (argv.size() < 1)
 filename = "";
 else
diff --git a/src/arch/sparc/remote_gdb.cc b/src/arch/sparc/remote_gdb.cc
index cf91f3d..a2988c6 100644
--- a/src/arch/sparc/remote_gdb.cc
+++ b/src/arch/sparc/remote_gdb.cc
@@ -140,7 +140,6 @@
 #include "sim/process.hh"
 #include "sim/system.hh"

-using namespace std;
 using namespace SparcISA;

 RemoteGDB::RemoteGDB(System *_system, ThreadContext *c, int _port)
diff --git a/src/arch/sparc/ua2005.cc b/src/arch/sparc/ua2005.cc
index b0b9f59..3f33816 100644
--- a/src/arch/sparc/ua2005.cc
+++ b/src/arch/sparc/ua2005.cc
@@ -38,7 +38,6 @@
 #include "sim/system.hh"

 using namespace SparcISA;
-using namespace std;


 void
@@ -66,10 +65,10 @@
 }

 // These functions map register indices to names
-static inline string
+static inline std::string
 getMiscRegName(RegIndex index)
 {
-static string miscRegName[NumMiscRegs] =
+static std::string miscRegName[NumMiscRegs] =
 {/*"y", "ccr",*/ "asi", "tick", "fprs", "pcr", "pic",
  "gsr", "softint_set", "softint_clr", "softint", "tick_cmpr",
  "stick", "stick_cmpr",

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39560
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: I4a1019b5978b08b4999edfe5f65ef7eae06481c2
Gerrit-Change-Number: 39560
Gerrit-PatchSet: 7
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Daniel Carvalho 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: arch-mips: Stop "using namespace std"

2021-01-23 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/39559 )


Change subject: arch-mips: Stop "using namespace std"
..

arch-mips: Stop "using namespace std"

Change-Id: I0ad5ad71d8ba2d7c050d3f368341ce98d3f87a90
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39559
Reviewed-by: Daniel Carvalho 
Maintainer: Gabe Black 
Tested-by: kokoro 
---
M src/arch/mips/dsp.cc
M src/arch/mips/isa/formats/branch.isa
M src/arch/mips/isa/formats/dsp.isa
M src/arch/mips/isa/formats/int.isa
M src/arch/mips/isa/formats/util.isa
M src/arch/mips/process.cc
M src/arch/mips/remote_gdb.cc
M src/arch/mips/tlb.cc
M src/arch/mips/utility.cc
9 files changed, 8 insertions(+), 16 deletions(-)

Approvals:
  Daniel Carvalho: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/arch/mips/dsp.cc b/src/arch/mips/dsp.cc
index 9b0f098..73babf1 100644
--- a/src/arch/mips/dsp.cc
+++ b/src/arch/mips/dsp.cc
@@ -35,7 +35,6 @@
 #include "sim/serialize.hh"

 using namespace MipsISA;
-using namespace std;

 int32_t
 MipsISA::bitrev(int32_t value)
diff --git a/src/arch/mips/isa/formats/branch.isa  
b/src/arch/mips/isa/formats/branch.isa

index 42a0dea..09bab47 100644
--- a/src/arch/mips/isa/formats/branch.isa
+++ b/src/arch/mips/isa/formats/branch.isa
@@ -34,7 +34,6 @@
 output header {{

 #include 
-using namespace std;

 /**
  * Base class for instructions whose disassembly is not purely a
diff --git a/src/arch/mips/isa/formats/dsp.isa  
b/src/arch/mips/isa/formats/dsp.isa

index 12af2d6..fc08956 100644
--- a/src/arch/mips/isa/formats/dsp.isa
+++ b/src/arch/mips/isa/formats/dsp.isa
@@ -32,7 +32,6 @@
 //
 output header {{
 #include 
-using namespace std;
 /**
  * Base class for integer operations.
  */
diff --git a/src/arch/mips/isa/formats/int.isa  
b/src/arch/mips/isa/formats/int.isa

index f47e728..35bbef6 100644
--- a/src/arch/mips/isa/formats/int.isa
+++ b/src/arch/mips/isa/formats/int.isa
@@ -32,7 +32,6 @@
 //
 output header {{
 #include 
-using namespace std;
 /**
  * Base class for integer operations.
  */
diff --git a/src/arch/mips/isa/formats/util.isa  
b/src/arch/mips/isa/formats/util.isa

index 39ece7a..3870955 100644
--- a/src/arch/mips/isa/formats/util.isa
+++ b/src/arch/mips/isa/formats/util.isa
@@ -80,7 +80,7 @@

 std::string inst2string(MachInst machInst)
 {
-string str = "";
+std::string str = "";
 uint32_t mask = 0x8000;

 for(int i=0; i < 32; i++) {
diff --git a/src/arch/mips/process.cc b/src/arch/mips/process.cc
index 44f4f32..e2f2bb9 100644
--- a/src/arch/mips/process.cc
+++ b/src/arch/mips/process.cc
@@ -42,7 +42,6 @@
 #include "sim/syscall_return.hh"
 #include "sim/system.hh"

-using namespace std;
 using namespace MipsISA;

 MipsProcess::MipsProcess(const ProcessParams ,
@@ -68,9 +67,9 @@
 // Set up region for mmaps.  Start it 1GB above the top of the heap.
 Addr mmap_end = brk_point + 0x4000L;

-memState = make_shared(this, brk_point, stack_base,
- max_stack_size,  
next_thread_stack_base,

- mmap_end);
+memState = std::make_shared(
+this, brk_point, stack_base, max_stack_size,
+next_thread_stack_base, mmap_end);
 }

 void
@@ -126,7 +125,7 @@
 int auxv_array_size = intSize * 2 * (auxv.size() + 1);

 int arg_data_size = 0;
-for (vector::size_type i = 0; i < argv.size(); ++i) {
+for (std::vector::size_type i = 0; i < argv.size(); ++i) {
 arg_data_size += argv[i].size() + 1;
 }

@@ -134,7 +133,7 @@
 int aux_data_size = numRandomBytes;

 int env_data_size = 0;
-for (vector::size_type i = 0; i < envp.size(); ++i) {
+for (std::vector::size_type i = 0; i < envp.size(); ++i) {
 env_data_size += envp[i].size() + 1;
 }

diff --git a/src/arch/mips/remote_gdb.cc b/src/arch/mips/remote_gdb.cc
index bd9a40f..9d71792 100644
--- a/src/arch/mips/remote_gdb.cc
+++ b/src/arch/mips/remote_gdb.cc
@@ -143,7 +143,6 @@
 #include "mem/page_table.hh"
 #include "sim/full_system.hh"

-using namespace std;
 using namespace MipsISA;

 RemoteGDB::RemoteGDB(System *_system, ThreadContext *tc, int _port)
diff --git a/src/arch/mips/tlb.cc b/src/arch/mips/tlb.cc
index 3ceb1ae..5373ba9 100644
--- a/src/arch/mips/tlb.cc
+++ b/src/arch/mips/tlb.cc
@@ -46,7 +46,6 @@
 #include "params/MipsTLB.hh"
 #include "sim/process.hh"

-using namespace std;
 using namespace MipsISA;

 ///
@@ -169,7 +168,7 @@
 }
 table[Index]=pte;
 // Update fast lookup table
-lookupTable.insert(make_pair(table[Index].VPN, Index));
+lookupTable.insert(std::make_pair(table[Index].VPN, Index));
 }
 }

@@ -211,7 +210,7 @@
 ScopedCheckpointSection sec(cp, 

[gem5-dev] Change in gem5/gem5[develop]: arch-x86: Stop "using namespace std"

2021-01-23 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/39557 )


Change subject: arch-x86: Stop "using namespace std"
..

arch-x86: Stop "using namespace std"

Change-Id: I9763177bbd54abc97b99bd54a20a750e0adb5627
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39557
Reviewed-by: Daniel Carvalho 
Maintainer: Gabe Black 
Tested-by: kokoro 
---
M src/arch/x86/bios/acpi.cc
M src/arch/x86/bios/e820.cc
M src/arch/x86/bios/intelmp.cc
M src/arch/x86/bios/smbios.cc
M src/arch/x86/isa/includes.isa
M src/arch/x86/process.cc
M src/arch/x86/remote_gdb.cc
M src/arch/x86/types.cc
8 files changed, 16 insertions(+), 26 deletions(-)

Approvals:
  Daniel Carvalho: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/arch/x86/bios/acpi.cc b/src/arch/x86/bios/acpi.cc
index 5ecb09b..20cf088 100644
--- a/src/arch/x86/bios/acpi.cc
+++ b/src/arch/x86/bios/acpi.cc
@@ -45,8 +45,6 @@
 #include "sim/byteswap.hh"
 #include "sim/sim_object.hh"

-using namespace std;
-
 const char X86ISA::ACPI::RSDP::signature[] = "RSD PTR ";

 X86ISA::ACPI::RSDP::RSDP(const Params ) : SimObject(p), oemID(p.oem_id),
diff --git a/src/arch/x86/bios/e820.cc b/src/arch/x86/bios/e820.cc
index a377703..a22f66c 100644
--- a/src/arch/x86/bios/e820.cc
+++ b/src/arch/x86/bios/e820.cc
@@ -41,7 +41,6 @@
 #include "mem/port_proxy.hh"
 #include "sim/byteswap.hh"

-using namespace std;
 using namespace X86ISA;

 template
diff --git a/src/arch/x86/bios/intelmp.cc b/src/arch/x86/bios/intelmp.cc
index 6378c48..ba9ba20 100644
--- a/src/arch/x86/bios/intelmp.cc
+++ b/src/arch/x86/bios/intelmp.cc
@@ -63,8 +63,6 @@
 #include "params/X86IntelMPBusHierarchy.hh"
 #include "params/X86IntelMPCompatAddrSpaceMod.hh"

-using namespace std;
-
 const char X86ISA::IntelMP::FloatingPointer::signature[] = "_MP_";

 template
@@ -83,7 +81,7 @@
 }

 uint8_t
-writeOutString(PortProxy& proxy, Addr addr, string str, int length)
+writeOutString(PortProxy& proxy, Addr addr, std::string str, int length)
 {
 char cleanedString[length + 1];
 cleanedString[length] = 0;
@@ -210,7 +208,7 @@
 proxy.writeBlob(addr + 43, , 1);
 checkSum += reserved;

-vector::iterator baseEnt;
+std::vector::iterator baseEnt;
 uint16_t offset = 44;
 for (baseEnt = baseEntries.begin();
 baseEnt != baseEntries.end(); baseEnt++) {
@@ -220,7 +218,7 @@
 // We've found the end of the base table this point.
 checkSum += writeOutField(proxy, addr + 4, offset);

-vector::iterator extEnt;
+std::vector::iterator extEnt;
 uint16_t extOffset = 0;
 uint8_t extCheckSum = 0;
 for (extEnt = extEntries.begin();
diff --git a/src/arch/x86/bios/smbios.cc b/src/arch/x86/bios/smbios.cc
index afe0f15..ead87cf 100644
--- a/src/arch/x86/bios/smbios.cc
+++ b/src/arch/x86/bios/smbios.cc
@@ -48,8 +48,6 @@
 #include "params/X86SMBiosSMBiosTable.hh"
 #include "sim/byteswap.hh"

-using namespace std;
-
 const char X86ISA::SMBios::SMBiosTable::SMBiosHeader::anchorString[]  
= "_SM_";

 const uint8_t X86ISA::SMBios::SMBiosTable::
 SMBiosHeader::formattedArea[] = {0,0,0,0,0};
@@ -128,7 +126,7 @@
 }

 int
-X86ISA::SMBios::SMBiosStructure::addString(const string _string)
+X86ISA::SMBios::SMBiosStructure::addString(const std::string _string)
 {
 stringFields = true;
 // If a string is empty, treat it as not existing. The index for empty
@@ -139,7 +137,7 @@
 return strings.size();
 }

-string
+std::string
 X86ISA::SMBios::SMBiosStructure::readString(int n)
 {
 assert(n > 0 && n <= strings.size());
diff --git a/src/arch/x86/isa/includes.isa b/src/arch/x86/isa/includes.isa
index d2098c3..3bd7872 100644
--- a/src/arch/x86/isa/includes.isa
+++ b/src/arch/x86/isa/includes.isa
@@ -126,6 +126,5 @@
 #include "sim/sim_exit.hh"

 using namespace X86ISA;
-using namespace std;
 }};

diff --git a/src/arch/x86/process.cc b/src/arch/x86/process.cc
index 03e8641..925c836 100644
--- a/src/arch/x86/process.cc
+++ b/src/arch/x86/process.cc
@@ -65,7 +65,6 @@
 #include "sim/syscall_return.hh"
 #include "sim/system.hh"

-using namespace std;
 using namespace X86ISA;

 template class MultiLevelPageTable,
@@ -112,9 +111,9 @@
 Addr next_thread_stack_base = stack_base - max_stack_size;
 Addr mmap_end = 0x77FFF000ULL;

-memState = make_shared(this, brk_point, stack_base,
- max_stack_size,  
next_thread_stack_base,

- mmap_end);
+memState = std::make_shared(
+this, brk_point, stack_base, max_stack_size,
+next_thread_stack_base, mmap_end);
 }


@@ -139,9 +138,9 @@
 Addr next_thread_stack_base = stack_base - max_stack_size;
 Addr mmap_end = 0xB7FFF000ULL;

-memState = make_shared(this, brk_point, stack_base,
- max_stack_size,  

[gem5-dev] Change in gem5/gem5[develop]: arch-arm: Fix Compare and Swap Pair instructions

2021-01-23 Thread Giacomo Travaglini (Gerrit) via gem5-dev
Giacomo Travaglini has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/39456 )


Change subject: arch-arm: Fix Compare and Swap Pair instructions
..

arch-arm: Fix Compare and Swap Pair instructions

Those instructions were broken after:

https://gem5-review.googlesource.com/c/public/gem5/+/38381/4

Which is effectively replacing the generic StaticInst src and dest
reg array with an instruction specific one.
The size of the array is evaluated by the ISA parser, which is
counting the operands when parsing the isa code.
Alas, Compare and Swap Pair instructions were augmenting the number
of destination and source registers in the C++ world, which is
invisible to the parser. This lead to an out of bounds access
of the arrays.

This patch is fixing this behaviour by defining XResult2, which
is the second compare/result register for a paired CAS

Change-Id: Ie35c26256f42459805e007847896ac58b178fd42
Signed-off-by: Giacomo Travaglini 
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39456
Reviewed-by: Richard Cooper 
Reviewed-by: Gabe Black 
Tested-by: kokoro 
---
M src/arch/arm/insts/mem64.cc
M src/arch/arm/insts/mem64.hh
M src/arch/arm/isa/insts/amo64.isa
M src/arch/arm/isa/operands.isa
M src/arch/arm/isa/templates/mem64.isa
5 files changed, 57 insertions(+), 76 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved
  Richard Cooper: Looks good to me, but someone else must approve
  Giacomo Travaglini: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/arch/arm/insts/mem64.cc b/src/arch/arm/insts/mem64.cc
index a12c330..ed159be 100644
--- a/src/arch/arm/insts/mem64.cc
+++ b/src/arch/arm/insts/mem64.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2013,2018 ARM Limited
+ * Copyright (c) 2011-2013,2018, 2021 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
@@ -200,4 +200,24 @@
 ccprintf(ss, ", #%d", pc + imm);
 return ss.str();
 }
+
+std::string
+MemoryAtomicPair64::generateDisassembly(
+Addr pc, const Loader::SymbolTable *symtab) const
+{
+std::stringstream ss;
+printMnemonic(ss, "", false);
+printIntReg(ss, result);
+ccprintf(ss, ", ");
+printIntReg(ss, result2);
+ccprintf(ss, ", ");
+printIntReg(ss, dest);
+ccprintf(ss, ", ");
+printIntReg(ss, dest2);
+ccprintf(ss, ", [");
+printIntReg(ss, base);
+ccprintf(ss, "]");
+return ss.str();
+}
+
 }
diff --git a/src/arch/arm/insts/mem64.hh b/src/arch/arm/insts/mem64.hh
index 412efb0..b602d54 100644
--- a/src/arch/arm/insts/mem64.hh
+++ b/src/arch/arm/insts/mem64.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2013,2017-2019 ARM Limited
+ * Copyright (c) 2011-2013,2017-2019, 2021 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
@@ -263,6 +263,26 @@
 Addr pc, const Loader::SymbolTable *symtab) const override;
 };

+class MemoryAtomicPair64 : public Memory64
+{
+  protected:
+IntRegIndex dest2;
+IntRegIndex result;
+IntRegIndex result2;
+
+MemoryAtomicPair64(const char *mnem, ExtMachInst _machInst,
+   OpClass __opClass, IntRegIndex _dest, IntRegIndex  
_base,

+   IntRegIndex _result)
+: Memory64(mnem, _machInst, __opClass, _dest, _base),
+  dest2((IntRegIndex)(_dest + (IntRegIndex)(1))),
+  result(_result),
+  result2((IntRegIndex)(_result + (IntRegIndex)(1)))
+{}
+
+std::string generateDisassembly(
+Addr pc, const Loader::SymbolTable *symtab) const override;
+};
+
 }

 #endif //__ARCH_ARM_INSTS_MEM_HH__
diff --git a/src/arch/arm/isa/insts/amo64.isa  
b/src/arch/arm/isa/insts/amo64.isa

index 51e1f38..27ee9b5 100644
--- a/src/arch/arm/isa/insts/amo64.isa
+++ b/src/arch/arm/isa/insts/amo64.isa
@@ -1,5 +1,6 @@
 // -*- mode:c++ -*-

+// Copyright (c) 2021 ARM Limited
 // Copyright (c) 2018 Metempsy Technology Consulting
 // All rights reserved
 //
@@ -259,8 +260,8 @@
flavor="release").emit(OP_DICT['CAS'])

 class CasPair64(AtomicInst64):
-decConstBase = 'AmoPairOp'
-base = 'ArmISA::MemoryEx64'
+decConstBase = 'AmoOp'
+base = 'ArmISA::MemoryAtomicPair64'
 writeback = True
 post = False
 execBase = 'AmoOp'
@@ -279,8 +280,8 @@
   isBigEndian64(xc->tcBase()));
 uint64_t result2 = cSwap(Mem%(suffix)s[1],
isBigEndian64(xc->tcBase()));
-xc->setIntRegOperand(this, r2_dst, (result2)
-& mask(aarch64 ? 64 :  
32));

+
+XResult2 = result2;
 '''
 elif self.size == 4:
 self.res = 

[gem5-dev] Change in gem5/gem5[develop]: dev: Stop "using namespace std"

2021-01-23 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/39538 )


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

dev: Stop "using namespace std"

Change-Id: I317df9b566936445c3a02c28ed37146a16610454
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39538
Tested-by: kokoro 
Maintainer: Gabe Black 
Reviewed-by: Daniel Carvalho 
Reviewed-by: Andreas Sandberg 
---
M src/dev/baddev.cc
M src/dev/intel_8254_timer.cc
M src/dev/isa_fake.cc
M src/dev/mc146818.cc
M src/dev/mips/malta.cc
M src/dev/mips/malta_cchip.cc
M src/dev/mips/malta_io.cc
M src/dev/net/dist_etherlink.cc
M src/dev/net/dist_iface.cc
M src/dev/net/etherbus.cc
M src/dev/net/etherlink.cc
M src/dev/net/etherpkt.cc
M src/dev/net/etherswitch.cc
M src/dev/net/ethertap.cc
M src/dev/net/pktfifo.cc
M src/dev/net/sinic.cc
M src/dev/net/tcp_iface.cc
M src/dev/platform.cc
M src/dev/serial/terminal.cc
M src/dev/serial/uart8250.cc
M src/dev/sparc/dtod.cc
M src/dev/sparc/t1000.cc
M src/dev/storage/disk_image.cc
M src/dev/storage/simple_disk.cc
24 files changed, 67 insertions(+), 113 deletions(-)

Approvals:
  Andreas Sandberg: Looks good to me, approved
  Daniel Carvalho: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/dev/baddev.cc b/src/dev/baddev.cc
index 3a64212..f291459 100644
--- a/src/dev/baddev.cc
+++ b/src/dev/baddev.cc
@@ -38,8 +38,6 @@
 #include "params/BadDevice.hh"
 #include "sim/system.hh"

-using namespace std;
-
 BadDevice::BadDevice(const Params )
 : BasicPioDevice(p, 0x10), devname(p.devicename)
 {
diff --git a/src/dev/intel_8254_timer.cc b/src/dev/intel_8254_timer.cc
index 7877c91..a2ba7a4 100644
--- a/src/dev/intel_8254_timer.cc
+++ b/src/dev/intel_8254_timer.cc
@@ -31,9 +31,7 @@
 #include "base/logging.hh"
 #include "debug/Intel8254Timer.hh"

-using namespace std;
-
-Intel8254Timer::Intel8254Timer(EventManager *em, const string ,
+Intel8254Timer::Intel8254Timer(EventManager *em, const std::string ,
 Counter *counter0, Counter *counter1, Counter *counter2) :
 EventManager(em), _name(name)
 {
@@ -42,7 +40,7 @@
 counter[2] = counter2;
 }

-Intel8254Timer::Intel8254Timer(EventManager *em, const string ) :
+Intel8254Timer::Intel8254Timer(EventManager *em, const std::string ) :
 EventManager(em), _name(name)
 {
 counter[0] = new Counter(this, name + ".counter0", 0);
@@ -68,7 +66,7 @@
 }

 void
-Intel8254Timer::serialize(const string , CheckpointOut ) const
+Intel8254Timer::serialize(const std::string , CheckpointOut ) const
 {
 // serialize the counters
 counter[0]->serialize(base + ".counter0", cp);
@@ -77,7 +75,7 @@
 }

 void
-Intel8254Timer::unserialize(const string , CheckpointIn )
+Intel8254Timer::unserialize(const std::string , CheckpointIn )
 {
 // unserialze the counters
 counter[0]->unserialize(base + ".counter0", cp);
@@ -94,7 +92,7 @@
 }

 Intel8254Timer::Counter::Counter(Intel8254Timer *p,
-const string , unsigned int _num)
+const std::string , unsigned int _num)
 : _name(name), num(_num), event(this), running(false),
   initial_count(0), latched_count(0), period(0), mode(0),
   output_high(false), latch_on(false), read_byte(LSB),
@@ -225,7 +223,8 @@
 }

 void
-Intel8254Timer::Counter::serialize(const string , CheckpointOut )  
const

+Intel8254Timer::Counter::serialize(
+const std::string , CheckpointOut ) const
 {
 paramOut(cp, base + ".initial_count", initial_count);
 paramOut(cp, base + ".latched_count", latched_count);
@@ -243,7 +242,7 @@
 }

 void
-Intel8254Timer::Counter::unserialize(const string , CheckpointIn )
+Intel8254Timer::Counter::unserialize(const std::string , CheckpointIn  
)

 {
 paramIn(cp, base + ".initial_count", initial_count);
 paramIn(cp, base + ".latched_count", latched_count);
diff --git a/src/dev/isa_fake.cc b/src/dev/isa_fake.cc
index b441120..0132ddc 100644
--- a/src/dev/isa_fake.cc
+++ b/src/dev/isa_fake.cc
@@ -38,8 +38,6 @@
 #include "mem/packet_access.hh"
 #include "sim/system.hh"

-using namespace std;
-
 IsaFake::IsaFake(const Params )
 : BasicPioDevice(p, p.ret_bad_addr ? 0 : p.pio_size)
 {
diff --git a/src/dev/mc146818.cc b/src/dev/mc146818.cc
index 3ea1d0d..5e76a23 100644
--- a/src/dev/mc146818.cc
+++ b/src/dev/mc146818.cc
@@ -39,8 +39,6 @@
 #include "debug/MC146818.hh"
 #include "dev/rtcreg.h"

-using namespace std;
-
 static uint8_t
 bcdize(uint8_t val)
 {
@@ -87,8 +85,8 @@
 }
 }

-MC146818::MC146818(EventManager *em, const string , const struct tm time,
-   bool bcd, Tick frequency)
+MC146818::MC146818(EventManager *em, const std::string ,
+const struct tm time, bool bcd, Tick frequency)
 : EventManager(em), _name(n), event(this, frequency), tickEvent(this)
 {
 memset(clock_data, 0, sizeof(clock_data));
@@ -262,7 +260,7 @@
 }

 void
-MC146818::serialize(const string , 

[gem5-dev] Change in gem5/gem5[develop]: sim: Stop "using namespace std"

2021-01-23 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/39537 )


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

sim: Stop "using namespace std"

Change-Id: Ic641cb82a069ccb2b185d74a3b49a96b27111035
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39537
Reviewed-by: Gabe Black 
Maintainer: Gabe Black 
Tested-by: kokoro 
---
M src/sim/core.cc
M src/sim/debug.cc
M src/sim/eventq.cc
M src/sim/init.cc
M src/sim/init_signals.cc
M src/sim/process.cc
M src/sim/pseudo_inst.cc
M src/sim/serialize.cc
M src/sim/sim_events.cc
M src/sim/sim_object.cc
M src/sim/stat_control.cc
M src/sim/syscall_emul.cc
M src/sim/syscall_emul.hh
M src/sim/system.cc
14 files changed, 70 insertions(+), 88 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/sim/core.cc b/src/sim/core.cc
index ace699a..928e6c8 100644
--- a/src/sim/core.cc
+++ b/src/sim/core.cc
@@ -39,8 +39,6 @@
 #include "base/output.hh"
 #include "sim/eventq.hh"

-using namespace std;
-
 namespace Gem5Internal
 {

@@ -125,7 +123,7 @@
 Tick getClockFrequency() { return _ticksPerSecond; }

 void
-setOutputDir(const string )
+setOutputDir(const std::string )
 {
 simout.setDirectory(dir);
 }
@@ -159,6 +157,6 @@
 exitCallbacks().process();
 exitCallbacks().clear();

-cout.flush();
+std::cout.flush();
 }

diff --git a/src/sim/debug.cc b/src/sim/debug.cc
index b2b3d45..4144caf 100644
--- a/src/sim/debug.cc
+++ b/src/sim/debug.cc
@@ -40,8 +40,6 @@
 #include "sim/sim_exit.hh"
 #include "sim/system.hh"

-using namespace std;
-
 //
 // Debug event: place a breakpoint on the process function and
 // schedule the event to break at a particular cycle
diff --git a/src/sim/eventq.cc b/src/sim/eventq.cc
index adce51e..3e99683 100644
--- a/src/sim/eventq.cc
+++ b/src/sim/eventq.cc
@@ -43,8 +43,6 @@
 #include "debug/Checkpoint.hh"
 #include "sim/core.hh"

-using namespace std;
-
 Tick simQuantum = 0;

 //
@@ -54,7 +52,7 @@
 // cycle, before the pipeline simulation is performed.
 //
 uint32_t numMainEventQueues = 0;
-vector mainEventQueue;
+std::vector mainEventQueue;
 __thread EventQueue *_curEventQueue = NULL;
 bool inParallelMode = false;

@@ -419,7 +417,7 @@
 }
 }

-EventQueue::EventQueue(const string )
+EventQueue::EventQueue(const std::string )
 : objName(n), head(NULL), _curTick(0)
 {
 }
diff --git a/src/sim/init.cc b/src/sim/init.cc
index 73d4dbd..6abb0e1 100644
--- a/src/sim/init.cc
+++ b/src/sim/init.cc
@@ -65,7 +65,6 @@

 #endif

-using namespace std;
 namespace py = pybind11;

 // The python library is totally messed up with respect to constness,
@@ -81,16 +80,16 @@
 {
 // if we've added the importer keep track of it because we need it
 // to bootstrap.
-if (string(modpath) == string("importer"))
+if (std::string(modpath) == std::string("importer"))
 importer = this;
 else
 getList().push_back(this);
 }

-list &
+std::list &
 EmbeddedPython::getList()
 {
-static list the_list;
+static std::list the_list;
 return the_list;
 }

@@ -142,8 +141,8 @@

 // Load the rest of the embedded python files into the embedded
 // python importer
-list::iterator i = getList().begin();
-list::iterator end = getList().end();
+std::list::iterator i = getList().begin();
+std::list::iterator end = getList().end();
 for (; i != end; ++i)
 if (!(*i)->addModule())
 return 1;
diff --git a/src/sim/init_signals.cc b/src/sim/init_signals.cc
index 305f0cf..db82682 100644
--- a/src/sim/init_signals.cc
+++ b/src/sim/init_signals.cc
@@ -61,8 +61,6 @@
 #include "sim/core.hh"
 #include "sim/eventq.hh"

-using namespace std;
-
 // Use an separate stack for fatal signal handlers
 static uint8_t fatalSigStack[2 * SIGSTKSZ];

@@ -146,7 +144,8 @@
 {
 const EventQueue *const eq(curEventQueue());
 if (eq) {
-ccprintf(cerr, "Program aborted at tick %llu\n", eq->getCurTick());
+ccprintf(std::cerr, "Program aborted at tick %llu\n",
+eq->getCurTick());
 } else {
 STATIC_ERR("Program aborted\n\n");
 }
diff --git a/src/sim/process.cc b/src/sim/process.cc
index 409b48a..1ae8d40 100644
--- a/src/sim/process.cc
+++ b/src/sim/process.cc
@@ -67,7 +67,6 @@
 #include "sim/syscall_desc.hh"
 #include "sim/system.hh"

-using namespace std;
 using namespace TheISA;

 namespace
@@ -127,7 +126,8 @@
   _gid(params.gid), _egid(params.egid),
   _pid(params.pid), _ppid(params.ppid),
   _pgid(params.pgid), drivers(params.drivers),
-  fds(make_shared(params.input, params.output,  
params.errout)),

+  fds(std::make_shared(
+  params.input, params.output, params.errout)),
   childClearTID(0),
   ADD_STAT(numSyscalls, "Number of system calls")
 {
@@ -189,7 +189,7 @@
  * Duplicate the process memory address 

[gem5-dev] Change in gem5/gem5[develop]: base: Stop "using namespace std".

2021-01-23 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/39536 )


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

base: Stop "using namespace std".

As the std namespace expands, it becomes more and more likely that
blanketly importing all its symbols will cause a collision. Also, when
it was imported, the std:: was used or left off arbitrarily, sometimes
inconsistently even in the same function signature.

Change-Id: Ie30cbab154b00c60433908a206c229230d2b109f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39536
Tested-by: kokoro 
Reviewed-by: Gabe Black 
Maintainer: Gabe Black 
---
M src/base/bitunion.test.cc
M src/base/fiber.cc
M src/base/hostinfo.cc
M src/base/inet.cc
M src/base/inifile.cc
M src/base/inifile.test.cc
M src/base/loader/symtab.cc
M src/base/match.cc
M src/base/output.cc
M src/base/pollevent.cc
M src/base/refcnt.test.cc
M src/base/remote_gdb.cc
M src/base/socket.cc
M src/base/statistics.cc
M src/base/stats/text.cc
M src/base/str.cc
M src/base/time.cc
M src/base/vnc/vncinput.cc
M src/base/vnc/vncserver.cc
19 files changed, 183 insertions(+), 216 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/base/bitunion.test.cc b/src/base/bitunion.test.cc
index 77897f5..594193d 100644
--- a/src/base/bitunion.test.cc
+++ b/src/base/bitunion.test.cc
@@ -34,8 +34,6 @@
 #include "base/bitunion.hh"
 #include "base/cprintf.hh"

-using namespace std;
-
 namespace {

 BitUnion64(SixtyFour)
diff --git a/src/base/fiber.cc b/src/base/fiber.cc
index fe1bad0..e414bd2 100644
--- a/src/base/fiber.cc
+++ b/src/base/fiber.cc
@@ -48,8 +48,6 @@

 #include "base/logging.hh"

-using namespace std;
-
 namespace
 {

diff --git a/src/base/hostinfo.cc b/src/base/hostinfo.cc
index be3d46f..e835a10 100644
--- a/src/base/hostinfo.cc
+++ b/src/base/hostinfo.cc
@@ -49,9 +49,7 @@
 #include "base/str.hh"
 #include "base/types.hh"

-using namespace std;
-
-string
+std::string
 __get_hostname()
 {
 char host[256];
@@ -60,10 +58,10 @@
 return host;
 }

-string &
+std::string &
 hostname()
 {
-static string hostname = __get_hostname();
+static std::string hostname = __get_hostname();
 return hostname;
 }

diff --git a/src/base/inet.cc b/src/base/inet.cc
index 6be4e26..7ae36c3 100644
--- a/src/base/inet.cc
+++ b/src/base/inet.cc
@@ -50,12 +50,11 @@
 #include "base/logging.hh"
 #include "base/types.hh"

-using namespace std;
 namespace Net {

 EthAddr::EthAddr()
 {
-memset(data, 0, ETH_ADDR_LEN);
+std::memset(data, 0, ETH_ADDR_LEN);
 }

 EthAddr::EthAddr(const uint8_t ea[ETH_ADDR_LEN])
@@ -97,13 +96,13 @@
 int bytes[ETH_ADDR_LEN == 6 ? ETH_ADDR_LEN : -1];
 if (sscanf(addr.c_str(), "%x:%x:%x:%x:%x:%x", [0], [1],
[2], [3], [4], [5]) !=  
ETH_ADDR_LEN) {

-memset(data, 0xff, ETH_ADDR_LEN);
+std::memset(data, 0xff, ETH_ADDR_LEN);
 return;
 }

 for (int i = 0; i < ETH_ADDR_LEN; ++i) {
 if (bytes[i] & ~0xff) {
-memset(data, 0xff, ETH_ADDR_LEN);
+std::memset(data, 0xff, ETH_ADDR_LEN);
 return;
 }

@@ -111,10 +110,10 @@
 }
 }

-string
+std::string
 EthAddr::string() const
 {
-stringstream stream;
+std::stringstream stream;
 stream << *this;
 return stream.str();
 }
@@ -122,21 +121,21 @@
 bool
 operator==(const EthAddr , const EthAddr )
 {
-return !memcmp(left.bytes(), right.bytes(), ETH_ADDR_LEN);
+return !std::memcmp(left.bytes(), right.bytes(), ETH_ADDR_LEN);
 }

-ostream &
-operator<<(ostream , const EthAddr )
+std::ostream &
+operator<<(std::ostream , const EthAddr )
 {
 const uint8_t *a = ea.addr();
 ccprintf(stream, "%x:%x:%x:%x:%x:%x", a[0], a[1], a[2], a[3], a[4],  
a[5]);

 return stream;
 }

-string
+std::string
 IpAddress::string() const
 {
-stringstream stream;
+std::stringstream stream;
 stream << *this;
 return stream.str();
 }
@@ -147,8 +146,8 @@
 return left.ip() == right.ip();
 }

-ostream &
-operator<<(ostream , const IpAddress )
+std::ostream &
+operator<<(std::ostream , const IpAddress )
 {
 uint32_t ip = ia.ip();
 ccprintf(stream, "%x.%x.%x.%x",
@@ -157,10 +156,10 @@
 return stream;
 }

-string
+std::string
 IpNetmask::string() const
 {
-stringstream stream;
+std::stringstream stream;
 stream << *this;
 return stream.str();
 }
@@ -172,17 +171,17 @@
 (left.netmask() == right.netmask());
 }

-ostream &
-operator<<(ostream , const IpNetmask )
+std::ostream &
+operator<<(std::ostream , const IpNetmask )
 {
 ccprintf(stream, "%s/%d", (const IpAddress &)in, in.netmask());
 return stream;
 }

-string
+std::string
 IpWithPort::string() const
 {
-stringstream stream;
+std::stringstream stream;
 stream << *this;
 return stream.str();
 }
@@ -193,8 +192,8 @@
 

[gem5-dev] Build failed in Jenkins: Nightly #196

2021-01-23 Thread jenkins-no-reply--- via gem5-dev
See 

Changes:

[cpmetz] base: Fix unsigned underflow mishandling.

[kyleroarty1716] gpu-compute: Simplify LGKM decrementing for Flat instructions

[Andreas.Sandberg] arch-arm, dev-arm: Remove Python 2 compatibility code

[Andreas.Sandberg] configs: Remove Python 2 compatibility code in Arm configs

[Andreas.Sandberg] configs: Weed out old port terminology in Arm examples

[ciro.santilli] sim,base: make checkpointMapIn warn if an unknown key is found


--
[...truncated 601.45 KB...]
[ RUN  ] MicroPCTest.IsNotRomMicroPCTest
[   OK ] MicroPCTest.IsNotRomMicroPCTest (0 ms)
[--] 5 tests from MicroPCTest (0 ms total)

[--] 4 tests from TypesTest
[ RUN  ] TypesTest.FloatToBits32
[   OK ] TypesTest.FloatToBits32 (0 ms)
[ RUN  ] TypesTest.floatToBits64
[   OK ] TypesTest.floatToBits64 (0 ms)
[ RUN  ] TypesTest.floatsToBitsDoubleInput
[   OK ] TypesTest.floatsToBitsDoubleInput (0 ms)
[ RUN  ] TypesTest.floatsToBitsFloatInput
[   OK ] TypesTest.floatsToBitsFloatInput (0 ms)
[--] 4 tests from TypesTest (0 ms total)

[--] Global test environment tear-down
[==] 19 tests from 3 test suites ran. (0 ms total)
[  PASSED  ] 19 tests.
 [ CXX] NULL/sim/byteswap.test.cc -> .po
 [LINK]  -> NULL/base/trie.test.prof
build/NULL/base/trie.test.prof 
--gtest_output=xml:build/NULL/unittests.prof/base/trie.test.xml
Running main() from build/googletest/googletest/src/gtest_main.cc
[==] Running 7 tests from 1 test suite.
[--] Global test environment set-up.
[--] 7 tests from TrieTestData
[ RUN  ] TrieTestData.Empty
[   OK ] TrieTestData.Empty (0 ms)
[ RUN  ] TrieTestData.SingleEntry
[   OK ] TrieTestData.SingleEntry (0 ms)
[ RUN  ] TrieTestData.TwoOverlappingEntries
[   OK ] TrieTestData.TwoOverlappingEntries (0 ms)
[ RUN  ] TrieTestData.TwoOverlappingEntriesReversed
[   OK ] TrieTestData.TwoOverlappingEntriesReversed (0 ms)
[ RUN  ] TrieTestData.TwoIndependentEntries
[   OK ] TrieTestData.TwoIndependentEntries (0 ms)
[ RUN  ] TrieTestData.TwoEntries
[   OK ] TrieTestData.TwoEntries (0 ms)
[ RUN  ] TrieTestData.RemovingEntries
[   OK ] TrieTestData.RemovingEntries (0 ms)
[--] 7 tests from TrieTestData (5 ms total)

[--] Global test environment tear-down
[==] 7 tests from 1 test suite ran. (6 ms total)
[  PASSED  ] 7 tests.
 [ CXX] NULL/sim/guest_abi.test.cc -> .po
 [LINK]  -> NULL/base/uncontended_mutex.test.prof
build/NULL/base/uncontended_mutex.test.prof 
--gtest_output=xml:build/NULL/unittests.prof/base/uncontended_mutex.test.xml
Running main() from build/googletest/googletest/src/gtest_main.cc
[==] Running 2 tests from 1 test suite.
[--] Global test environment set-up.
[--] 2 tests from UncontendedMutex
[ RUN  ] UncontendedMutex.Lock
[   OK ] UncontendedMutex.Lock (221 ms)
[ RUN  ] UncontendedMutex.HeavyContention
[   OK ] UncontendedMutex.HeavyContention (285 ms)
[--] 2 tests from UncontendedMutex (507 ms total)

[--] Global test environment tear-down
[==] 2 tests from 1 test suite ran. (507 ms total)
[  PASSED  ] 2 tests.
 [ CXX] NULL/sim/proxy_ptr.test.cc -> .po
 [LINK]  -> NULL/base/str.test.prof
build/NULL/base/str.test.prof 
--gtest_output=xml:build/NULL/unittests.prof/base/str.test.xml
Running main() from build/googletest/googletest/src/gtest_main.cc
[==] Running 42 tests from 1 test suite.
[--] Global test environment set-up.
[--] 42 tests from StrTest
[ RUN  ] StrTest.EatLeadWhite
[   OK ] StrTest.EatLeadWhite (0 ms)
[ RUN  ] StrTest.EatLeadWhiteNoLeadingWhitespace
[   OK ] StrTest.EatLeadWhiteNoLeadingWhitespace (0 ms)
[ RUN  ] StrTest.EatEndWhite
[   OK ] StrTest.EatEndWhite (0 ms)
[ RUN  ] StrTest.EatEndWhiteNoTrailingWhitespace
[   OK ] StrTest.EatEndWhiteNoTrailingWhitespace (0 ms)
[ RUN  ] StrTest.EatWhite
[   OK ] StrTest.EatWhite (0 ms)
[ RUN  ] StrTest.EatWhiteNoWhitespace
[   OK ] StrTest.EatWhiteNoWhitespace (0 ms)
[ RUN  ] StrTest.ToLower
[   OK ] StrTest.ToLower (0 ms)
[ RUN  ] StrTest.SplitFirst
[   OK ] StrTest.SplitFirst (0 ms)
[ RUN  ] StrTest.SplitFirstNoChar
[   OK ] StrTest.SplitFirstNoChar (0 ms)
[ RUN  ] StrTest.SplitFirstOnFirstChar
[   OK ] StrTest.SplitFirstOnFirstChar (0 ms)
[ RUN  ] StrTest.SplitLast
[   OK ] StrTest.SplitLast (0 ms)
[ RUN  ] StrTest.SplitLastNoChar
[   OK ] StrTest.SplitLastNoChar (0 ms)
[ RUN  ] StrTest.SplitLastOnLastChar
[   OK ] StrTest.SplitLastOnLastChar (0 ms)
[ RUN  ] StrTest.TokenizeOnSpace
[   OK ] StrTest.TokenizeOnSpace (0 ms)
[ RUN  ] StrTest.TokenizeOnSpaceIgnFalse
[   OK ] StrTest.TokenizeOnSpaceIgnFalse (0 ms)
[ RUN  ]