From: Gabe Black Date: Thu, 21 Jan 2021 11:04:19 +0000 (-0800) Subject: arch-x86: Stop "using namespace std" X-Git-Tag: develop-gem5-snapshot~244 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=afc3dc5571f196967ba8998dfe7aeb759745be1e;p=gem5.git 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 --- diff --git a/src/arch/x86/bios/acpi.cc b/src/arch/x86/bios/acpi.cc index 5ecb09bd4..20cf08880 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 &p) : SimObject(p), oemID(p.oem_id), diff --git a/src/arch/x86/bios/e820.cc b/src/arch/x86/bios/e820.cc index a377703aa..a22f66c44 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 6378c48bb..ba9ba202a 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 @@ writeOutField(PortProxy& proxy, Addr addr, T val) } 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 @@ X86ISA::IntelMP::ConfigTable::writeOut(PortProxy& proxy, Addr addr) proxy.writeBlob(addr + 43, &reserved, 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 @@ X86ISA::IntelMP::ConfigTable::writeOut(PortProxy& proxy, Addr addr) // 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 afe0f152f..ead87cf52 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 @@ X86ISA::SMBios::SMBiosStructure::getStringLength() } int -X86ISA::SMBios::SMBiosStructure::addString(const string &new_string) +X86ISA::SMBios::SMBiosStructure::addString(const std::string &new_string) { stringFields = true; // If a string is empty, treat it as not existing. The index for empty @@ -139,7 +137,7 @@ X86ISA::SMBios::SMBiosStructure::addString(const string &new_string) 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 d2098c3e9..3bd7872b8 100644 --- a/src/arch/x86/isa/includes.isa +++ b/src/arch/x86/isa/includes.isa @@ -126,6 +126,5 @@ output exec {{ #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 03e86418c..925c83619 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 @@ X86_64Process::X86_64Process(const ProcessParams ¶ms, Addr next_thread_stack_base = stack_base - max_stack_size; Addr mmap_end = 0x7FFFF7FFF000ULL; - 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 @@ I386Process::I386Process(const ProcessParams ¶ms, 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, 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 @@ -714,7 +713,7 @@ X86Process::argsInit(int pageSize, std::vector> auxv = extraAuxvs; - string filename; + std::string filename; if (argv.size() < 1) filename = ""; else @@ -850,7 +849,7 @@ X86Process::argsInit(int pageSize, const int numRandomBytes = 16; int aux_data_size = numRandomBytes; - string platform = "x86_64"; + std::string platform = "x86_64"; aux_data_size += platform.size() + 1; int env_data_size = 0; diff --git a/src/arch/x86/remote_gdb.cc b/src/arch/x86/remote_gdb.cc index 2f38fd5f3..c2d622e2d 100644 --- a/src/arch/x86/remote_gdb.cc +++ b/src/arch/x86/remote_gdb.cc @@ -58,7 +58,6 @@ #include "mem/page_table.hh" #include "sim/full_system.hh" -using namespace std; using namespace X86ISA; RemoteGDB::RemoteGDB(System *_system, ThreadContext *c, int _port) : diff --git a/src/arch/x86/types.cc b/src/arch/x86/types.cc index 858846748..58066233a 100644 --- a/src/arch/x86/types.cc +++ b/src/arch/x86/types.cc @@ -31,11 +31,11 @@ #include "sim/serialize.hh" using namespace X86ISA; -using namespace std; template <> void -paramOut(CheckpointOut &cp, const string &name, ExtMachInst const &machInst) +paramOut(CheckpointOut &cp, const std::string &name, + ExtMachInst const &machInst) { // Prefixes paramOut(cp, name + ".legacy", (uint8_t)machInst.legacy); @@ -66,7 +66,7 @@ paramOut(CheckpointOut &cp, const string &name, ExtMachInst const &machInst) template <> void -paramIn(CheckpointIn &cp, const string &name, ExtMachInst &machInst) +paramIn(CheckpointIn &cp, const std::string &name, ExtMachInst &machInst) { uint8_t temp8; // Prefixes