[Cmake-commits] CMake branch, next, updated. v2.8.11.2-3844-gb2c89f0

Stephen Kelly steveire at gmail.com
Tue Aug 13 07:59:28 EDT 2013


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  b2c89f0fa31a62bbe7d9a0b66ba9163060dd56be (commit)
       via  36eef302c0b8ecb992c5d4b01562bcaef543b6fc (commit)
       via  4bc8b7abab976530d9675cff13ef1dc7c2139d00 (commit)
      from  ba97ed13f40d82b8bbd3819772982285c2706069 (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=b2c89f0fa31a62bbe7d9a0b66ba9163060dd56be
commit b2c89f0fa31a62bbe7d9a0b66ba9163060dd56be
Merge: ba97ed1 36eef30
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Aug 13 07:59:26 2013 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Aug 13 07:59:26 2013 -0400

    Merge topic 'fix-genex-segfault' into next
    
    36eef30 Genex: Fix segfault when parsing ends with parameter expectation.
    4bc8b7a CMake Nightly Date Stamp


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=36eef302c0b8ecb992c5d4b01562bcaef543b6fc
commit 36eef302c0b8ecb992c5d4b01562bcaef543b6fc
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Aug 13 13:32:27 2013 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Aug 13 13:58:39 2013 +0200

    Genex: Fix segfault when parsing ends with parameter expectation.
    
    The extendResult method expects a non-empty parameters vector, as
    assured by the normal case. Avoid calling the method when the parser
    finds an incomplete generator expression, but has already entered
    the state of expecting to find parameters.

diff --git a/Source/cmGeneratorExpressionParser.cxx b/Source/cmGeneratorExpressionParser.cxx
index a619cec..e1fb8f1 100644
--- a/Source/cmGeneratorExpressionParser.cxx
+++ b/Source/cmGeneratorExpressionParser.cxx
@@ -126,6 +126,9 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
   std::vector<std::vector<cmGeneratorExpressionToken>::const_iterator>
                                                             commaTokens;
   std::vector<cmGeneratorExpressionToken>::const_iterator colonToken;
+
+  bool emptyParamTermination = false;
+
   if (this->it != this->Tokens.end() &&
       this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator)
     {
@@ -133,6 +136,10 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
     parameters.resize(parameters.size() + 1);
     assert(this->it != this->Tokens.end());
     ++this->it;
+    if(this->it == this->Tokens.end())
+      {
+      emptyParamTermination = true;
+      }
 
     while (this->it != this->Tokens.end() &&
            this->it->TokenType == cmGeneratorExpressionToken::CommaSeparator)
@@ -141,6 +148,10 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
       parameters.resize(parameters.size() + 1);
       assert(this->it != this->Tokens.end());
       ++this->it;
+      if(this->it == this->Tokens.end())
+        {
+        emptyParamTermination = true;
+        }
       }
     while (this->it != this->Tokens.end() &&
            this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator)
@@ -164,6 +175,10 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
         parameters.resize(parameters.size() + 1);
         assert(this->it != this->Tokens.end());
         ++this->it;
+        if(this->it == this->Tokens.end())
+          {
+          emptyParamTermination = true;
+          }
         }
       while (this->it != this->Tokens.end() &&
              this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator)
@@ -203,7 +218,10 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
       assert(parameters.size() > commaTokens.size());
       for ( ; pit != pend; ++pit, ++commaIt)
         {
-        extendResult(result, *pit);
+        if (!pit->empty() && !emptyParamTermination)
+          {
+          extendResult(result, *pit);
+          }
         if (commaIt != commaTokens.end())
           {
           extendText(result, *commaIt);
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index 9ee4fc5..4d8d7ed 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -184,6 +184,8 @@ add_custom_target(check-part3 ALL
     -Dtest_alias_file_exe=$<STREQUAL:$<TARGET_FILE:Alias::SomeExe>,$<TARGET_FILE:someexe>>
     -Dtest_alias_file_lib=$<STREQUAL:$<TARGET_FILE:Alias::SomeLib>,$<TARGET_FILE:empty1>>
     -Dtest_alias_target_name=$<STREQUAL:$<TARGET_PROPERTY:Alias::SomeLib,NAME>,$<TARGET_PROPERTY:empty1,NAME>>
+    -Dtest_early_termination_1=$<$<1:>:
+    -Dtest_early_termination_2=$<$<1:>:,
     -P ${CMAKE_CURRENT_SOURCE_DIR}/check-part3.cmake
   COMMAND ${CMAKE_COMMAND} -E echo "check done (part 3 of 3)"
   VERBATIM
diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake
index 5a6a441..74a596c 100644
--- a/Tests/GeneratorExpression/check-part3.cmake
+++ b/Tests/GeneratorExpression/check-part3.cmake
@@ -24,3 +24,5 @@ endforeach()
 check(test_alias_file_exe "1")
 check(test_alias_file_lib "1")
 check(test_alias_target_name "1")
+check(test_early_termination_1 "$<:")
+check(test_early_termination_2 "$<:,")

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

Summary of changes:
 Source/CMakeVersion.cmake                   |    2 +-
 Source/cmGeneratorExpressionParser.cxx      |   20 +++++++++++++++++++-
 Tests/GeneratorExpression/CMakeLists.txt    |    2 ++
 Tests/GeneratorExpression/check-part3.cmake |    2 ++
 4 files changed, 24 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list