[Cmake-commits] CMake branch, next, updated. v3.2.2-2935-g10b353d

Stephen Kelly steveire at gmail.com
Mon May 18 18:02:35 EDT 2015


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  10b353d5796d2ba4b4c79a06e3c6a5ad38df155f (commit)
       via  61d52e6e77bef903225bd3bad3e381bac73ee557 (commit)
       via  a271f7f17707c50744c2dbeb20ae82b10c886f4f (commit)
       via  f4300cd4dd46560c95203bad4a386c5db0bda2cd (commit)
       via  65a42849639a3268f613795683d7c91a6ed8b661 (commit)
       via  9645cba3bfc4bd583259130fd7e63da0c8bbecca (commit)
       via  52a8d19c9b67e5c902155f52fc7d145e091a5e7d (commit)
       via  59ba1215b936b04fa5c5e8041eae14a754911cb4 (commit)
       via  18f810a8659ea257c28d81b17aa3664f3d6f43e6 (commit)
       via  e96b5d14f9f3500b2221e9afedfacabb0a56bb4c (commit)
       via  7eb0dfa0622afe078c2e131ee1cbad293960b634 (commit)
       via  f9785e0cb6c823849bb344e487d9e70d9fdaddb4 (commit)
       via  e17b5e426294dc5cc86ba31dfd4d4acc553c0c72 (commit)
       via  1ec1bf9f071ce930094171ab45f2dbc02c57927b (commit)
       via  9b4aefad41218866e392021b6d7239b2eeb50390 (commit)
      from  d9381a207a516d678a4b634cafb239a36bdda899 (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=10b353d5796d2ba4b4c79a06e3c6a5ad38df155f
commit 10b353d5796d2ba4b4c79a06e3c6a5ad38df155f
Merge: d9381a2 61d52e6
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon May 18 18:02:28 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon May 18 18:02:28 2015 -0400

    Merge topic 'minor-cleanups' into next
    
    61d52e6e cmListFileBacktrace: Hide the context-stack implementation detail.
    a271f7f1 cmTarget: Simplify CMP0023 message loop.
    f4300cd4 cmTarget: Simplify output computation.
    65a42849 cmTarget: Store context in stack only if different.
    9645cba3 cmListFileContext: Implement EqualityComparable.
    52a8d19c cmTarget: Store only cmListFileContext for CMP0023 handling.
    59ba1215 cmTarget: Remove needless iteration.
    18f810a8 cmListFileContext: Sort by line before file.
    e96b5d14 cmListFileContext: Implement LessThanComparable.
    7eb0dfa0 cmMakefile: Use std::set::insert API to simplify CMP0054 handling.
    f9785e0c cmMakefile: Simplify CMP0054 handling.
    e17b5e42 cmMakefile: Add access to the top-level execution context.
    1ec1bf9f if(): Test the effect of cmMakefileCall use in elseif() handling.
    9b4aefad cmMakefile: Replace deques with vectors.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=61d52e6e77bef903225bd3bad3e381bac73ee557
commit 61d52e6e77bef903225bd3bad3e381bac73ee557
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon May 18 21:33:38 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon May 18 23:56:00 2015 +0200

    cmListFileBacktrace: Hide the context-stack implementation detail.
    
    The backtrace will soon not be implemented in terms of a stack of
    cmListFileContext objects.  Keep the cmListFileContext in the API
    for convenience for now.

diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index 0d1c86d..c816c23 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -143,7 +143,7 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
         cmListFileContext lfc;
         lfc.FilePath = this->FileName;
         lfc.Line = this->FileLine;
-        bt.push_back(lfc);
+        bt.Append(lfc);
         msg << "uninitialized variable \'" << var << "\'";
         this->Makefile->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING,
                                                         msg.str(), bt);
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 3e3d708..2756cd2 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -400,6 +400,11 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token,
     }
 }
 
+void cmListFileBacktrace::Append(cmListFileContext const& context)
+{
+  this->push_back(context);
+}
+
 //----------------------------------------------------------------------------
 void cmListFileBacktrace::MakeRelative()
 {
@@ -416,6 +421,31 @@ void cmListFileBacktrace::MakeRelative()
   this->Relative = true;
 }
 
+void cmListFileBacktrace::PrintTitle(std::ostream& out)
+{
+  if (this->empty())
+    {
+    return;
+    }
+  out << (this->front().Line ? " at " : " in ") << this->front();
+}
+
+void cmListFileBacktrace::PrintCallStack(std::ostream& out)
+{
+  if (size() <= 1)
+    {
+    return;
+    }
+
+  const_iterator i = this->begin() + 1;
+  out << "Call Stack (most recent call first):\n";
+  while(i != this->end())
+    {
+    cmListFileContext const& lfc = *i;
+    out << "  " << lfc << "\n";
+    ++i;
+    }
+}
 
 //----------------------------------------------------------------------------
 std::ostream& operator<<(std::ostream& os, cmListFileContext const& lfc)
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index d7e29d9..4a1d181 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -71,7 +71,7 @@ struct cmListFileFunction: public cmListFileContext
   std::vector<cmListFileArgument> Arguments;
 };
 
-class cmListFileBacktrace: public std::vector<cmListFileContext>
+class cmListFileBacktrace: private std::vector<cmListFileContext>
 {
   public:
     cmListFileBacktrace(cmLocalGenerator* localGen)
@@ -80,7 +80,12 @@ class cmListFileBacktrace: public std::vector<cmListFileContext>
     {
     }
 
+    void Append(cmListFileContext const& context);
+
     void MakeRelative();
+
+    void PrintTitle(std::ostream& out);
+    void PrintCallStack(std::ostream& out);
   private:
     cmLocalGenerator* LocalGenerator;
     bool Relative;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 8631d73..0d5a431 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -358,7 +358,7 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
       lfc.FilePath = this->ListFileStack.back();
       }
     lfc.Line = 0;
-    backtrace.push_back(lfc);
+    backtrace.Append(lfc);
     }
 
   // Issue the message.
@@ -372,7 +372,7 @@ cmListFileBacktrace cmMakefile::GetBacktrace() const
   for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin();
       i != this->CallStack.rend(); ++i)
     {
-    backtrace.push_back(*i->Context);
+    backtrace.Append(*i->Context);
     }
   return backtrace;
 }
@@ -1944,7 +1944,7 @@ void cmMakefile::CheckForUnused(const char* reason,
     if (!this->CallStack.empty())
       {
       cmListFileContext file = this->GetExecutionContext();
-      bt.push_back(file);
+      bt.Append(file);
       path = file.FilePath;
       }
     else
@@ -1954,7 +1954,7 @@ void cmMakefile::CheckForUnused(const char* reason,
       cmListFileContext lfc;
       lfc.FilePath = path;
       lfc.Line = 0;
-      bt.push_back(lfc);
+      bt.Append(lfc);
       }
     if (this->CheckSystemVars ||
         cmSystemTools::IsSubDirectory(path,
@@ -2884,7 +2884,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
                 cmListFileContext lfc;
                 lfc.FilePath = filename;
                 lfc.Line = line;
-                bt.push_back(lfc);
+                bt.Append(lfc);
                 msg << "uninitialized variable \'" << lookup << "\'";
                 this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING,
                                                        msg.str(), bt);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 5c5c428..e447105 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2485,13 +2485,7 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
     }
 
   // Add the immediate context.
-  cmListFileBacktrace::const_iterator i = backtrace.begin();
-  if(i != backtrace.end())
-    {
-    cmListFileContext const& lfc = *i;
-    msg << (lfc.Line? " at ": " in ") << lfc;
-    ++i;
-    }
+  backtrace.PrintTitle(msg);
 
   // Add the message text.
   {
@@ -2502,16 +2496,7 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
   }
 
   // Add the rest of the context.
-  if(i != backtrace.end())
-    {
-    msg << "Call Stack (most recent call first):\n";
-    while(i != backtrace.end())
-      {
-      cmListFileContext const& lfc = *i;
-      msg << "  " << lfc << "\n";
-      ++i;
-      }
-    }
+  backtrace.PrintCallStack(msg);
 
   // Add a note about warning suppression.
   if(t == cmake::AUTHOR_WARNING)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a271f7f17707c50744c2dbeb20ae82b10c886f4f
commit a271f7f17707c50744c2dbeb20ae82b10c886f4f
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon May 18 22:10:59 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon May 18 23:55:44 2015 +0200

    cmTarget: Simplify CMP0023 message loop.
    
    This method is only called if there is a mismatch and something to
    print.  Remove intermediate container.

diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index e705aaa..8feb7a5 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1251,27 +1251,17 @@ bool cmTarget::PushTLLCommandTrace(TLLSignature signature)
 void cmTarget::GetTllSignatureTraces(std::ostringstream &s,
                                      TLLSignature sig) const
 {
-  std::vector<cmListFileContext> sigs;
+  const char *sigString = (sig == cmTarget::KeywordTLLSignature ? "keyword"
+                                                                : "plain");
+  s << "The uses of the " << sigString << " signature are here:\n";
   typedef std::vector<std::pair<TLLSignature, cmListFileContext> > Container;
+  cmLocalGenerator* lg = this->GetMakefile()->GetLocalGenerator();
   for(Container::const_iterator it = this->TLLCommands.begin();
       it != this->TLLCommands.end(); ++it)
     {
     if (it->first == sig)
       {
-      sigs.push_back(it->second);
-      }
-    }
-  cmLocalGenerator* lg = this->GetMakefile()->GetLocalGenerator();
-  if (!sigs.empty())
-    {
-    const char *sigString
-                        = (sig == cmTarget::KeywordTLLSignature ? "keyword"
-                                                                : "plain");
-    s << "The uses of the " << sigString << " signature are here:\n";
-    for(std::vector<cmListFileContext>::iterator it = sigs.begin();
-        it != sigs.end(); ++it)
-      {
-      cmListFileContext lfc = *it;
+      cmListFileContext lfc = it->second;
       lfc.FilePath = lg->Convert(lfc.FilePath, cmLocalGenerator::HOME);
       s << " * " << lfc << std::endl;
       }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f4300cd4dd46560c95203bad4a386c5db0bda2cd
commit f4300cd4dd46560c95203bad4a386c5db0bda2cd
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon May 18 22:07:52 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon May 18 23:55:44 2015 +0200

    cmTarget: Simplify output computation.
    
    We always have line information for contexts resulting from
    command execution.

diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index aa556c8..e705aaa 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1273,7 +1273,7 @@ void cmTarget::GetTllSignatureTraces(std::ostringstream &s,
       {
       cmListFileContext lfc = *it;
       lfc.FilePath = lg->Convert(lfc.FilePath, cmLocalGenerator::HOME);
-      s << " * " << (lfc.Line ? "" : " in ") << lfc << std::endl;
+      s << " * " << lfc << std::endl;
       }
     }
 }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=65a42849639a3268f613795683d7c91a6ed8b661
commit 65a42849639a3268f613795683d7c91a6ed8b661
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon May 18 22:05:36 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon May 18 23:55:44 2015 +0200

    cmTarget: Store context in stack only if different.
    
    The PushTLLCommandTrace method is called once per link item for a single
    target_link_libraries command.  Avoid storing copies of identical
    execution contexts and rely on the uniqueness while printing output.

diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index ee5f02d..aa556c8 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1240,7 +1240,10 @@ bool cmTarget::PushTLLCommandTrace(TLLSignature signature)
       }
     }
   cmListFileContext lfc = this->Makefile->GetExecutionContext();
-  this->TLLCommands.push_back(std::make_pair(signature, lfc));
+  if (this->TLLCommands.empty() || this->TLLCommands.back().second != lfc)
+    {
+    this->TLLCommands.push_back(std::make_pair(signature, lfc));
+    }
   return ret;
 }
 
@@ -1265,18 +1268,12 @@ void cmTarget::GetTllSignatureTraces(std::ostringstream &s,
                         = (sig == cmTarget::KeywordTLLSignature ? "keyword"
                                                                 : "plain");
     s << "The uses of the " << sigString << " signature are here:\n";
-    UNORDERED_SET<std::string> emitted;
     for(std::vector<cmListFileContext>::iterator it = sigs.begin();
         it != sigs.end(); ++it)
       {
       cmListFileContext lfc = *it;
       lfc.FilePath = lg->Convert(lfc.FilePath, cmLocalGenerator::HOME);
-      std::ostringstream line;
-      line << " * " << (lfc.Line? "": " in ") << lfc << std::endl;
-      if (emitted.insert(line.str()).second)
-        {
-        s << line.str();
-        }
+      s << " * " << (lfc.Line ? "" : " in ") << lfc << std::endl;
       }
     }
 }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9645cba3bfc4bd583259130fd7e63da0c8bbecca
commit 9645cba3bfc4bd583259130fd7e63da0c8bbecca
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon May 18 21:51:42 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon May 18 23:55:44 2015 +0200

    cmListFileContext: Implement EqualityComparable.

diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 650e2e5..3e3d708 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -440,3 +440,13 @@ bool operator<(const cmListFileContext& lhs, const cmListFileContext& rhs)
     }
   return lhs.FilePath < rhs.FilePath;
 }
+
+bool operator==(const cmListFileContext& lhs, const cmListFileContext& rhs)
+{
+  return lhs.Line == rhs.Line && lhs.FilePath == rhs.FilePath;
+}
+
+bool operator!=(const cmListFileContext& lhs, const cmListFileContext& rhs)
+{
+  return !(lhs == rhs);
+}
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index da89016..d7e29d9 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -63,6 +63,8 @@ struct cmListFileContext
 
 std::ostream& operator<<(std::ostream&, cmListFileContext const&);
 bool operator<(const cmListFileContext& lhs, const cmListFileContext& rhs);
+bool operator==(cmListFileContext const& lhs, cmListFileContext const& rhs);
+bool operator!=(cmListFileContext const& lhs, cmListFileContext const& rhs);
 
 struct cmListFileFunction: public cmListFileContext
 {

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=52a8d19c9b67e5c902155f52fc7d145e091a5e7d
commit 52a8d19c9b67e5c902155f52fc7d145e091a5e7d
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon May 18 21:59:18 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon May 18 23:55:43 2015 +0200

    cmTarget: Store only cmListFileContext for CMP0023 handling.
    
    Only the top level execution context is shown, as appropriate, so
    store only that.

diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index d450a81..ee5f02d 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1239,8 +1239,8 @@ bool cmTarget::PushTLLCommandTrace(TLLSignature signature)
       ret = false;
       }
     }
-  cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
-  this->TLLCommands.push_back(std::make_pair(signature, lfbt));
+  cmListFileContext lfc = this->Makefile->GetExecutionContext();
+  this->TLLCommands.push_back(std::make_pair(signature, lfc));
   return ret;
 }
 
@@ -1248,8 +1248,8 @@ bool cmTarget::PushTLLCommandTrace(TLLSignature signature)
 void cmTarget::GetTllSignatureTraces(std::ostringstream &s,
                                      TLLSignature sig) const
 {
-  std::vector<cmListFileBacktrace> sigs;
-  typedef std::vector<std::pair<TLLSignature, cmListFileBacktrace> > Container;
+  std::vector<cmListFileContext> sigs;
+  typedef std::vector<std::pair<TLLSignature, cmListFileContext> > Container;
   for(Container::const_iterator it = this->TLLCommands.begin();
       it != this->TLLCommands.end(); ++it)
     {
@@ -1258,6 +1258,7 @@ void cmTarget::GetTllSignatureTraces(std::ostringstream &s,
       sigs.push_back(it->second);
       }
     }
+  cmLocalGenerator* lg = this->GetMakefile()->GetLocalGenerator();
   if (!sigs.empty())
     {
     const char *sigString
@@ -1265,20 +1266,16 @@ void cmTarget::GetTllSignatureTraces(std::ostringstream &s,
                                                                 : "plain");
     s << "The uses of the " << sigString << " signature are here:\n";
     UNORDERED_SET<std::string> emitted;
-    for(std::vector<cmListFileBacktrace>::iterator it = sigs.begin();
+    for(std::vector<cmListFileContext>::iterator it = sigs.begin();
         it != sigs.end(); ++it)
       {
-      it->MakeRelative();
-      cmListFileBacktrace::const_iterator i = it->begin();
-      if(i != it->end())
+      cmListFileContext lfc = *it;
+      lfc.FilePath = lg->Convert(lfc.FilePath, cmLocalGenerator::HOME);
+      std::ostringstream line;
+      line << " * " << (lfc.Line? "": " in ") << lfc << std::endl;
+      if (emitted.insert(line.str()).second)
         {
-        cmListFileContext const& lfc = *i;
-        std::ostringstream line;
-        line << " * " << (lfc.Line? "": " in ") << lfc << std::endl;
-        if (emitted.insert(line.str()).second)
-          {
-          s << line.str();
-          }
+        s << line.str();
         }
       }
     }
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index a032414..c5e9fc4 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -641,7 +641,7 @@ private:
   // directories.
   std::set<std::string> SystemIncludeDirectories;
 
-  std::vector<std::pair<TLLSignature, cmListFileBacktrace> > TLLCommands;
+  std::vector<std::pair<TLLSignature, cmListFileContext> > TLLCommands;
 
 #if defined(_WIN32) && !defined(__CYGWIN__)
   /**

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=59ba1215b936b04fa5c5e8041eae14a754911cb4
commit 59ba1215b936b04fa5c5e8041eae14a754911cb4
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon May 18 21:57:31 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon May 18 23:55:43 2015 +0200

    cmTarget: Remove needless iteration.
    
    This is not a loop.

diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 8a8c163..d450a81 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1279,7 +1279,6 @@ void cmTarget::GetTllSignatureTraces(std::ostringstream &s,
           {
           s << line.str();
           }
-        ++i;
         }
       }
     }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=18f810a8659ea257c28d81b17aa3664f3d6f43e6
commit 18f810a8659ea257c28d81b17aa3664f3d6f43e6
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon May 18 21:46:50 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon May 18 23:55:43 2015 +0200

    cmListFileContext: Sort by line before file.
    
    This should be much faster.  In the context where it is used the
    line comparison should be sufficient, removing the need to compare
    files at all.

diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index d8d339a..650e2e5 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -434,8 +434,9 @@ std::ostream& operator<<(std::ostream& os, cmListFileContext const& lfc)
 
 bool operator<(const cmListFileContext& lhs, const cmListFileContext& rhs)
 {
-  if(lhs.FilePath != rhs.FilePath)
-    return lhs.FilePath < rhs.FilePath;
-
-  return lhs.Line < rhs.Line;
+  if(lhs.Line != rhs.Line)
+    {
+    return lhs.Line < rhs.Line;
+    }
+  return lhs.FilePath < rhs.FilePath;
 }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e96b5d14f9f3500b2221e9afedfacabb0a56bb4c
commit e96b5d14f9f3500b2221e9afedfacabb0a56bb4c
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon May 18 21:44:14 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon May 18 23:55:43 2015 +0200

    cmListFileContext: Implement LessThanComparable.
    
    Move wrapping existing code from cmMakefile, and simplify the
    implementation there.

diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index ddcea9b..d8d339a 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -431,3 +431,11 @@ std::ostream& operator<<(std::ostream& os, cmListFileContext const& lfc)
     }
   return os;
 }
+
+bool operator<(const cmListFileContext& lhs, const cmListFileContext& rhs)
+{
+  if(lhs.FilePath != rhs.FilePath)
+    return lhs.FilePath < rhs.FilePath;
+
+  return lhs.Line < rhs.Line;
+}
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index 544ff1b..da89016 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -62,6 +62,7 @@ struct cmListFileContext
 };
 
 std::ostream& operator<<(std::ostream&, cmListFileContext const&);
+bool operator<(const cmListFileContext& lhs, const cmListFileContext& rhs);
 
 struct cmListFileFunction: public cmListFileContext
 {
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 5240dc8..8631d73 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4943,9 +4943,7 @@ bool cmMakefile::SetPolicyVersion(const char *version)
 //----------------------------------------------------------------------------
 bool cmMakefile::HasCMP0054AlreadyBeenReported() const
 {
-  cmCMP0054Id id(this->GetExecutionContext());
-
-  return !this->CMP0054ReportedIds.insert(id).second;
+  return !this->CMP0054ReportedIds.insert(this->GetExecutionContext()).second;
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 3203b1b..bfd6155 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -386,26 +386,7 @@ public:
     */
   cmPolicies *GetPolicies() const;
 
-  struct cmCMP0054Id
-  {
-    cmCMP0054Id(cmListFileContext const& context):
-        Context(context)
-    {
-
-    }
-
-    bool operator< (cmCMP0054Id const& id) const
-    {
-      if(this->Context.FilePath != id.Context.FilePath)
-        return this->Context.FilePath < id.Context.FilePath;
-
-      return this->Context.Line < id.Context.Line;
-    }
-
-    cmListFileContext Context;
-  };
-
-  mutable std::set<cmCMP0054Id> CMP0054ReportedIds;
+  mutable std::set<cmListFileContext> CMP0054ReportedIds;
 
   /**
    * Determine if the given context, name pair has already been reported

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7eb0dfa0622afe078c2e131ee1cbad293960b634
commit 7eb0dfa0622afe078c2e131ee1cbad293960b634
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon May 18 21:41:42 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon May 18 23:55:43 2015 +0200

    cmMakefile: Use std::set::insert API to simplify CMP0054 handling.

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 33b7a0b..5240dc8 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4945,15 +4945,7 @@ bool cmMakefile::HasCMP0054AlreadyBeenReported() const
 {
   cmCMP0054Id id(this->GetExecutionContext());
 
-  bool alreadyReported =
-    this->CMP0054ReportedIds.find(id) != this->CMP0054ReportedIds.end();
-
-  if(!alreadyReported)
-    {
-    this->CMP0054ReportedIds.insert(id);
-    }
-
-  return alreadyReported;
+  return !this->CMP0054ReportedIds.insert(id).second;
 }
 
 //----------------------------------------------------------------------------

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f9785e0cb6c823849bb344e487d9e70d9fdaddb4
commit f9785e0cb6c823849bb344e487d9e70d9fdaddb4
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon May 18 21:39:15 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon May 18 23:55:43 2015 +0200

    cmMakefile: Simplify CMP0054 handling.

diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index e5a89b6..61847d4 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -112,10 +112,7 @@ const char* cmConditionEvaluator::GetDefinitionIfUnquoted(
 
   if(def && argument.WasQuoted() && this->Policy54Status == cmPolicies::WARN)
     {
-    bool hasBeenReported = this->Makefile.HasCMP0054AlreadyBeenReported(
-      this->Makefile.GetExecutionContext());
-
-    if(!hasBeenReported)
+    if(!this->Makefile.HasCMP0054AlreadyBeenReported())
       {
       std::ostringstream e;
       e << (cmPolicies::GetPolicyWarning(cmPolicies::CMP0054)) << "\n";
@@ -161,10 +158,7 @@ bool cmConditionEvaluator::IsKeyword(std::string const& keyword,
   if(isKeyword && argument.WasQuoted() &&
     this->Policy54Status == cmPolicies::WARN)
     {
-    bool hasBeenReported = this->Makefile.HasCMP0054AlreadyBeenReported(
-      this->Makefile.GetExecutionContext());
-
-    if(!hasBeenReported)
+    if(!this->Makefile.HasCMP0054AlreadyBeenReported())
       {
       std::ostringstream e;
       e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0054) << "\n";
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 4de3bcd..33b7a0b 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4941,10 +4941,9 @@ bool cmMakefile::SetPolicyVersion(const char *version)
 }
 
 //----------------------------------------------------------------------------
-bool cmMakefile::HasCMP0054AlreadyBeenReported(
-  cmListFileContext context) const
+bool cmMakefile::HasCMP0054AlreadyBeenReported() const
 {
-  cmCMP0054Id id(context);
+  cmCMP0054Id id(this->GetExecutionContext());
 
   bool alreadyReported =
     this->CMP0054ReportedIds.find(id) != this->CMP0054ReportedIds.end();
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 5ef2ec9..3203b1b 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -411,8 +411,7 @@ public:
    * Determine if the given context, name pair has already been reported
    * in context of CMP0054.
    */
-  bool HasCMP0054AlreadyBeenReported(
-    cmListFileContext context) const;
+  bool HasCMP0054AlreadyBeenReported() const;
 
   bool IgnoreErrorsCMP0061() const;
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e17b5e426294dc5cc86ba31dfd4d4acc553c0c72
commit e17b5e426294dc5cc86ba31dfd4d4acc553c0c72
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon May 18 21:35:29 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon May 18 23:55:41 2015 +0200

    cmMakefile: Add access to the top-level execution context.
    
    This is cheaper than getting the whole backtrace, and the cmListFileBacktrace
    will not always be composed of cmListFileContext objects.

diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index 73aface..e5a89b6 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -113,7 +113,7 @@ const char* cmConditionEvaluator::GetDefinitionIfUnquoted(
   if(def && argument.WasQuoted() && this->Policy54Status == cmPolicies::WARN)
     {
     bool hasBeenReported = this->Makefile.HasCMP0054AlreadyBeenReported(
-      this->Makefile.GetBacktrace()[0]);
+      this->Makefile.GetExecutionContext());
 
     if(!hasBeenReported)
       {
@@ -162,7 +162,7 @@ bool cmConditionEvaluator::IsKeyword(std::string const& keyword,
     this->Policy54Status == cmPolicies::WARN)
     {
     bool hasBeenReported = this->Makefile.HasCMP0054AlreadyBeenReported(
-      this->Makefile.GetBacktrace()[0]);
+      this->Makefile.GetExecutionContext());
 
     if(!hasBeenReported)
       {
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 272ac4c..4de3bcd 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -378,6 +378,12 @@ cmListFileBacktrace cmMakefile::GetBacktrace() const
 }
 
 //----------------------------------------------------------------------------
+cmListFileContext cmMakefile::GetExecutionContext() const
+{
+  return *this->CallStack.back().Context;
+}
+
+//----------------------------------------------------------------------------
 void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const
 {
   std::ostringstream msg;
@@ -1937,9 +1943,9 @@ void cmMakefile::CheckForUnused(const char* reason,
     cmListFileBacktrace bt(this->GetLocalGenerator());
     if (!this->CallStack.empty())
       {
-      const cmListFileContext* file = this->CallStack.back().Context;
-      bt.push_back(*file);
-      path = file->FilePath.c_str();
+      cmListFileContext file = this->GetExecutionContext();
+      bt.push_back(file);
+      path = file.FilePath;
       }
     else
       {
@@ -3410,7 +3416,7 @@ void cmMakefile::AddFunctionBlocker(cmFunctionBlocker* fb)
   if(!this->CallStack.empty())
     {
     // Record the context in which the blocker is created.
-    fb->SetStartingContext(*(this->CallStack.back().Context));
+    fb->SetStartingContext(this->GetExecutionContext());
     }
 
   this->FunctionBlockers.push_back(fb);
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 453884a..5ef2ec9 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -610,6 +610,7 @@ public:
    * Get the current context backtrace.
    */
   cmListFileBacktrace GetBacktrace() const;
+  cmListFileContext GetExecutionContext() const;
 
   /**
    * Get the vector of  files created by this makefile

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1ec1bf9f071ce930094171ab45f2dbc02c57927b
commit 1ec1bf9f071ce930094171ab45f2dbc02c57927b
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon May 18 00:00:53 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon May 18 21:28:09 2015 +0200

    if(): Test the effect of cmMakefileCall use in elseif() handling.

diff --git a/Tests/RunCMake/if/RunCMakeTest.cmake b/Tests/RunCMake/if/RunCMakeTest.cmake
index 6b6b74b..b5546a7 100644
--- a/Tests/RunCMake/if/RunCMakeTest.cmake
+++ b/Tests/RunCMake/if/RunCMakeTest.cmake
@@ -2,3 +2,4 @@ include(RunCMake)
 
 run_cmake(IsDirectory)
 run_cmake(IsDirectoryLong)
+run_cmake(elseif-message)
diff --git a/Tests/RunCMake/if/elseif-message-result.txt b/Tests/RunCMake/if/elseif-message-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/if/elseif-message-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/if/elseif-message-stderr.txt b/Tests/RunCMake/if/elseif-message-stderr.txt
new file mode 100644
index 0000000..c73977c
--- /dev/null
+++ b/Tests/RunCMake/if/elseif-message-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at elseif-message.cmake:[0-9]+ \(elseif\):
+  given arguments:
+
+    "Unknown" "arguments"
+
+  Unknown arguments specified
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/if/elseif-message.cmake b/Tests/RunCMake/if/elseif-message.cmake
new file mode 100644
index 0000000..5930966
--- /dev/null
+++ b/Tests/RunCMake/if/elseif-message.cmake
@@ -0,0 +1,4 @@
+
+if (0)
+elseif(Unknown arguments)
+endif()

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9b4aefad41218866e392021b6d7239b2eeb50390
commit 9b4aefad41218866e392021b6d7239b2eeb50390
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 17 23:12:16 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon May 18 21:25:48 2015 +0200

    cmMakefile: Replace deques with vectors.

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 7b8d3af..272ac4c 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4371,7 +4371,7 @@ std::string cmMakefile::GetListFileStack() const
   size_t depth = this->ListFileStack.size();
   if (depth > 0)
     {
-    std::deque<std::string>::const_iterator it = this->ListFileStack.end();
+    std::vector<std::string>::const_iterator it = this->ListFileStack.end();
     do
       {
       if (depth != this->ListFileStack.size())
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index e0eef6f..453884a 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -35,7 +35,6 @@
 #endif
 
 #include <stack>
-#include <deque>
 
 class cmFunctionBlocker;
 class cmCommand;
@@ -963,7 +962,7 @@ private:
   bool CheckSystemVars;
 
   // stack of list files being read
-  std::deque<std::string> ListFileStack;
+  std::vector<std::string> ListFileStack;
 
   // stack of commands being invoked.
   struct CallStackEntry
@@ -971,7 +970,7 @@ private:
     cmListFileContext const* Context;
     cmExecutionStatus* Status;
   };
-  typedef std::deque<CallStackEntry> CallStackType;
+  typedef std::vector<CallStackEntry> CallStackType;
   CallStackType CallStack;
   friend class cmMakefileCall;
 

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

Summary of changes:
 Source/cmCommandArgumentParserHelper.cxx           |    2 +-
 Source/cmConditionEvaluator.cxx                    |   10 +---
 Source/cmListFileCache.cxx                         |   49 ++++++++++++++++++++
 Source/cmListFileCache.h                           |   10 +++-
 Source/cmMakefile.cxx                              |   39 +++++++---------
 Source/cmMakefile.h                                |   30 ++----------
 Source/cmTarget.cxx                                |   43 ++++++-----------
 Source/cmTarget.h                                  |    2 +-
 Source/cmake.cxx                                   |   19 +-------
 Tests/RunCMake/if/RunCMakeTest.cmake               |    1 +
 .../elseif-message-result.txt}                     |    0
 .../elseif-message-stderr.txt}                     |    6 +--
 Tests/RunCMake/if/elseif-message.cmake             |    4 ++
 13 files changed, 107 insertions(+), 108 deletions(-)
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => if/elseif-message-result.txt} (100%)
 copy Tests/RunCMake/{CMP0054/CMP0054-keywords-NEW-stderr.txt => if/elseif-message-stderr.txt} (50%)
 create mode 100644 Tests/RunCMake/if/elseif-message.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list