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 <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2021-01-21 04:50:11 -08:00
parent 5155678961
commit 61dbd95e1b
4 changed files with 13 additions and 17 deletions

View File

@@ -36,8 +36,6 @@
#include "base/cprintf.hh"
using namespace std;
volatile int stop = false;
void
@@ -56,14 +54,14 @@ do_test(int seconds)
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);

View File

@@ -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 @@ main(int argc, char *argv[])
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') {

View File

@@ -50,7 +50,6 @@ const char *m5MainCommands[] = {
0 // sentinel is required
};
using namespace std;
using namespace Stats;
double testfunc();

View File

@@ -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 @@ main(int argc, char *argv[])
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;