Gabe Black has uploaded this change for review. ( 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
---
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(-)



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, &result);
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 &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 << " <symbol file> <symbol>" << endl;
+    std::cout << "Usage: " << progname << " <symbol file> <symbol>"
+        << 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: 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