Просмотр исходного кода

cmMakefile: Store macro list in a vector not in a map.

The signature was computed (incorrectly) and stored as the map
value, but never used.  Remove it now.
Stephen Kelly 10 лет назад
Родитель
Сommit
c021f59c1f
4 измененных файлов с 10 добавлено и 28 удалено
  1. 1 0
      Source/cmGetCMakePropertyCommand.cxx
  2. 1 9
      Source/cmMacroCommand.cxx
  3. 6 16
      Source/cmMakefile.cxx
  4. 2 3
      Source/cmMakefile.h

+ 1 - 0
Source/cmGetCMakePropertyCommand.cxx

@@ -39,6 +39,7 @@ bool cmGetCMakePropertyCommand
     }
   else if ( args[1] == "MACROS" )
     {
+    output.clear();
     this->Makefile->GetListOfMacros(output);
     }
   else if ( args[1] == "COMPONENTS" )

+ 1 - 9
Source/cmMacroCommand.cxx

@@ -224,15 +224,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
     // if this is the endmacro for this macro then execute
     if (!this->Depth)
       {
-      std::string name = this->Args[0];
-      name += "(";
-      if (!this->Args.empty())
-        {
-        name += " ";
-        name += cmJoin(this->Args, " ");
-        }
-      name += " )";
-      mf.AddMacro(this->Args[0].c_str(), name.c_str());
+      mf.AddMacro(this->Args[0].c_str());
       // create a new command and add it to cmake
       cmMacroHelperCommand *f = new cmMacroHelperCommand();
       f->Args = this->Args;

+ 6 - 16
Source/cmMakefile.cxx

@@ -143,7 +143,7 @@ cmMakefile::cmMakefile(const cmMakefile& mf): Internal(new Internals)
 
   this->LocalGenerator = mf.LocalGenerator;
   this->FunctionBlockers = mf.FunctionBlockers;
-  this->MacrosMap = mf.MacrosMap;
+  this->MacrosList = mf.MacrosList;
   this->SubDirectoryOrder = mf.SubDirectoryOrder;
   this->Properties = mf.Properties;
   this->PreOrder = mf.PreOrder;
@@ -3739,26 +3739,16 @@ cmVariableWatch *cmMakefile::GetVariableWatch() const
 }
 #endif
 
-void cmMakefile::AddMacro(const char* name, const char* signature)
+void cmMakefile::AddMacro(const char* name)
 {
-  if ( !name || !signature )
-    {
-    return;
-    }
-  this->MacrosMap[name] = signature;
+  assert(name);
+  this->MacrosList.push_back(name);
 }
 
 void cmMakefile::GetListOfMacros(std::string& macros) const
 {
-  StringStringMap::const_iterator it;
-  macros = "";
-  const char* sep = "";
-  for ( it = this->MacrosMap.begin(); it != this->MacrosMap.end(); ++it )
-    {
-    macros += sep;
-    macros += it->first;
-    sep = ";";
-    }
+  assert(macros.empty());
+  macros = cmJoin(this->MacrosList, ";");
 }
 
 cmCacheManager *cmMakefile::GetCacheManager() const

+ 2 - 3
Source/cmMakefile.h

@@ -841,7 +841,7 @@ public:
    * Add a macro to the list of macros. The arguments should be name of the
    * macro and a documentation signature of it
    */
-  void AddMacro(const char* name, const char* signature);
+  void AddMacro(const char* name);
 
   ///! Add a new cmTest to the list of tests for this makefile.
   cmTest* CreateTest(const std::string& testName);
@@ -1065,8 +1065,7 @@ private:
 
   std::stack<int> LoopBlockCounter;
 
-  typedef std::map<std::string, std::string> StringStringMap;
-  StringStringMap MacrosMap;
+  std::vector<std::string> MacrosList;
 
   std::map<std::string, bool> SubDirectoryOrder;