dev: Stop "using namespace std"
authorGabe Black <gabe.black@gmail.com>
Thu, 21 Jan 2021 08:00:53 +0000 (00:00 -0800)
committerGabe Black <gabe.black@gmail.com>
Sat, 23 Jan 2021 12:09:51 +0000 (12:09 +0000)
Change-Id: I317df9b566936445c3a02c28ed37146a16610454
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39538
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
24 files changed:
src/dev/baddev.cc
src/dev/intel_8254_timer.cc
src/dev/isa_fake.cc
src/dev/mc146818.cc
src/dev/mips/malta.cc
src/dev/mips/malta_cchip.cc
src/dev/mips/malta_io.cc
src/dev/net/dist_etherlink.cc
src/dev/net/dist_iface.cc
src/dev/net/etherbus.cc
src/dev/net/etherlink.cc
src/dev/net/etherpkt.cc
src/dev/net/etherswitch.cc
src/dev/net/ethertap.cc
src/dev/net/pktfifo.cc
src/dev/net/sinic.cc
src/dev/net/tcp_iface.cc
src/dev/platform.cc
src/dev/serial/terminal.cc
src/dev/serial/uart8250.cc
src/dev/sparc/dtod.cc
src/dev/sparc/t1000.cc
src/dev/storage/disk_image.cc
src/dev/storage/simple_disk.cc

index 3a64212c0e4d032ec43b4f9b1b0fa90def75820a..f291459161b9815ed0cb514a5102e7d5477fbcf4 100644 (file)
@@ -38,8 +38,6 @@
 #include "params/BadDevice.hh"
 #include "sim/system.hh"
 
-using namespace std;
-
 BadDevice::BadDevice(const Params &p)
     : BasicPioDevice(p, 0x10), devname(p.devicename)
 {
index 7877c91f876105637a0d324fab361a05e2fa4469..a2ba7a450916d8b4a75c877cb5e0135152e6fecd 100644 (file)
@@ -31,9 +31,7 @@
 #include "base/logging.hh"
 #include "debug/Intel8254Timer.hh"
 
-using namespace std;
-
-Intel8254Timer::Intel8254Timer(EventManager *em, const string &name,
+Intel8254Timer::Intel8254Timer(EventManager *em, const std::string &name,
     Counter *counter0, Counter *counter1, Counter *counter2) :
     EventManager(em), _name(name)
 {
@@ -42,7 +40,7 @@ Intel8254Timer::Intel8254Timer(EventManager *em, const string &name,
     counter[2] = counter2;
 }
 
-Intel8254Timer::Intel8254Timer(EventManager *em, const string &name) :
+Intel8254Timer::Intel8254Timer(EventManager *em, const std::string &name) :
     EventManager(em), _name(name)
 {
     counter[0] = new Counter(this, name + ".counter0", 0);
@@ -68,7 +66,7 @@ Intel8254Timer::writeControl(const CtrlReg data)
 }
 
 void
-Intel8254Timer::serialize(const string &base, CheckpointOut &cp) const
+Intel8254Timer::serialize(const std::string &base, CheckpointOut &cp) const
 {
     // serialize the counters
     counter[0]->serialize(base + ".counter0", cp);
@@ -77,7 +75,7 @@ Intel8254Timer::serialize(const string &base, CheckpointOut &cp) const
 }
 
 void
-Intel8254Timer::unserialize(const string &base, CheckpointIn &cp)
+Intel8254Timer::unserialize(const std::string &base, CheckpointIn &cp)
 {
     // unserialze the counters
     counter[0]->unserialize(base + ".counter0", cp);
@@ -94,7 +92,7 @@ Intel8254Timer::startup()
 }
 
 Intel8254Timer::Counter::Counter(Intel8254Timer *p,
-        const string &name, unsigned int _num)
+        const std::string &name, 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 @@ Intel8254Timer::Counter::outputHigh()
 }
 
 void
-Intel8254Timer::Counter::serialize(const string &base, CheckpointOut &cp) const
+Intel8254Timer::Counter::serialize(
+        const std::string &base, CheckpointOut &cp) const
 {
     paramOut(cp, base + ".initial_count", initial_count);
     paramOut(cp, base + ".latched_count", latched_count);
@@ -243,7 +242,7 @@ Intel8254Timer::Counter::serialize(const string &base, CheckpointOut &cp) const
 }
 
 void
-Intel8254Timer::Counter::unserialize(const string &base, CheckpointIn &cp)
+Intel8254Timer::Counter::unserialize(const std::string &base, CheckpointIn &cp)
 {
     paramIn(cp, base + ".initial_count", initial_count);
     paramIn(cp, base + ".latched_count", latched_count);
index b441120e13ebeb05401292eb362247c3dc0e3af5..0132ddcac4e1f59cc15933bae78fadced5fd58f5 100644 (file)
@@ -38,8 +38,6 @@
 #include "mem/packet_access.hh"
 #include "sim/system.hh"
 
-using namespace std;
-
 IsaFake::IsaFake(const Params &p)
     : BasicPioDevice(p, p.ret_bad_addr ? 0 : p.pio_size)
 {
index 3ea1d0dd583fa81072732415f7aaf27255674254..5e76a231a92fcd2b163cd2d27385f9f861427caa 100644 (file)
@@ -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::setTime(const struct tm time)
     }
 }
 
-MC146818::MC146818(EventManager *em, const string &n, const struct tm time,
-                   bool bcd, Tick frequency)
+MC146818::MC146818(EventManager *em, const std::string &n,
+        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 @@ MC146818::tickClock()
 }
 
 void
-MC146818::serialize(const string &base, CheckpointOut &cp) const
+MC146818::serialize(const std::string &base, CheckpointOut &cp) const
 {
     uint8_t regA_serial(stat_regA);
     uint8_t regB_serial(stat_regB);
@@ -282,7 +280,7 @@ MC146818::serialize(const string &base, CheckpointOut &cp) const
 }
 
 void
-MC146818::unserialize(const string &base, CheckpointIn &cp)
+MC146818::unserialize(const std::string &base, CheckpointIn &cp)
 {
     uint8_t tmp8;
 
index 5438233951bbffc197b09b9d8d2b8ede79215a2c..f9a0f22914f89c524b16010c4e030b7c89125998 100644 (file)
@@ -43,8 +43,6 @@
 #include "params/Malta.hh"
 #include "sim/system.hh"
 
-using namespace std;
-
 Malta::Malta(const Params &p)
     : Platform(p), system(p.system)
 {
index 2948077f688091569ef631a01deb0d3cec357eac..711731b037f80c77efd3f3c3c1ec8ed8772d1e46 100644 (file)
@@ -48,8 +48,6 @@
 #include "params/MaltaCChip.hh"
 #include "sim/system.hh"
 
-using namespace std;
-
 MaltaCChip::MaltaCChip(const Params &p)
     : BasicPioDevice(p, 0xfffffff), malta(p.malta)
 {
index c14a980171800cbd513f0e5aad8ea8fd503a508f..d914d5fbdae7e5f01ed354f272e61c3cc8bd5731 100644 (file)
@@ -51,9 +51,7 @@
 #include "params/MaltaIO.hh"
 #include "sim/system.hh"
 
-using namespace std;
-
-MaltaIO::RTC::RTC(const string &name, const MaltaIOParams &p)
+MaltaIO::RTC::RTC(const std::string &name, const MaltaIOParams &p)
     : MC146818(p.malta, name, p.time, p.year_is_bcd, p.frequency),
       malta(p.malta)
 {
index f275630843c5e785735fc33bc9581f2c5b14c511..8cbf6ef6fed08b76eec0d30f782ec8feddddc376 100644 (file)
@@ -66,8 +66,6 @@
 #include "sim/serialize.hh"
 #include "sim/system.hh"
 
-using namespace std;
-
 DistEtherLink::DistEtherLink(const Params &p)
     : SimObject(p), linkDelay(p.delay)
 {
@@ -228,7 +226,7 @@ DistEtherLink::Link::unserialize(CheckpointIn &cp)
     bool packet_exists;
     UNSERIALIZE_SCALAR(packet_exists);
     if (packet_exists) {
-        packet = make_shared<EthPacketData>();
+        packet = std::make_shared<EthPacketData>();
         packet->unserialize("packet", cp);
     }
 
index 79742425e72982e6c2748dd9f5b0395276fae86e..7f8a4a0436f5cbe70e670f02f2cbe3009dab306f 100644 (file)
@@ -54,7 +54,6 @@
 #include "sim/sim_object.hh"
 #include "sim/system.hh"
 
-using namespace std;
 DistIface::Sync *DistIface::sync = nullptr;
 System *DistIface::sys = nullptr;
 DistIface::SyncEvent *DistIface::syncEvent = nullptr;
index 28c9f8d96bf019ce895803b4e4d67ec5c9883775..bc9379e7fc30cbd36bd4217a3dde20e193833692 100644 (file)
@@ -46,8 +46,6 @@
 #include "params/EtherBus.hh"
 #include "sim/core.hh"
 
-using namespace std;
-
 EtherBus::EtherBus(const Params &p)
     : SimObject(p), ticksPerByte(p.speed), loopback(p.loopback),
       event([this]{ txDone(); }, "ethernet bus completion"),
index eff38e6d8a680e2aec37f3e117d46d531c7a884a..3c9bfea036b531615542d132ee6811f82ad3d2e8 100644 (file)
@@ -63,8 +63,6 @@
 #include "sim/serialize.hh"
 #include "sim/system.hh"
 
-using namespace std;
-
 EtherLink::EtherLink(const Params &p)
     : SimObject(p)
 {
@@ -98,14 +96,14 @@ EtherLink::getPort(const std::string &if_name, PortID idx)
 }
 
 
-EtherLink::Interface::Interface(const string &name, Link *tx, Link *rx)
+EtherLink::Interface::Interface(const std::string &name, Link *tx, Link *rx)
     : EtherInt(name), txlink(tx)
 {
     tx->setTxInt(this);
     rx->setRxInt(this);
 }
 
-EtherLink::Link::Link(const string &name, EtherLink *p, int num,
+EtherLink::Link::Link(const std::string &name, EtherLink *p, int num,
                       double rate, Tick delay, Tick delay_var, EtherDump *d)
     : objName(name), parent(p), number(num), txint(NULL), rxint(NULL),
       ticksPerByte(rate), linkDelay(delay), delayVar(delay_var), dump(d),
@@ -198,7 +196,7 @@ EtherLink::Link::transmit(EthPacketPtr pkt)
 }
 
 void
-EtherLink::Link::serialize(const string &base, CheckpointOut &cp) const
+EtherLink::Link::serialize(const std::string &base, CheckpointOut &cp) const
 {
     bool packet_exists = packet != nullptr;
     paramOut(cp, base + ".packet_exists", packet_exists);
@@ -224,12 +222,12 @@ EtherLink::Link::serialize(const string &base, CheckpointOut &cp) const
 }
 
 void
-EtherLink::Link::unserialize(const string &base, CheckpointIn &cp)
+EtherLink::Link::unserialize(const std::string &base, CheckpointIn &cp)
 {
     bool packet_exists;
     paramIn(cp, base + ".packet_exists", packet_exists);
     if (packet_exists) {
-        packet = make_shared<EthPacketData>();
+        packet = std::make_shared<EthPacketData>();
         packet->unserialize(base + ".packet", cp);
     }
 
@@ -245,7 +243,7 @@ EtherLink::Link::unserialize(const string &base, CheckpointIn &cp)
     if (optParamIn(cp, base + ".tx_queue_size", tx_queue_size)) {
         for (size_t idx = 0; idx < tx_queue_size; ++idx) {
             Tick tick;
-            EthPacketPtr delayed_packet = make_shared<EthPacketData>();
+            EthPacketPtr delayed_packet = std::make_shared<EthPacketData>();
 
             paramIn(cp, csprintf("%s.txQueue[%i].tick", base, idx), tick);
             delayed_packet->unserialize(
index 7cd3275823307541b3168e3dc079b448b1c2c731..d64815c2b48d04dc86c64bc959990c14e16b4b1f 100644 (file)
 #include "base/logging.hh"
 #include "sim/serialize.hh"
 
-using namespace std;
-
 void
-EthPacketData::serialize(const string &base, CheckpointOut &cp) const
+EthPacketData::serialize(const std::string &base, CheckpointOut &cp) const
 {
     paramOut(cp, base + ".simLength", simLength);
     paramOut(cp, base + ".bufLength", bufLength);
@@ -46,7 +44,7 @@ EthPacketData::serialize(const string &base, CheckpointOut &cp) const
 }
 
 void
-EthPacketData::unserialize(const string &base, CheckpointIn &cp)
+EthPacketData::unserialize(const std::string &base, CheckpointIn &cp)
 {
     paramIn(cp, base + ".length", length);
     unsigned chkpt_buf_length;
index 22c684cd4eff4d17b75413ebbea178126335ec9a..b88d630a49f179e69a59f5e70c87cbc0fb5e1356 100644 (file)
@@ -37,8 +37,6 @@
 #include "debug/EthernetAll.hh"
 #include "sim/core.hh"
 
-using namespace std;
-
 EtherSwitch::EtherSwitch(const Params &p)
     : SimObject(p), ttl(p.time_to_live)
 {
@@ -308,7 +306,7 @@ EtherSwitch::Interface::PortFifoEntry::serialize(CheckpointOut &cp) const
 void
 EtherSwitch::Interface::PortFifoEntry::unserialize(CheckpointIn &cp)
 {
-    packet = make_shared<EthPacketData>(16384);
+    packet = std::make_shared<EthPacketData>(16384);
     packet->unserialize("packet", cp);
     UNSERIALIZE_SCALAR(recvTick);
     UNSERIALIZE_SCALAR(srcId);
index ec67f471c350e80a661c5d886cf1114da73fb9b0..1ac9b663c658a6abea117cd36e549ab1bdfcc42e 100644 (file)
@@ -67,8 +67,6 @@
 #include "dev/net/etherint.hh"
 #include "dev/net/etherpkt.hh"
 
-using namespace std;
-
 class TapEvent : public PollEvent
 {
   protected:
@@ -185,7 +183,7 @@ void
 EtherTapBase::sendSimulated(void *data, size_t len)
 {
     EthPacketPtr packet;
-    packet = make_shared<EthPacketData>(len);
+    packet = std::make_shared<EthPacketData>(len);
     packet->length = len;
     packet->simLength = len;
     memcpy(packet->data, data, len);
@@ -261,7 +259,7 @@ TapListener::listen()
         port++;
     }
 
-    ccprintf(cerr, "Listening for tap connection on port %d\n", port);
+    ccprintf(std::cerr, "Listening for tap connection on port %d\n", port);
     event = new Event(this, listener.getfd(), POLLIN|POLLERR);
     pollQueue.schedule(event);
 }
index 005f3033db6939dc38bafcb7644bbe03e9d5f322..bf929331b7be81d863541d27058b1ac8e5585dd9 100644 (file)
@@ -30,8 +30,6 @@
 
 #include "base/logging.hh"
 
-using namespace std;
-
 bool
 PacketFifo::copyout(void *dest, unsigned offset, unsigned len)
 {
@@ -51,7 +49,7 @@ PacketFifo::copyout(void *dest, unsigned offset, unsigned len)
         if (i == end)
             panic("invalid fifo");
 
-        unsigned size = min(pkt->length - offset, len);
+        unsigned size = std::min(pkt->length - offset, len);
         memcpy(data, pkt->data, size);
         offset = 0;
         len -= size;
@@ -64,7 +62,7 @@ PacketFifo::copyout(void *dest, unsigned offset, unsigned len)
 
 
 void
-PacketFifoEntry::serialize(const string &base, CheckpointOut &cp) const
+PacketFifoEntry::serialize(const std::string &base, CheckpointOut &cp) const
 {
     packet->serialize(base + ".packet", cp);
     paramOut(cp, base + ".slack", slack);
@@ -73,9 +71,9 @@ PacketFifoEntry::serialize(const string &base, CheckpointOut &cp) const
 }
 
 void
-PacketFifoEntry::unserialize(const string &base, CheckpointIn &cp)
+PacketFifoEntry::unserialize(const std::string &base, CheckpointIn &cp)
 {
-    packet = make_shared<EthPacketData>();
+    packet = std::make_shared<EthPacketData>();
     packet->unserialize(base + ".packet", cp);
     paramIn(cp, base + ".slack", slack);
     paramIn(cp, base + ".number", number);
@@ -83,7 +81,7 @@ PacketFifoEntry::unserialize(const string &base, CheckpointIn &cp)
 }
 
 void
-PacketFifo::serialize(const string &base, CheckpointOut &cp) const
+PacketFifo::serialize(const std::string &base, CheckpointOut &cp) const
 {
     paramOut(cp, base + ".size", _size);
     paramOut(cp, base + ".maxsize", _maxsize);
@@ -96,7 +94,7 @@ PacketFifo::serialize(const string &base, CheckpointOut &cp) const
 }
 
 void
-PacketFifo::unserialize(const string &base, CheckpointIn &cp)
+PacketFifo::unserialize(const std::string &base, CheckpointIn &cp)
 {
     paramIn(cp, base + ".size", _size);
 //  paramIn(cp, base + ".maxsize", _maxsize);
index ffec996c87253669152efb6b645e292056ea1290..f270487c480869ee33d9cc27fe3a1a983edb919e 100644 (file)
@@ -43,7 +43,6 @@
 #include "sim/eventq.hh"
 #include "sim/stats.hh"
 
-using namespace std;
 using namespace Net;
 
 namespace Sinic {
@@ -835,8 +834,8 @@ Device::rxKick()
             goto exit;
 
         rxDmaAddr = pciToDma(Regs::get_RxData_Addr(vnic->RxData));
-        rxDmaLen = min<unsigned>(Regs::get_RxData_Len(vnic->RxData),
-                                 vnic->rxPacketBytes);
+        rxDmaLen = std::min<unsigned>(Regs::get_RxData_Len(vnic->RxData),
+                                      vnic->rxPacketBytes);
 
         /*
          * if we're doing zero/delay copy and we're below the fifo
@@ -1016,7 +1015,7 @@ Device::txKick()
         assert(Regs::get_TxDone_Busy(vnic->TxDone));
         if (!txPacket) {
             // Grab a new packet from the fifo.
-            txPacket = make_shared<EthPacketData>(16384);
+            txPacket = std::make_shared<EthPacketData>(16384);
             txPacketOffset = 0;
         }
 
@@ -1425,7 +1424,7 @@ Device::unserialize(CheckpointIn &cp)
     UNSERIALIZE_SCALAR(txPacketExists);
     txPacket = 0;
     if (txPacketExists) {
-        txPacket = make_shared<EthPacketData>(16384);
+        txPacket = std::make_shared<EthPacketData>(16384);
         txPacket->unserialize("txPacket", cp);
         UNSERIALIZE_SCALAR(txPacketOffset);
         UNSERIALIZE_SCALAR(txPacketBytes);
index f7591a068558d8333feca8d976234ff21ac9c6e5..014844280da5a2ffb5309010617633c211775855 100644 (file)
 #endif
 #endif
 
-using namespace std;
-
 std::vector<std::pair<TCPIface::NodeInfo, int> > TCPIface::nodes;
-vector<int> TCPIface::sockRegistry;
+std::vector<int> TCPIface::sockRegistry;
 int TCPIface::fdStatic = -1;
 bool TCPIface::anyListening = false;
 
-TCPIface::TCPIface(string server_name, unsigned server_port,
+TCPIface::TCPIface(std::string server_name, unsigned server_port,
                    unsigned dist_rank, unsigned dist_size,
                    Tick sync_start, Tick sync_repeat,
                    EventManager *em, bool use_pseudo_op, bool is_switch,
@@ -105,7 +103,7 @@ TCPIface::TCPIface(string server_name, unsigned server_port,
             DPRINTF(DistEthernet, "First connection, waiting for link info\n");
             if (!recvTCP(sock, &ni, sizeof(ni)))
                 panic("Failed to receive link info");
-            nodes.push_back(make_pair(ni, sock));
+            nodes.push_back(std::make_pair(ni, sock));
         }
     }
 }
@@ -157,10 +155,10 @@ TCPIface::establishConnection()
     if (isSwitch) {
         if (cur_id == 0) { // first connection accepted in the ctor already
             auto const &iface0 =
-                find_if(nodes.begin(), nodes.end(),
-                        [](const pair<NodeInfo, int> &cn) -> bool {
-                            return cn.first.rank == cur_rank;
-                        });
+                std::find_if(nodes.begin(), nodes.end(),
+                             [](const std::pair<NodeInfo, int> &cn) -> bool {
+                                 return cn.first.rank == cur_rank;
+                             });
             assert(iface0 != nodes.end());
             assert(iface0->first.distIfaceId == 0);
             sock = iface0->second;
@@ -223,7 +221,7 @@ TCPIface::connect()
     struct addrinfo addr_hint, *addr_results;
      int ret;
 
-     string port_str = to_string(serverPort);
+     std::string port_str = std::to_string(serverPort);
 
      sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
      panic_if(sock < 0, "socket() failed: %s", strerror(errno));
@@ -326,7 +324,7 @@ TCPIface::recvHeader(Header &header)
 void
 TCPIface::recvPacket(const Header &header, EthPacketPtr &packet)
 {
-    packet = make_shared<EthPacketData>(header.dataPacketLength);
+    packet = std::make_shared<EthPacketData>(header.dataPacketLength);
     bool ret = recvTCP(sock, packet->data, header.dataPacketLength);
     panic_if(!ret, "Error while reading socket");
     packet->simLength = header.simLength;
index 718f76711b0582342dd9275b2ae0aaab2180ea0b..a0fa1533cc9f102b2c288e259d70a30a540d03c6 100644 (file)
@@ -31,8 +31,6 @@
 #include "base/logging.hh"
 #include "sim/sim_exit.hh"
 
-using namespace std;
-
 Platform::Platform(const Params &p)
     : SimObject(p), intrctrl(p.intrctrl)
 {
index af4ffddf624920747f7352981c0c8b389afa5c8f..deed03fb32c5397bdcc2844d22984e5392d8004d 100644 (file)
@@ -73,9 +73,6 @@
 #include "dev/platform.hh"
 #include "dev/serial/uart.hh"
 
-using namespace std;
-
-
 /*
  * Poll event for the listen socket
  */
@@ -124,7 +121,7 @@ Terminal::Terminal(const Params &p)
 #endif
 {
     if (outfile)
-        outfile->stream()->setf(ios::unitbuf);
+        outfile->stream()->setf(std::ios::unitbuf);
 
     if (p.port)
         listen(p.port);
@@ -178,7 +175,7 @@ Terminal::listen(int port)
         port++;
     }
 
-    ccprintf(cerr, "%s: Listening for connections on port %d\n",
+    ccprintf(std::cerr, "%s: Listening for connections on port %d\n",
              name(), port);
 
     listenEvent = new ListenEvent(this, listener.getfd(), POLLIN);
@@ -203,7 +200,7 @@ Terminal::accept()
     dataEvent = new DataEvent(this, data_fd, POLLIN);
     pollQueue.schedule(dataEvent);
 
-    stringstream stream;
+    std::stringstream stream;
     ccprintf(stream, "==== m5 terminal: Terminal %d ====", number);
 
     // we need an actual carriage return followed by a newline for the
index 83238d60c1bade78dfc295db86bbb7595dc6634f..1804a3b7974a292f0c45f5db4a66322529ccf96e 100644 (file)
@@ -43,8 +43,6 @@
 #include "mem/packet_access.hh"
 #include "sim/serialize.hh"
 
-using namespace std;
-
 void
 Uart8250::processIntrEvent(int intrBit)
 {
index e2bdbb109b27bf11d1d3a9b4efc20c41c2fb00ad..b36b7f57645337322f80b6a0c78f7fdb16f3e655 100644 (file)
@@ -44,8 +44,6 @@
 #include "mem/port.hh"
 #include "sim/system.hh"
 
-using namespace std;
-
 DumbTOD::DumbTOD(const Params &p)
     : BasicPioDevice(p, 0x08)
 {
index ee61fbfe5b38954930070737645147bab1b25c02..0a90974bd73a8ff055da6f148b9ebce2f890fb69 100644 (file)
@@ -39,8 +39,6 @@
 #include "cpu/intr_control.hh"
 #include "sim/system.hh"
 
-using namespace std;
-
 T1000::T1000(const Params &p)
     : Platform(p), system(p.system)
 {}
index 199ecc23bd5bafa49c0bfbbfa60f6fe5785811de..50e8cf2da5149d50a5baaff568a8a39e6b4c515d 100644 (file)
@@ -50,8 +50,6 @@
 #include "sim/serialize.hh"
 #include "sim/sim_exit.hh"
 
-using namespace std;
-
 ////////////////////////////////////////////////////////////////////////
 //
 // Raw Disk image
@@ -79,16 +77,16 @@ RawDiskImage::notifyFork()
 }
 
 void
-RawDiskImage::open(const string &filename, bool rd_only)
+RawDiskImage::open(const std::string &filename, bool rd_only)
 {
     if (!filename.empty()) {
         initialized = true;
         readonly = rd_only;
         file = filename;
 
-        ios::openmode mode = ios::in | ios::binary;
+        std::ios::openmode mode = std::ios::in | std::ios::binary;
         if (!readonly)
-            mode |= ios::out;
+            mode |= std::ios::out;
         stream.open(file.c_str(), mode);
         if (!stream.is_open())
             panic("Error opening %s", filename);
@@ -107,7 +105,7 @@ RawDiskImage::size() const
     if (disk_size == 0) {
         if (!stream.is_open())
             panic("file not open!\n");
-        stream.seekg(0, ios::end);
+        stream.seekg(0, std::ios::end);
         disk_size = stream.tellg();
     }
 
@@ -123,11 +121,11 @@ RawDiskImage::read(uint8_t *data, std::streampos offset) const
     if (!stream.is_open())
         panic("file not open!\n");
 
-    stream.seekg(offset * SectorSize, ios::beg);
+    stream.seekg(offset * SectorSize, std::ios::beg);
     if (!stream.good())
         panic("Could not seek to location in file");
 
-    streampos pos = stream.tellg();
+    std::streampos pos = stream.tellg();
     stream.read((char *)data, SectorSize);
 
     DPRINTF(DiskImageRead, "read: offset=%d\n", (uint64_t)offset);
@@ -148,14 +146,14 @@ RawDiskImage::write(const uint8_t *data, std::streampos offset)
     if (!stream.is_open())
         panic("file not open!\n");
 
-    stream.seekp(offset * SectorSize, ios::beg);
+    stream.seekp(offset * SectorSize, std::ios::beg);
     if (!stream.good())
         panic("Could not seek to location in file");
 
     DPRINTF(DiskImageWrite, "write: offset=%d\n", (uint64_t)offset);
     DDUMP(DiskImageWrite, data, SectorSize);
 
-    streampos pos = stream.tellp();
+    std::streampos pos = stream.tellp();
     stream.write((const char *)data, SectorSize);
     return stream.tellp() - pos;
 }
@@ -206,7 +204,7 @@ CowDiskImage::notifyFork()
 }
 
 void
-SafeRead(ifstream &stream, void *data, int count)
+SafeRead(std::ifstream &stream, void *data, int count)
 {
     stream.read((char *)data, count);
     if (!stream.is_open())
@@ -221,23 +219,23 @@ SafeRead(ifstream &stream, void *data, int count)
 
 template<class T>
 void
-SafeRead(ifstream &stream, T &data)
+SafeRead(std::ifstream &stream, T &data)
 {
     SafeRead(stream, &data, sizeof(data));
 }
 
 template<class T>
 void
-SafeReadSwap(ifstream &stream, T &data)
+SafeReadSwap(std::ifstream &stream, T &data)
 {
     SafeRead(stream, &data, sizeof(data));
     data = letoh(data); //is this the proper byte order conversion?
 }
 
 bool
-CowDiskImage::open(const string &file)
+CowDiskImage::open(const std::string &file)
 {
-    ifstream stream(file.c_str());
+    std::ifstream stream(file.c_str());
     if (!stream.is_open())
         return false;
 
@@ -289,7 +287,7 @@ CowDiskImage::initSectorTable(int hash_size)
 }
 
 void
-SafeWrite(ofstream &stream, const void *data, int count)
+SafeWrite(std::ofstream &stream, const void *data, int count)
 {
     stream.write((const char *)data, count);
     if (!stream.is_open())
@@ -304,14 +302,14 @@ SafeWrite(ofstream &stream, const void *data, int count)
 
 template<class T>
 void
-SafeWrite(ofstream &stream, const T &data)
+SafeWrite(std::ofstream &stream, const T &data)
 {
     SafeWrite(stream, &data, sizeof(data));
 }
 
 template<class T>
 void
-SafeWriteSwap(ofstream &stream, const T &data)
+SafeWriteSwap(std::ofstream &stream, const T &data)
 {
     T swappeddata = letoh(data); //is this the proper byte order conversion?
     SafeWrite(stream, &swappeddata, sizeof(data));
@@ -327,12 +325,12 @@ CowDiskImage::save() const
         save(filename);}
 
 void
-CowDiskImage::save(const string &file) const
+CowDiskImage::save(const std::string &file) const
 {
     if (!initialized)
         panic("RawDiskImage not initialized");
 
-    ofstream stream(file.c_str());
+    std::ofstream stream(file.c_str());
     if (!stream.is_open() || stream.fail() || stream.bad())
         panic("Error opening %s", file);
 
@@ -423,7 +421,7 @@ CowDiskImage::write(const uint8_t *data, std::streampos offset)
 void
 CowDiskImage::serialize(CheckpointOut &cp) const
 {
-    string cowFilename = name() + ".cow";
+    std::string cowFilename = name() + ".cow";
     SERIALIZE_SCALAR(cowFilename);
     save(CheckpointIn::dir() + "/" + cowFilename);
 }
@@ -431,7 +429,7 @@ CowDiskImage::serialize(CheckpointOut &cp) const
 void
 CowDiskImage::unserialize(CheckpointIn &cp)
 {
-    string cowFilename;
+    std::string cowFilename;
     UNSERIALIZE_SCALAR(cowFilename);
     cowFilename = cp.getCptDir() + "/" + cowFilename;
     open(cowFilename);
index 91f213b9f1f18fc74b16b1eeafa5d10161e9f69b..e52526bd435552c2d2c4cc5815e4beb60f405429 100644 (file)
@@ -48,8 +48,6 @@
 #include "mem/port_proxy.hh"
 #include "sim/system.hh"
 
-using namespace std;
-
 SimpleDisk::SimpleDisk(const Params &p)
     : SimObject(p), system(p.system), image(p.disk)
 {}