base: Remove flag from allFlags on destruction

When a flag is destroyed it must be removed from the list
containing all flags.

Use this opportunity to remove "using namespace std" since
it is barely used.

Change-Id: I201371a770c56e11b92532e146d577c6ecb29d34
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38709
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Daniel R. Carvalho
2020-12-25 14:31:02 -03:00
committed by Daniel Carvalho
parent 23f8efc73b
commit 0c3dcfd314

View File

@@ -49,8 +49,6 @@
#include "base/cprintf.hh"
#include "base/logging.hh"
using namespace std;
namespace Debug {
//
@@ -93,8 +91,8 @@ findFlag(const std::string &name)
Flag::Flag(const char *name, const char *desc)
: _name(name), _desc(desc)
{
pair<FlagsMap::iterator, bool> result =
allFlags().insert(make_pair(name, this));
std::pair<FlagsMap::iterator, bool> result =
allFlags().insert(std::make_pair(name, this));
if (!result.second)
panic("Flag %s already defined!", name);
@@ -106,7 +104,7 @@ Flag::Flag(const char *name, const char *desc)
Flag::~Flag()
{
// should find and remove flag.
allFlags().erase(name());
}
void