[Cmake-commits] CMake branch, next, updated. v2.8.2-901-g25fa779

Ben Boeckel ben.boeckel at kitware.com
Wed Sep 22 13:24:11 EDT 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  25fa779ceb16ce2f0c2d92b02ac8267285f7dccb (commit)
       via  5d30cfc5f70e9bf7f604a64ca47d4c5cd213d11f (commit)
       via  33c63b19ab4f192f95c72735d810ef3921370d1f (commit)
       via  535253f38598d6dd46aca944a82cfe1684b2f07f (commit)
       via  cbb286c0b25e806d817ceb540312f34a7e1aa9a5 (commit)
       via  62be1f78aea0f38e245e7f8b748a24f95eadb37a (commit)
       via  c6e7fabc0f3563a258b8b3e10757e1916d680db0 (commit)
      from  81978d71437d863ebe9834cb3cea77c846fde17d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=25fa779ceb16ce2f0c2d92b02ac8267285f7dccb
commit 25fa779ceb16ce2f0c2d92b02ac8267285f7dccb
Merge: 81978d7 5d30cfc
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Wed Sep 22 13:24:08 2010 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Sep 22 13:24:08 2010 -0400

    Merge topic 'dev/strict-mode' into next
    
    5d30cfc Set a watch on variables added through the gui
    33c63b1 Add a method to put a watch for variables
    535253f Initialize the warning variables earlier
    cbb286c Fix the path detection to work for top-level
    62be1f7 Initialize the usage stack earlier
    c6e7fab Factor out the checks for unused variables


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5d30cfc5f70e9bf7f604a64ca47d4c5cd213d11f
commit 5d30cfc5f70e9bf7f604a64ca47d4c5cd213d11f
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Wed Sep 22 12:43:15 2010 -0400
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Wed Sep 22 12:46:16 2010 -0400

    Set a watch on variables added through the gui

diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index c319cb4..48871c2 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -249,6 +249,8 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
   // add some new properites
   foreach(QCMakeProperty s, props)
     {
+    this->CMakeInstance->WatchUnusedCli(s.Key.toAscii().data());
+
     if(s.Type == QCMakeProperty::BOOL)
       {
       this->CMakeInstance->AddCacheEntry(s.Key.toAscii().data(),

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=33c63b19ab4f192f95c72735d810ef3921370d1f
commit 33c63b19ab4f192f95c72735d810ef3921370d1f
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Wed Sep 22 12:42:49 2010 -0400
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Wed Sep 22 12:46:16 2010 -0400

    Add a method to put a watch for variables

diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 007f52d..cb68f22 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -380,10 +380,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
           "No help, variable specified on the command line.", type);
         if(this->WarnUnusedCli)
           {
-#ifdef CMAKE_BUILD_WITH_CMAKE
-          this->VariableWatch->AddWatch(var, cmWarnUnusedCliWarning, this);
-          this->UsedCliVariables[var] = false;
-#endif
+          this->WatchUnusedCli(var.c_str());
           }
         }
       else
@@ -4488,6 +4485,14 @@ int cmake::Build(const std::string& dir,
                     0, nativeOptions);
 }
 
+void cmake::WatchUnusedCli(const char* var)
+{
+#ifdef CMAKE_BUILD_WITH_CMAKE
+  this->VariableWatch->AddWatch(var, cmWarnUnusedCliWarning, this);
+  this->UsedCliVariables[var] = false;
+#endif
+}
+
 void cmake::RunCheckForUnusedVariables() const
 {
 #ifdef CMAKE_BUILD_WITH_CMAKE
diff --git a/Source/cmake.h b/Source/cmake.h
index 4277bdd..72effd3 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -363,6 +363,7 @@ class cmake
             const std::vector<std::string>& nativeOptions,
             bool clean);
 
+  void WatchUnusedCli(const char* var);
   void RunCheckForUnusedVariables() const;
 protected:
   void InitializeProperties();

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=535253f38598d6dd46aca944a82cfe1684b2f07f
commit 535253f38598d6dd46aca944a82cfe1684b2f07f
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Wed Sep 22 12:42:26 2010 -0400
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Wed Sep 22 12:46:15 2010 -0400

    Initialize the warning variables earlier

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 57c354f..86aca5a 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -56,6 +56,10 @@ cmMakefile::cmMakefile(): Internal(new Internals)
   this->Internal->VarInitStack.push(globalKeys);
   this->Internal->VarUsageStack.push(globalKeys);
 
+  // Initialize these first since AddDefaultDefinitions calls AddDefinition
+  this->WarnUnused = false;
+  this->CheckSystemVars = false;
+
   // Setup the default include file regular expression (match everything).
   this->IncludeFileRegularExpression = "^.*$";
   // Setup the default include complaint regular expression (match nothing).
@@ -92,8 +96,6 @@ cmMakefile::cmMakefile(): Internal(new Internals)
   this->AddDefaultDefinitions();
   this->Initialize();
   this->PreOrder = false;
-  this->WarnUnused = false;
-  this->CheckSystemVars = false;
 }
 
 cmMakefile::cmMakefile(const cmMakefile& mf): Internal(new Internals)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cbb286c0b25e806d817ceb540312f34a7e1aa9a5
commit cbb286c0b25e806d817ceb540312f34a7e1aa9a5
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Wed Sep 22 12:41:58 2010 -0400
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Wed Sep 22 12:46:15 2010 -0400

    Fix the path detection to work for top-level

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 70d3495..57c354f 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1774,17 +1774,30 @@ bool cmMakefile::VariableUsed(const char* var) const
 
 void cmMakefile::CheckForUnused(const char* reason, const char* name) const
 {
-  if (this->WarnUnused && !this->VariableUsed(name) && this->CallStack.size())
+  if (this->WarnUnused && !this->VariableUsed(name))
     {
-    const cmListFileContext* file = this->CallStack.back().Context;
+    cmStdString path;
+    int line;
+    if (this->CallStack.size())
+      {
+      const cmListFileContext* file = this->CallStack.back().Context;
+      path = file->FilePath.c_str();
+      line = file->Line;
+      }
+    else
+      {
+      path = this->GetStartDirectory();
+      path += "/CMakeLists.txt";
+      line = 0;
+      }
     if (this->CheckSystemVars ||
-        cmSystemTools::IsSubDirectory(file->FilePath.c_str(),
+        cmSystemTools::IsSubDirectory(path.c_str(),
                                       this->GetHomeDirectory()) ||
-        cmSystemTools::IsSubDirectory(file->FilePath.c_str(),
+        cmSystemTools::IsSubDirectory(path.c_str(),
                                       this->GetHomeOutputDirectory()))
       {
       cmOStringStream msg;
-      msg << file->FilePath << ":" << file->Line << ":" <<
+      msg << path << ":" << line << ":" <<
         " warning: (" << reason << ") unused variable \'" << name << "\'";
       cmSystemTools::Message(msg.str().c_str());
       }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=62be1f78aea0f38e245e7f8b748a24f95eadb37a
commit 62be1f78aea0f38e245e7f8b748a24f95eadb37a
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Wed Sep 22 12:41:29 2010 -0400
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Wed Sep 22 12:46:15 2010 -0400

    Initialize the usage stack earlier

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 5aa643c..70d3495 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -54,6 +54,7 @@ cmMakefile::cmMakefile(): Internal(new Internals)
   const std::set<cmStdString> globalKeys = defs.LocalKeys();
   this->Internal->VarStack.push(defs);
   this->Internal->VarInitStack.push(globalKeys);
+  this->Internal->VarUsageStack.push(globalKeys);
 
   // Setup the default include file regular expression (match everything).
   this->IncludeFileRegularExpression = "^.*$";
@@ -775,20 +776,7 @@ void cmMakefile::SetLocalGenerator(cmLocalGenerator* lg)
   this->AddSourceGroup("Resources", "\\.plist$");
 #endif
 
-  if (this->Internal->VarUsageStack.empty())
-    {
-    const cmDefinitions& defs = cmDefinitions();
-    const std::set<cmStdString> globalKeys = defs.LocalKeys();
-    this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused();
-    if (this->WarnUnused)
-      {
-      this->Internal->VarUsageStack.push(globalKeys);
-      }
-    else
-      {
-      this->Internal->VarUsageStack.push(std::set<cmStdString>());
-      }
-    }
+  this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused();
   this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars();
 }
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c6e7fabc0f3563a258b8b3e10757e1916d680db0
commit c6e7fabc0f3563a258b8b3e10757e1916d680db0
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Wed Sep 22 12:40:43 2010 -0400
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Wed Sep 22 12:46:15 2010 -0400

    Factor out the checks for unused variables

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index a9faa6b..5aa643c 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -178,15 +178,9 @@ bool cmMakefile::NeedCacheCompatibility(int major, int minor)
 
 cmMakefile::~cmMakefile()
 {
-  std::set<cmStdString> usage = this->Internal->VarUsageStack.top();
-  std::set<cmStdString>::const_iterator it = usage.begin();
-  for (; it != usage.end(); ++it)
-    {
-    if (!this->VariableUsed(it->c_str()))
-      {
-      this->CheckForUnused("out of scope", it->c_str());
-      }
-    }
+  // Check for unused variables
+  this->CheckForUnusedVariables();
+
   for(std::vector<cmInstallGenerator*>::iterator
         i = this->InstallGenerators.begin();
       i != this->InstallGenerators.end(); ++i)
@@ -713,6 +707,9 @@ bool cmMakefile::ReadListFile(const char* filename_in,
   // pop the listfile off the stack
   this->ListFileStack.pop_back();
 
+  // Check for unused variables
+  this->CheckForUnusedVariables();
+
   return true;
 }
 
@@ -1751,6 +1748,17 @@ void cmMakefile::AddDefinition(const char* name, bool value)
 #endif
 }
 
+void cmMakefile::CheckForUnusedVariables() const
+{
+  const cmDefinitions& defs = this->Internal->VarStack.top();
+  const std::set<cmStdString>& locals = defs.LocalKeys();
+  std::set<cmStdString>::const_iterator it = locals.begin();
+  for (; it != locals.end(); ++it)
+    {
+    this->CheckForUnused("out of scope", it->c_str());
+    }
+}
+
 void cmMakefile::MarkVariableAsUsed(const char* var)
 {
   this->Internal->VarUsageStack.top().insert(var);
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 9d9606d..240a9cf 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -61,6 +61,8 @@ public:
   unsigned int GetCacheMajorVersion();
   unsigned int GetCacheMinorVersion();
 
+  /* Check for unused variables in this scope */
+  void CheckForUnusedVariables() const;
   /* Mark a variable as used */
   void MarkVariableAsUsed(const char* var);
   /* return true if a variable has been initialized */

-----------------------------------------------------------------------

Summary of changes:
 Source/QtDialog/QCMake.cxx |    2 +
 Source/cmMakefile.cxx      |   71 +++++++++++++++++++++++++------------------
 Source/cmMakefile.h        |    2 +
 Source/cmake.cxx           |   13 +++++--
 Source/cmake.h             |    1 +
 5 files changed, 55 insertions(+), 34 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list