[Cmake-commits] CMake branch, next, updated. v3.0.0-rc5-3329-gb012bca

Ben Boeckel ben.boeckel at kitware.com
Thu May 22 12:50:07 EDT 2014


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  b012bca18bd5680bc5a1eac950f2e867d1cb88ae (commit)
       via  4ded15208b63dcbb3a04bda6d488a4b8dce219e8 (commit)
       via  b8144963278002a81944e043235b3f766a2843f0 (commit)
      from  58563438a4c1a34d2a616c744efe9b9f8c37614d (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=b012bca18bd5680bc5a1eac950f2e867d1cb88ae
commit b012bca18bd5680bc5a1eac950f2e867d1cb88ae
Merge: 5856343 4ded152
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Thu May 22 12:50:06 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu May 22 12:50:06 2014 -0400

    Merge topic 'dev/backtrace-performance' into next
    
    4ded1520 cmListFileBacktrace: Add a MakeRelative method
    b8144963 cmMakefile: Convert to local paths in IssueMessage


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4ded15208b63dcbb3a04bda6d488a4b8dce219e8
commit 4ded15208b63dcbb3a04bda6d488a4b8dce219e8
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Fri Mar 21 21:14:43 2014 -0400
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Thu May 22 11:33:56 2014 -0400

    cmListFileBacktrace: Add a MakeRelative method
    
    This allows deferring backtraces until the moment when a relative path
    is actually necessary. Unfortunately, not only cmMakefile issues
    messages, so any caller of cmake::IssueMessage has to make the backtrace
    relative as well.

diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index eb62455..6f36940 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -386,15 +386,10 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
       e << "The dependency target \"" <<  dependee_name
         << "\" of target \"" << depender->GetName() << "\" does not exist.";
 
-      cmListFileBacktrace nullBacktrace;
-      cmListFileBacktrace const* backtrace =
+      cmListFileBacktrace backtrace =
         depender->GetUtilityBacktrace(dependee_name);
-      if(!backtrace)
-        {
-        backtrace = &nullBacktrace;
-        }
 
-      cm->IssueMessage(messageType, e.str(), *backtrace);
+      cm->IssueMessage(messageType, e.str(), backtrace);
       }
     }
 
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 6c8ebb6..647bbca 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -46,6 +46,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
       {
       cmOStringStream e;
       e << "given target \"" << te->GetName() << "\" more than once.";
+      this->Backtrace.MakeRelative();
       this->Makefile->GetCMakeInstance()
           ->IssueMessage(cmake::FATAL_ERROR, e.str(), this->Backtrace);
       return false;
@@ -317,6 +318,7 @@ cmExportBuildFileGenerator
   e << "If the required target is not easy to reference in this call, "
     << "consider using the APPEND option with multiple separate calls.";
 
+  this->Backtrace.MakeRelative();
   this->Makefile->GetCMakeInstance()
       ->IssueMessage(cmake::FATAL_ERROR, e.str(), this->Backtrace);
 }
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index 7f8e694..8882d5f 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -91,9 +91,11 @@ void cmGeneratorExpressionDAGChecker::ReportError(
       << "  " << expr << "\n"
       << "Self reference on target \""
       << context->HeadTarget->GetName() << "\".\n";
+    cmListFileBacktrace backtrace = parent->Backtrace;
+    backtrace.MakeRelative();
     context->Makefile->GetCMakeInstance()
       ->IssueMessage(cmake::FATAL_ERROR, e.str(),
-                      parent->Backtrace);
+                     backtrace);
     return;
     }
 
@@ -102,6 +104,7 @@ void cmGeneratorExpressionDAGChecker::ReportError(
   e << "Error evaluating generator expression:\n"
     << "  " << expr << "\n"
     << "Dependency loop found.";
+  context->Backtrace.MakeRelative();
   context->Makefile->GetCMakeInstance()
     ->IssueMessage(cmake::FATAL_ERROR, e.str(),
                     context->Backtrace);
@@ -115,9 +118,11 @@ void cmGeneratorExpressionDAGChecker::ReportError(
       << "  "
       << (parent->Content ? parent->Content->GetOriginalExpression() : expr)
       << "\n";
+    cmListFileBacktrace backtrace = parent->Backtrace;
+    backtrace.MakeRelative();
     context->Makefile->GetCMakeInstance()
       ->IssueMessage(cmake::FATAL_ERROR, e.str(),
-                      parent->Backtrace);
+                     backtrace);
     parent = parent->Parent;
     ++loopStep;
     }
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 0b357f6..33315c6 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -40,6 +40,7 @@ void reportError(cmGeneratorExpressionContext *context,
   e << "Error evaluating generator expression:\n"
     << "  " << expr << "\n"
     << result;
+  context->Backtrace.MakeRelative();
   context->Makefile->GetCMakeInstance()
     ->IssueMessage(cmake::FATAL_ERROR, e.str(),
                     context->Backtrace);
@@ -428,6 +429,7 @@ struct CompilerIdNode : public cmGeneratorExpressionNode
           cmOStringStream e;
           e << context->Makefile->GetPolicies()
                       ->GetPolicyWarning(cmPolicies::CMP0044);
+          context->Backtrace.MakeRelative();
           context->Makefile->GetCMakeInstance()
                  ->IssueMessage(cmake::AUTHOR_WARNING,
                                 e.str(), context->Backtrace);
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 34781d3..705666d 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -12,6 +12,7 @@
 #include "cmListFileCache.h"
 
 #include "cmListFileLexer.h"
+#include "cmLocalGenerator.h"
 #include "cmSystemTools.h"
 #include "cmMakefile.h"
 #include "cmVersion.h"
@@ -408,6 +409,23 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token,
 }
 
 //----------------------------------------------------------------------------
+void cmListFileBacktrace::MakeRelative()
+{
+  if (this->Relative)
+    {
+    return;
+    }
+  for (cmListFileBacktrace::iterator i = this->begin();
+       i != this->end(); ++i)
+    {
+    i->FilePath = this->LocalGenerator->Convert(i->FilePath,
+                                                cmLocalGenerator::HOME);
+    }
+  this->Relative = true;
+}
+
+
+//----------------------------------------------------------------------------
 std::ostream& operator<<(std::ostream& os, cmListFileContext const& lfc)
 {
   os << lfc.FilePath;
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index bede25e..5807364 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -14,6 +14,8 @@
 
 #include "cmStandardIncludes.h"
 
+class cmLocalGenerator;
+
 /** \class cmListFileCache
  * \brief A class to cache list file contents.
  *
@@ -66,7 +68,27 @@ struct cmListFileFunction: public cmListFileContext
   std::vector<cmListFileArgument> Arguments;
 };
 
-class cmListFileBacktrace: public std::vector<cmListFileContext> {};
+class cmListFileBacktrace: public std::vector<cmListFileContext>
+{
+  public:
+    cmListFileBacktrace()
+      : LocalGenerator(NULL)
+      , Relative(true)
+    {
+    }
+
+    void MakeRelative();
+  private:
+    friend class cmMakefile;
+    void SetLocalGenerator(cmLocalGenerator* generator)
+    {
+      this->LocalGenerator = generator;
+      this->Relative = false;
+    }
+
+    cmLocalGenerator* LocalGenerator;
+    bool Relative;
+};
 
 struct cmListFile
 {
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 63ea23c..2abe34c 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -316,13 +316,7 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
       this->CallStack.back().Status->SetNestedError(true);
       }
     this->GetBacktrace(backtrace);
-
-    for (cmListFileBacktrace::iterator i = backtrace.begin();
-         i != backtrace.end(); ++i)
-      {
-      i->FilePath = this->LocalGenerator->Convert(i->FilePath,
-                                                  cmLocalGenerator::HOME);
-      }
+    backtrace.MakeRelative();
     }
   else
     {
@@ -340,12 +334,12 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
       lfc.FilePath = this->ListFileStack.back();
       }
     lfc.Line = 0;
+    backtrace.push_back(lfc);
     if(!this->GetCMakeInstance()->GetIsInTryCompile())
       {
-      lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath,
-                                                   cmLocalGenerator::HOME);
+      backtrace.SetLocalGenerator(this->LocalGenerator);
+      backtrace.MakeRelative();
       }
-    backtrace.push_back(lfc);
     }
 
   // Issue the message.
@@ -359,6 +353,7 @@ bool cmMakefile::GetBacktrace(cmListFileBacktrace& backtrace) const
     {
     return false;
     }
+  backtrace.SetLocalGenerator(this->LocalGenerator);
   for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin();
       i != this->CallStack.rend(); ++i)
     {
@@ -1951,6 +1946,7 @@ void cmMakefile::CheckForUnused(const char* reason,
       {
       cmOStringStream msg;
       msg << "unused variable (" << reason << ") \'" << name << "\'";
+      bt.MakeRelative();
       this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING,
                                              msg.str(),
                                              bt);
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 15acfdd..922b70d 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -448,14 +448,16 @@ void cmTarget::AddUtility(const std::string& u, cmMakefile *makefile)
 }
 
 //----------------------------------------------------------------------------
-cmListFileBacktrace const* cmTarget::GetUtilityBacktrace(
+cmListFileBacktrace cmTarget::GetUtilityBacktrace(
     const std::string& u) const
 {
   std::map<std::string, cmListFileBacktrace>::const_iterator i =
     this->UtilityBacktraces.find(u);
-  if(i == this->UtilityBacktraces.end()) return 0;
+  if(i == this->UtilityBacktraces.end()) return cmListFileBacktrace();
 
-  return &i->second;
+  cmListFileBacktrace bt = i->second;
+  bt.MakeRelative();
+  return bt;
 }
 
 //----------------------------------------------------------------------------
@@ -490,6 +492,7 @@ void cmTarget::ClearLinkMaps()
 //----------------------------------------------------------------------------
 cmListFileBacktrace const& cmTarget::GetBacktrace() const
 {
+  this->Internal->Backtrace.MakeRelative();
   return this->Internal->Backtrace;
 }
 
@@ -643,10 +646,12 @@ static bool processSources(cmTarget const* tgt,
       }
     if (!usedSources.empty())
       {
+      cmListFileBacktrace bt = (*it)->ge->GetBacktrace();
+      bt.MakeRelative();
       mf->GetCMakeInstance()->IssueMessage(cmake::LOG,
                             std::string("Used sources for target ")
                             + tgt->GetName() + ":\n"
-                            + usedSources, (*it)->ge->GetBacktrace());
+                            + usedSources, bt);
       }
     }
   return contextDependent;
@@ -1333,9 +1338,10 @@ void cmTarget::GetTllSignatureTraces(cmOStringStream &s,
                                                                 : "plain");
     s << "The uses of the " << sigString << " signature are here:\n";
     std::set<std::string> emitted;
-    for(std::vector<cmListFileBacktrace>::const_iterator it = sigs.begin();
+    for(std::vector<cmListFileBacktrace>::iterator it = sigs.begin();
         it != sigs.end(); ++it)
       {
+      it->MakeRelative();
       cmListFileBacktrace::const_iterator i = it->begin();
       if(i != it->end())
         {
@@ -2224,10 +2230,12 @@ static void processIncludeDirectories(cmTarget const* tgt,
       }
     if (!usedIncludes.empty())
       {
+      cmListFileBacktrace bt = (*it)->ge->GetBacktrace();
+      bt.MakeRelative();
       mf->GetCMakeInstance()->IssueMessage(cmake::LOG,
                             std::string("Used includes for target ")
                             + tgt->GetName() + ":\n"
-                            + usedIncludes, (*it)->ge->GetBacktrace());
+                            + usedIncludes, bt);
       }
     }
 }
@@ -2414,11 +2422,13 @@ static void processCompileOptionsInternal(cmTarget const* tgt,
       }
     if (!usedOptions.empty())
       {
+      cmListFileBacktrace bt = (*it)->ge->GetBacktrace();
+      bt.MakeRelative();
       mf->GetCMakeInstance()->IssueMessage(cmake::LOG,
                             std::string("Used compile ") + logName
                             + std::string(" for target ")
                             + tgt->GetName() + ":\n"
-                            + usedOptions, (*it)->ge->GetBacktrace());
+                            + usedOptions, bt);
       }
     }
 }
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 2d51835..45f16ec 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -221,7 +221,7 @@ public:
   void AddUtility(const std::string& u, cmMakefile *makefile = 0);
   ///! Get the utilities used by this target
   std::set<std::string>const& GetUtilities() const { return this->Utilities; }
-  cmListFileBacktrace const* GetUtilityBacktrace(const std::string& u) const;
+  cmListFileBacktrace GetUtilityBacktrace(const std::string& u) const;
 
   /** Finalize the target at the end of the Configure step.  */
   void FinishConfigure();
diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx
index 28a7bb1..38c8e99 100644
--- a/Source/cmTest.cxx
+++ b/Source/cmTest.cxx
@@ -34,6 +34,7 @@ cmTest::~cmTest()
 //----------------------------------------------------------------------------
 cmListFileBacktrace const& cmTest::GetBacktrace() const
 {
+  this->Backtrace->MakeRelative();
   return *this->Backtrace;
 }
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b8144963278002a81944e043235b3f766a2843f0
commit b8144963278002a81944e043235b3f766a2843f0
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Wed Mar 12 17:59:42 2014 -0400
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Thu May 22 11:33:56 2014 -0400

    cmMakefile: Convert to local paths in IssueMessage
    
    This is the only place we care show the FilePath to the user, so defer
    the expensive relative path calculation until here.

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 9f33b92..63ea23c 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -316,6 +316,13 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
       this->CallStack.back().Status->SetNestedError(true);
       }
     this->GetBacktrace(backtrace);
+
+    for (cmListFileBacktrace::iterator i = backtrace.begin();
+         i != backtrace.end(); ++i)
+      {
+      i->FilePath = this->LocalGenerator->Convert(i->FilePath,
+                                                  cmLocalGenerator::HOME);
+      }
     }
   else
     {
@@ -355,10 +362,7 @@ bool cmMakefile::GetBacktrace(cmListFileBacktrace& backtrace) const
   for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin();
       i != this->CallStack.rend(); ++i)
     {
-    cmListFileContext lfc = *(*i).Context;
-    lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath,
-                                                 cmLocalGenerator::HOME);
-    backtrace.push_back(lfc);
+    backtrace.push_back(*i->Context);
     }
   return true;
 }

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

Summary of changes:
 Source/cmComputeTargetDepends.cxx          |    9 ++-------
 Source/cmExportBuildFileGenerator.cxx      |    2 ++
 Source/cmGeneratorExpressionDAGChecker.cxx |    9 +++++++--
 Source/cmGeneratorExpressionEvaluator.cxx  |    2 ++
 Source/cmListFileCache.cxx                 |   18 ++++++++++++++++++
 Source/cmListFileCache.h                   |   24 +++++++++++++++++++++++-
 Source/cmMakefile.cxx                      |   14 +++++++-------
 Source/cmTarget.cxx                        |   24 +++++++++++++++++-------
 Source/cmTarget.h                          |    2 +-
 Source/cmTest.cxx                          |    1 +
 10 files changed, 80 insertions(+), 25 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list