From f58c3774d15f16ea287ca52fcbd04c17f0a5612d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 17 May 2015 15:20:38 +0200 Subject: [PATCH] cmMakefile: Mark definitions explicitly erased, even at top level. Presumably the intention here is to attempt to optimize memory by not storing what is not needed. However, all keys need to be tracked anyway to implement initialization tracking, and this special case gets in the way of simplifying the implementation of that. This doesn't change any observable effects because values set to 0 are considered not to exist by the cmDefinitions API. --- Source/cmDefinitions.cxx | 5 ----- Source/cmDefinitions.h | 2 -- Source/cmMakefile.cxx | 10 +--------- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index d7b6279a9..97a16ea23 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -61,11 +61,6 @@ void cmDefinitions::Set(const std::string& key, const char* value) this->Map[key] = def; } -void cmDefinitions::Erase(const std::string& key) -{ - this->Map.erase(key); -} - //---------------------------------------------------------------------------- std::vector cmDefinitions::LocalKeys() const { diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 17b9c7cde..894ff7a02 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -43,8 +43,6 @@ public: /** Set (or unset if null) a value associated with a key. */ void Set(const std::string& key, const char* value); - void Erase(const std::string& key); - /** Get the set of all local keys. */ std::vector LocalKeys() const; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index adba110f7..ad48bb71f 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -76,15 +76,7 @@ public: void RemoveDefinition(std::string const& name) { - if (this->VarStack.size() > 1) - { - // In lower scopes we store keys, defined or not. - this->VarStack.back().Set(name, 0); - } - else - { - this->VarStack.back().Erase(name); - } + this->VarStack.back().Set(name, 0); } std::vector LocalKeys() const