summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-05-21 13:03:44 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-05-21 13:03:44 (GMT)
commitf05d9308c9c01949071a764acceb4bf88875f8a9 (patch)
treee35890e31e718c0b94a25217759126add11d5d60 /Source
parenta23fdec8d2bfb8f2ce88972d93e23c83923ec4af (diff)
parentb9f9915516c9b426f4f528bb1ec5a79d115e21ab (diff)
downloadCMake-f05d9308c9c01949071a764acceb4bf88875f8a9.zip
CMake-f05d9308c9c01949071a764acceb4bf88875f8a9.tar.gz
CMake-f05d9308c9c01949071a764acceb4bf88875f8a9.tar.bz2
Merge topic 'clean-up-cmMakefile'
b9f99155 cmMakefile: Remove VarUsageStack. 2b09d9f3 cmMakefile: Remove VarInitStack. 528d6802 cmMakefile: Use more suitable method name to log var usage. 9118b53b cmMakefile: Move internal method to private scope. f58c3774 cmMakefile: Mark definitions explicitly erased, even at top level. ea7b962b cmMakefile: Raise variable in scope explicitly when needed. c8cb6688 cmMakefile: Use early return to reduce nested code. bdd1aa91 cmMakefile: Don't use else after return. c42f0e2b cmMakefile: Remove redundant conditions. caff8e5a cmCTest: Remove unimplemented method. bb1e8c3a cmMakefile: Remove Print() debugging facilities. 1363bff8 cmMakefile: Remove duplicate variable initialization. 5b7ff35c cmMakefile: Don't expect the VarStack iterator to support size(). 390bc324 cmMakefile: Remove redundant condition. 8ab1cce7 cmMakefile: Rename method to something more appropriate. 2dd5d42f cmMakefile: Make the public ReadListFile method take one param. ...
Diffstat (limited to 'Source')
-rw-r--r--Source/cmDefinitions.cxx42
-rw-r--r--Source/cmDefinitions.h27
-rw-r--r--Source/cmExtraQbsGenerator.cxx4
-rw-r--r--Source/cmLocalNinjaGenerator.cxx4
-rw-r--r--Source/cmMakefile.cxx239
-rw-r--r--Source/cmMakefile.h40
-rw-r--r--Source/cmTest.h5
-rw-r--r--Source/cmTryRunCommand.cxx2
-rw-r--r--Source/cmakemain.cxx2
9 files changed, 118 insertions, 247 deletions
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index e2c6876..2dab169 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -18,12 +18,13 @@ cmDefinitions::Def cmDefinitions::NoDef;
//----------------------------------------------------------------------------
cmDefinitions::Def const& cmDefinitions::GetInternal(
- const std::string& key, StackIter begin, StackIter end)
+ const std::string& key, StackIter begin, StackIter end, bool raise)
{
assert(begin != end);
- MapType::const_iterator i = begin->Map.find(key);
+ MapType::iterator i = begin->Map.find(key);
if (i != begin->Map.end())
{
+ i->second.Used = true;
return i->second;
}
StackIter it = begin;
@@ -32,7 +33,11 @@ cmDefinitions::Def const& cmDefinitions::GetInternal(
{
return cmDefinitions::NoDef;
}
- Def const& def = cmDefinitions::GetInternal(key, it, end);
+ Def const& def = cmDefinitions::GetInternal(key, it, end, raise);
+ if (!raise)
+ {
+ return def;
+ }
return begin->Map.insert(MapType::value_type(key, def)).first->second;
}
@@ -40,10 +45,30 @@ cmDefinitions::Def const& cmDefinitions::GetInternal(
const char* cmDefinitions::Get(const std::string& key,
StackIter begin, StackIter end)
{
- Def const& def = cmDefinitions::GetInternal(key, begin, end);
+ Def const& def = cmDefinitions::GetInternal(key, begin, end, false);
return def.Exists? def.c_str() : 0;
}
+void cmDefinitions::Raise(const std::string& key,
+ StackIter begin, StackIter end)
+{
+ cmDefinitions::GetInternal(key, begin, end, true);
+}
+
+bool cmDefinitions::HasKey(const std::string& key,
+ StackConstIter begin, StackConstIter end)
+{
+ for (StackConstIter it = begin; it != end; ++it)
+ {
+ MapType::const_iterator i = it->Map.find(key);
+ if (i != it->Map.end())
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
//----------------------------------------------------------------------------
void cmDefinitions::Set(const std::string& key, const char* value)
{
@@ -51,13 +76,8 @@ 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<std::string> cmDefinitions::LocalKeys() const
+std::vector<std::string> cmDefinitions::UnusedKeys() const
{
std::vector<std::string> keys;
keys.reserve(this->Map.size());
@@ -65,7 +85,7 @@ std::vector<std::string> cmDefinitions::LocalKeys() const
for(MapType::const_iterator mi = this->Map.begin();
mi != this->Map.end(); ++mi)
{
- if (mi->second.Exists)
+ if (!mi->second.Used)
{
keys.push_back(mi->first);
}
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index bf791ed..5fdcaab 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -35,18 +35,18 @@ class cmDefinitions
typedef std::list<cmDefinitions>::reverse_iterator StackIter;
typedef std::list<cmDefinitions>::const_reverse_iterator StackConstIter;
public:
- /** Get the value associated with a key; null if none.
- Store the result locally if it came from a parent. */
static const char* Get(const std::string& key,
StackIter begin, StackIter end);
+ static void Raise(const std::string& key, StackIter begin, StackIter end);
+
+ static bool HasKey(const std::string& key,
+ StackConstIter begin, StackConstIter end);
+
/** 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<std::string> LocalKeys() const;
+ std::vector<std::string> UnusedKeys() const;
static std::vector<std::string> ClosureKeys(StackConstIter begin,
StackConstIter end);
@@ -60,11 +60,16 @@ private:
private:
typedef std::string std_string;
public:
- Def(): std_string(), Exists(false) {}
- Def(const char* v): std_string(v?v:""), Exists(v?true:false) {}
- Def(const std_string& v): std_string(v), Exists(true) {}
- Def(Def const& d): std_string(d), Exists(d.Exists) {}
+ Def(): std_string(), Exists(false), Used(false) {}
+ Def(const char* v)
+ : std_string(v ? v : ""),
+ Exists(v ? true : false),
+ Used(false)
+ {}
+ Def(const std_string& v): std_string(v), Exists(true), Used(false) {}
+ Def(Def const& d): std_string(d), Exists(d.Exists), Used(d.Used) {}
bool Exists;
+ bool Used;
};
static Def NoDef;
@@ -80,7 +85,7 @@ private:
MapType Map;
static Def const& GetInternal(const std::string& key,
- StackIter begin, StackIter end);
+ StackIter begin, StackIter end, bool raise);
};
#endif
diff --git a/Source/cmExtraQbsGenerator.cxx b/Source/cmExtraQbsGenerator.cxx
index 4cc4650..c15f8da 100644
--- a/Source/cmExtraQbsGenerator.cxx
+++ b/Source/cmExtraQbsGenerator.cxx
@@ -182,7 +182,9 @@ void cmExtraQbsGenerator::AppendSources(cmGeneratedFileStream &fout,
std::vector<cmSourceFile *> genSources;
std::vector<cmSourceFile *>::const_iterator itr = sources.begin();
fout << "\t\t\tfiles: [\n"
- << "\t\t\t\t\"" << t.GetMakefile()->GetCurrentListFile() << "\",\n";
+ << "\t\t\t\t\""
+ << t.GetMakefile()->GetDefinition("CMAKE_CURRENT_LIST_FILE")
+ << "\",\n";
for (; itr != sources.end(); ++itr)
{
if (!(*itr)->GetPropertyAsBool("GENERATED"))
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index f1f1202..bcae486 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -305,8 +305,8 @@ void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os)
cmGlobalNinjaGenerator::WriteDivider(os);
os
<< "# Write statements declared in CMakeLists.txt:" << std::endl
- << "# " << this->Makefile->GetCurrentListFile() << std::endl
- ;
+ << "# "
+ << this->Makefile->GetDefinition("CMAKE_CURRENT_LIST_FILE") << std::endl;
if(this->IsRootMakefile())
os << "# Which is the root file." << std::endl;
cmGlobalNinjaGenerator::WriteDivider(os);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 3e19cbb..31ab66d 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -38,7 +38,6 @@
#include <cmsys/FStream.hxx>
#include <cmsys/auto_ptr.hxx>
-#include <stack>
#include <list>
#include <ctype.h> // for isspace
#include <assert.h>
@@ -47,8 +46,6 @@ class cmMakefile::Internals
{
public:
std::list<cmDefinitions> VarStack;
- std::stack<std::set<std::string> > VarInitStack;
- std::stack<std::set<std::string> > VarUsageStack;
bool IsSourceFileTryCompile;
void PushDefinitions()
@@ -69,6 +66,12 @@ public:
this->VarStack.rend());
}
+ bool IsInitialized(std::string const& name)
+ {
+ return cmDefinitions::HasKey(name, this->VarStack.rbegin(),
+ this->VarStack.rend());
+ }
+
void SetDefinition(std::string const& name, std::string const& value)
{
this->VarStack.back().Set(name, value.c_str());
@@ -76,20 +79,12 @@ 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<std::string> LocalKeys() const
+ std::vector<std::string> UnusedKeys() const
{
- return this->VarStack.back().LocalKeys();
+ return this->VarStack.back().UnusedKeys();
}
std::vector<std::string> ClosureKeys() const
@@ -105,35 +100,32 @@ public:
bool RaiseScope(std::string const& var, const char* varDef, cmMakefile* mf)
{
- assert(this->VarStack.size() > 0);
-
std::list<cmDefinitions>::reverse_iterator it = this->VarStack.rbegin();
+ assert(it != this->VarStack.rend());
++it;
if(it == this->VarStack.rend())
{
- if(cmLocalGenerator* plg = mf->GetLocalGenerator()->GetParent())
+ cmLocalGenerator* plg = mf->GetLocalGenerator()->GetParent();
+ if(!plg)
{
- // Update the definition in the parent directory top scope. This
- // directory's scope was initialized by the closure of the parent
- // scope, so we do not need to localize the definition first.
- cmMakefile* parent = plg->GetMakefile();
- if (varDef)
- {
- parent->AddDefinition(var, varDef);
- }
- else
- {
- parent->RemoveDefinition(var);
- }
- return true;
+ return false;
+ }
+ // Update the definition in the parent directory top scope. This
+ // directory's scope was initialized by the closure of the parent
+ // scope, so we do not need to localize the definition first.
+ cmMakefile* parent = plg->GetMakefile();
+ if (varDef)
+ {
+ parent->AddDefinition(var, varDef);
}
else
{
- return false;
+ parent->RemoveDefinition(var);
}
+ return true;
}
// First localize the definition in the current scope.
- this->GetDefinition(var);
+ cmDefinitions::Raise(var, this->VarStack.rbegin(), this->VarStack.rend());
// Now update the definition in the parent scope.
it->Set(var, varDef);
@@ -148,13 +140,11 @@ cmMakefile::cmMakefile(cmLocalGenerator* localGenerator)
StateSnapshot(localGenerator->GetStateSnapshot())
{
this->Internal->PushDefinitions();
- this->Internal->VarInitStack.push(std::set<std::string>());
- this->Internal->VarUsageStack.push(std::set<std::string>());
this->Internal->IsSourceFileTryCompile = false;
// Initialize these first since AddDefaultDefinitions calls AddDefinition
- this->WarnUnused = false;
- this->CheckSystemVars = false;
+ this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused();
+ this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars();
this->GeneratingBuildSystem = false;
this->SuppressWatches = false;
@@ -224,24 +214,16 @@ cmMakefile::cmMakefile(cmLocalGenerator* localGenerator)
#endif
this->Properties.SetCMakeInstance(this->GetCMakeInstance());
- this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused();
- this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars();
{
const char* dir = this->GetCMakeInstance()->GetHomeDirectory();
this->AddDefinition("CMAKE_SOURCE_DIR", dir);
- if ( !this->GetDefinition("CMAKE_CURRENT_SOURCE_DIR") )
- {
- this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", dir);
- }
+ this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", dir);
}
{
const char* dir = this->GetCMakeInstance()->GetHomeOutputDirectory();
this->AddDefinition("CMAKE_BINARY_DIR", dir);
- if ( !this->GetDefinition("CMAKE_CURRENT_BINARY_DIR") )
- {
- this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", dir);
- }
+ this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", dir);
}
}
@@ -262,59 +244,6 @@ cmMakefile::~cmMakefile()
}
}
-void cmMakefile::PrintStringVector(const char* s,
- const std::vector<std::string>& v) const
-{
- std::cout << s << ": ( \n" << cmWrap('"', v, '"', " ") << ")\n";
-}
-
-void cmMakefile
-::PrintStringVector(const char* s,
- const std::vector<std::pair<std::string, bool> >& v) const
-{
- std::cout << s << ": ( \n";
- for(std::vector<std::pair<std::string, bool> >::const_iterator i
- = v.begin(); i != v.end(); ++i)
- {
- std::cout << i->first << " " << i->second;
- }
- std::cout << " )\n";
-}
-
-
-// call print on all the classes in the makefile
-void cmMakefile::Print() const
-{
- // print the class lists
- std::cout << "classes:\n";
-
- std::cout << " this->Targets: ";
- for (cmTargets::iterator l = this->Targets.begin();
- l != this->Targets.end(); l++)
- {
- std::cout << l->first << std::endl;
- }
-
- std::cout << " this->StartOutputDirectory; " <<
- this->GetCurrentBinaryDirectory() << std::endl;
- std::cout << " this->HomeOutputDirectory; " <<
- this->GetHomeOutputDirectory() << std::endl;
- std::cout << " this->cmStartDirectory; " <<
- this->GetCurrentSourceDirectory() << std::endl;
- std::cout << " this->cmHomeDirectory; " <<
- this->GetHomeDirectory() << std::endl;
- std::cout << " this->ProjectName; "
- << this->ProjectName << std::endl;
- this->PrintStringVector("this->LinkDirectories", this->LinkDirectories);
-#if defined(CMAKE_BUILD_WITH_CMAKE)
- for( std::vector<cmSourceGroup>::const_iterator i =
- this->SourceGroups.begin(); i != this->SourceGroups.end(); ++i)
- {
- std::cout << "Source Group: " << i->GetName() << std::endl;
- }
-#endif
-}
-
//----------------------------------------------------------------------------
void cmMakefile::IssueMessage(cmake::MessageType t,
std::string const& text) const
@@ -601,7 +530,6 @@ void cmMakefile::IncludeScope::EnforceCMP0011()
bool cmMakefile::ProcessBuildsystemFile(const char* listfile)
{
this->AddDefinition("CMAKE_PARENT_LIST_FILE", listfile);
- this->cmCurrentListFile = listfile;
std::string curSrc = this->GetCurrentSourceDirectory();
return this->ReadListFile(listfile, true,
curSrc == this->GetHomeDirectory());
@@ -609,17 +537,16 @@ bool cmMakefile::ProcessBuildsystemFile(const char* listfile)
bool cmMakefile::ReadDependentFile(const char* listfile, bool noPolicyScope)
{
- this->AddDefinition("CMAKE_PARENT_LIST_FILE", this->GetCurrentListFile());
- this->cmCurrentListFile =
- cmSystemTools::CollapseFullPath(listfile,
- this->GetCurrentSourceDirectory());
- return this->ReadListFile(this->cmCurrentListFile.c_str(),
- noPolicyScope);
+ this->AddDefinition("CMAKE_PARENT_LIST_FILE",
+ this->GetDefinition("CMAKE_CURRENT_LIST_FILE"));
+ return this->ReadListFile(listfile, noPolicyScope, false);
+}
+
+bool cmMakefile::ReadListFile(const char* listfile)
+{
+ return this->ReadListFile(listfile, true, false);
}
-//----------------------------------------------------------------------------
-// Parse the given CMakeLists.txt file executing all commands
-//
bool cmMakefile::ReadListFile(const char* listfile,
bool noPolicyScope,
bool requireProjectCommand)
@@ -658,7 +585,6 @@ bool cmMakefile::ReadListFile(const char* listfile,
if (res)
{
- // Check for unused variables
this->CheckForUnusedVariables();
}
@@ -1793,14 +1719,11 @@ void cmMakefile::AddDefinition(const std::string& name, const char* value)
return;
}
- this->Internal->SetDefinition(name, value);
- if (!this->Internal->VarUsageStack.empty() &&
- this->VariableInitialized(name))
+ if (this->VariableInitialized(name))
{
- this->CheckForUnused("changing definition", name);
- this->Internal->VarUsageStack.top().erase(name);
+ this->LogUnused("changing definition", name);
}
- this->Internal->VarInitStack.top().insert(name);
+ this->Internal->SetDefinition(name, value);
#ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* vv = this->GetVariableWatch();
@@ -1869,14 +1792,11 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
void cmMakefile::AddDefinition(const std::string& name, bool value)
{
- this->Internal->SetDefinition(name, value ? "ON" : "OFF");
- if (!this->Internal->VarUsageStack.empty() &&
- this->VariableInitialized(name))
+ if (this->VariableInitialized(name))
{
- this->CheckForUnused("changing definition", name);
- this->Internal->VarUsageStack.top().erase(name);
+ this->LogUnused("changing definition", name);
}
- this->Internal->VarInitStack.top().insert(name);
+ this->Internal->SetDefinition(name, value ? "ON" : "OFF");
#ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* vv = this->GetVariableWatch();
if ( vv )
@@ -1893,43 +1813,28 @@ void cmMakefile::CheckForUnusedVariables() const
{
return;
}
- const std::vector<std::string>& locals = this->Internal->LocalKeys();
- std::vector<std::string>::const_iterator it = locals.begin();
- for (; it != locals.end(); ++it)
+ const std::vector<std::string>& unused = this->Internal->UnusedKeys();
+ std::vector<std::string>::const_iterator it = unused.begin();
+ for (; it != unused.end(); ++it)
{
- this->CheckForUnused("out of scope", *it);
+ this->LogUnused("out of scope", *it);
}
}
void cmMakefile::MarkVariableAsUsed(const std::string& var)
{
- this->Internal->VarUsageStack.top().insert(var);
+ this->Internal->GetDefinition(var);
}
bool cmMakefile::VariableInitialized(const std::string& var) const
{
- if(this->Internal->VarInitStack.top().find(var) !=
- this->Internal->VarInitStack.top().end())
- {
- return true;
- }
- return false;
-}
-
-bool cmMakefile::VariableUsed(const std::string& var) const
-{
- if(this->Internal->VarUsageStack.top().find(var) !=
- this->Internal->VarUsageStack.top().end())
- {
- return true;
- }
- return false;
+ return this->Internal->IsInitialized(var);
}
-void cmMakefile::CheckForUnused(const char* reason,
+void cmMakefile::LogUnused(const char* reason,
const std::string& name) const
{
- if (this->WarnUnused && !this->VariableUsed(name))
+ if (this->WarnUnused)
{
std::string path;
cmListFileBacktrace bt(this->GetLocalGenerator());
@@ -1967,14 +1872,11 @@ void cmMakefile::CheckForUnused(const char* reason,
void cmMakefile::RemoveDefinition(const std::string& name)
{
- this->Internal->RemoveDefinition(name);
- if (!this->Internal->VarUsageStack.empty() &&
- this->VariableInitialized(name))
+ if (this->VariableInitialized(name))
{
- this->CheckForUnused("unsetting", name);
- this->Internal->VarUsageStack.top().erase(name);
+ this->LogUnused("unsetting", name);
}
- this->Internal->VarInitStack.top().insert(name);
+ this->Internal->RemoveDefinition(name);
#ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* vv = this->GetVariableWatch();
if ( vv )
@@ -2441,7 +2343,6 @@ const char* cmMakefile::GetRequiredDefinition(const std::string& name) const
bool cmMakefile::IsDefinitionSet(const std::string& name) const
{
const char* def = this->Internal->GetDefinition(name);
- this->Internal->VarUsageStack.top().insert(name);
if(!def)
{
def = this->GetState()->GetInitializedCacheValue(name);
@@ -2462,10 +2363,6 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const
const char* cmMakefile::GetDefinition(const std::string& name) const
{
- if (this->WarnUnused)
- {
- this->Internal->VarUsageStack.top().insert(name);
- }
const char* def = this->Internal->GetDefinition(name);
if(!def)
{
@@ -4364,7 +4261,7 @@ void cmMakefile::AddCMakeDependFilesFromUser()
}
}
-std::string cmMakefile::GetListFileStack() const
+std::string cmMakefile::FormatListFileStack() const
{
std::ostringstream tmp;
size_t depth = this->ListFileStack.size();
@@ -4393,10 +4290,6 @@ std::string cmMakefile::GetListFileStack() const
void cmMakefile::PushScope()
{
this->Internal->PushDefinitions();
- const std::set<std::string>& init = this->Internal->VarInitStack.top();
- const std::set<std::string>& usage = this->Internal->VarUsageStack.top();
- this->Internal->VarInitStack.push(init);
- this->Internal->VarUsageStack.push(usage);
this->PushLoopBlockBarrier();
@@ -4413,31 +4306,9 @@ void cmMakefile::PopScope()
this->PopLoopBlockBarrier();
- std::set<std::string> init = this->Internal->VarInitStack.top();
- std::set<std::string> usage = this->Internal->VarUsageStack.top();
- const std::vector<std::string>& locals = this->Internal->LocalKeys();
- // Remove initialization and usage information for variables in the local
- // scope.
- std::vector<std::string>::const_iterator it = locals.begin();
- for (; it != locals.end(); ++it)
- {
- init.erase(*it);
- if (!this->VariableUsed(*it))
- {
- this->CheckForUnused("out of scope", *it);
- }
- else
- {
- usage.erase(*it);
- }
- }
+ this->CheckForUnusedVariables();
this->Internal->PopDefinitions();
- this->Internal->VarInitStack.pop();
- this->Internal->VarUsageStack.pop();
- // Push initialization and usage up to the parent scope.
- this->Internal->VarInitStack.top().insert(init.begin(), init.end());
- this->Internal->VarUsageStack.top().insert(usage.begin(), usage.end());
}
void cmMakefile::RaiseScope(const std::string& var, const char *varDef)
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 82f2715..efd73a1 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -65,14 +65,10 @@ class cmMakefile
class Internals;
cmsys::auto_ptr<Internals> Internal;
public:
- /* Check for unused variables in this scope */
- void CheckForUnusedVariables() const;
/* Mark a variable as used */
void MarkVariableAsUsed(const std::string& var);
/* return true if a variable has been initialized */
bool VariableInitialized(const std::string& ) const;
- /* return true if a variable has been used */
- bool VariableUsed(const std::string& ) const;
/**
* Construct an empty makefile.
@@ -84,12 +80,7 @@ public:
*/
~cmMakefile();
- /**
- * Read and parse a CMakeLists.txt file.
- */
- bool ReadListFile(const char* listfile,
- bool noPolicyScope = true,
- bool requireProjectCommand = false);
+ bool ReadListFile(const char* listfile);
bool ReadDependentFile(const char* listfile, bool noPolicyScope = true);
@@ -162,11 +153,6 @@ public:
*/
void FinalPass();
- /**
- * Print the object state to std::cout.
- */
- void Print() const;
-
/** Add a custom command to the build. */
void AddCustomCommandToTarget(const std::string& target,
const std::vector<std::string>& byproducts,
@@ -418,14 +404,6 @@ public:
void SetCurrentBinaryDirectory(const std::string& dir);
const char* GetCurrentBinaryDirectory() const;
- /* Get the current CMakeLists.txt file that is being processed. This
- * is just used in order to be able to 'branch' from one file to a second
- * transparently */
- const char* GetCurrentListFile() const
- {
- return this->cmCurrentListFile.c_str();
- }
-
//@}
/**
@@ -588,7 +566,7 @@ public:
{ this->ListFiles.push_back(file);}
void AddCMakeDependFilesFromUser();
- std::string GetListFileStack() const;
+ std::string FormatListFileStack() const;
/**
* Get the current context backtrace.
@@ -843,9 +821,7 @@ protected:
void AddGlobalLinkInformation(const std::string& name, cmTarget& target);
// Check for a an unused variable
- void CheckForUnused(const char* reason, const std::string& name) const;
-
- std::string cmCurrentListFile;
+ void LogUnused(const char* reason, const std::string& name) const;
std::string ProjectName; // project name
@@ -912,6 +888,10 @@ private:
cmState::Snapshot StateSnapshot;
+ bool ReadListFile(const char* listfile,
+ bool noPolicyScope,
+ bool requireProjectCommand);
+
bool ReadListFileInternal(const char* filenametoread,
bool noPolicyScope,
bool requireProjectCommand);
@@ -923,10 +903,6 @@ private:
friend class cmMakeDepend; // make depend needs direct access
// to the Sources array
- void PrintStringVector(const char* s, const
- std::vector<std::pair<std::string, bool> >& v) const;
- void PrintStringVector(const char* s,
- const std::vector<std::string>& v) const;
void AddDefaultDefinitions();
typedef std::vector<cmFunctionBlocker*> FunctionBlockersType;
@@ -1062,6 +1038,8 @@ private:
bool HaveCxxStandardAvailable(cmTarget const* target,
const std::string& feature) const;
+ void CheckForUnusedVariables() const;
+
mutable bool SuppressWatches;
};
diff --git a/Source/cmTest.h b/Source/cmTest.h
index c6e7e42..ca88afe 100644
--- a/Source/cmTest.h
+++ b/Source/cmTest.h
@@ -40,11 +40,6 @@ public:
return this->Command;
}
- /**
- * Print the structure to std::cout.
- */
- void Print() const;
-
///! Set/Get a property of this source file
void SetProperty(const std::string& prop, const char *value);
void AppendProperty(const std::string& prop,
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index 3cd92cb..b9ffe5e 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -375,7 +375,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
comment += "Run arguments : ";
comment += runArgs;
comment += "\n";
- comment += " Called from: " + this->Makefile->GetListFileStack();
+ comment += " Called from: " + this->Makefile->FormatListFileStack();
cmsys::SystemTools::ReplaceString(comment, "\n", "\n# ");
file << comment << "\n\n";
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 577dcd9..e5f4700 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -130,7 +130,7 @@ static std::string cmakemainGetStack(void *clientdata)
cmMakefile* mf=cmakemainGetMakefile(clientdata);
if (mf)
{
- msg = mf->GetListFileStack();
+ msg = mf->FormatListFileStack();
if (!msg.empty())
{
msg = "\n Called from: " + msg;