From 0c3dcfd3146e452b25cf4a5e155a1720627658f8 Mon Sep 17 00:00:00 2001 From: "Daniel R. Carvalho" Date: Fri, 25 Dec 2020 14:31:02 -0300 Subject: [PATCH] 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 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38709 Reviewed-by: Andreas Sandberg Reviewed-by: Gabe Black Maintainer: Bobby R. Bruce Tested-by: kokoro --- src/base/debug.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/base/debug.cc b/src/base/debug.cc index 9cfd45ec4..8eaf2c6f4 100644 --- a/src/base/debug.cc +++ b/src/base/debug.cc @@ -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 result = - allFlags().insert(make_pair(name, this)); + std::pair 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 -- 2.30.2