[Cmake-commits] CMake branch, next, updated. v2.8.9-1075-gec404e5

Stephen Kelly steveire at gmail.com
Fri Oct 12 16:05:26 EDT 2012


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  ec404e5edb34572670543ee8a21882a9d16407fc (commit)
       via  a13298d9220391b1df0f76856b061a7ac3aec7df (commit)
       via  c68eaa030f1e6e45a1f2a99d34389f8d27ebd671 (commit)
       via  10e8b3f8ad4deeb0fa5c67813a3ed34aa1121c07 (commit)
      from  c1d14a8bcd6f5c7acd2448ab2d4eb21f4440a9ed (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=ec404e5edb34572670543ee8a21882a9d16407fc
commit ec404e5edb34572670543ee8a21882a9d16407fc
Merge: c1d14a8 a13298d
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Oct 12 16:05:23 2012 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Oct 12 16:05:23 2012 -0400

    Merge topic 'generator-expression-bug-fixes' into next
    
    a13298d Fix termination bugs in generator expression parser.
    c68eaa0 Test the use of generator expressions to generate lists.
    10e8b3f Parse colon after arguments separator colon specially.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a13298d9220391b1df0f76856b061a7ac3aec7df
commit a13298d9220391b1df0f76856b061a7ac3aec7df
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Oct 12 17:34:16 2012 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Fri Oct 12 22:00:02 2012 +0200

    Fix termination bugs in generator expression parser.
    
    Content which is incomplete as a generator expression could cause
    segfaults by advancing an iterator beyond end() and dereferencing
    it. Such incomplete generator expressions  should be treated as
    plain text instead.

diff --git a/Source/cmGeneratorExpressionParser.cxx b/Source/cmGeneratorExpressionParser.cxx
index d09e412..341832a 100644
--- a/Source/cmGeneratorExpressionParser.cxx
+++ b/Source/cmGeneratorExpressionParser.cxx
@@ -77,6 +77,7 @@ static void extendResult(std::vector<cmGeneratorExpressionEvaluator*> &result,
 void cmGeneratorExpressionParser::ParseGeneratorExpression(
                         std::vector<cmGeneratorExpressionEvaluator*> &result)
 {
+  assert(this->it != this->Tokens.end());
   unsigned int nestedLevel = this->NestingLevel;
   ++this->NestingLevel;
 
@@ -98,7 +99,8 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
     // ERROR
     }
 
-  if (this->it->TokenType == cmGeneratorExpressionToken::EndExpression)
+  if (this->it != this->Tokens.end() &&
+      this->it->TokenType == cmGeneratorExpressionToken::EndExpression)
     {
     GeneratorExpressionContent *content = new GeneratorExpressionContent(
                 startToken->Content, this->it->Content
@@ -115,42 +117,50 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
   std::vector<std::vector<cmGeneratorExpressionToken>::const_iterator>
                                                             commaTokens;
   std::vector<cmGeneratorExpressionToken>::const_iterator colonToken;
-  if (this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator)
+  if (this->it != this->Tokens.end() &&
+      this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator)
     {
     colonToken = this->it;
     parameters.resize(parameters.size() + 1);
     ++this->it;
-    while (this->it->TokenType == cmGeneratorExpressionToken::CommaSeparator)
+
+    while (this->it != this->Tokens.end() &&
+           this->it->TokenType == cmGeneratorExpressionToken::CommaSeparator)
       {
       commaTokens.push_back(this->it);
       parameters.resize(parameters.size() + 1);
       ++this->it;
       }
-    while (this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator)
+    while (this->it != this->Tokens.end() &&
+           this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator)
       {
       extendText(*(parameters.end() - 1), this->it);
       ++this->it;
       }
-    while(this->it->TokenType != cmGeneratorExpressionToken::EndExpression)
+    while (this->it != this->Tokens.end() &&
+           this->it->TokenType != cmGeneratorExpressionToken::EndExpression)
       {
       this->ParseContent(*(parameters.end() - 1));
-      while (this->it->TokenType == cmGeneratorExpressionToken::CommaSeparator)
+      if (this->it == this->Tokens.end())
+        {
+        break;
+        }
+      while (this->it != this->Tokens.end() &&
+             this->it->TokenType == cmGeneratorExpressionToken::CommaSeparator)
         {
         commaTokens.push_back(this->it);
         parameters.resize(parameters.size() + 1);
         ++this->it;
         }
-      while (this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator)
+      while (this->it != this->Tokens.end() &&
+             this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator)
         {
         extendText(*(parameters.end() - 1), this->it);
         ++this->it;
         }
-      if (this->it == this->Tokens.end())
-        {
-        break;
-        }
       }
-      if(this->it->TokenType == cmGeneratorExpressionToken::EndExpression)
+      if(this->it != this->Tokens.end()
+          && this->it->TokenType == cmGeneratorExpressionToken::EndExpression)
         {
         --this->NestingLevel;
         ++this->it;
@@ -201,6 +211,7 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
 void cmGeneratorExpressionParser::ParseContent(
                         std::vector<cmGeneratorExpressionEvaluator*> &result)
 {
+  assert(this->it != this->Tokens.end());
   switch(this->it->TokenType)
     {
     case cmGeneratorExpressionToken::Text:
@@ -245,5 +256,5 @@ void cmGeneratorExpressionParser::ParseContent(
       ++this->it;
       return;
     }
-  // Unreachable. Assert?
+    assert(!"Unhandled token in generator expression.");
 }
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index 4967ac0..cb01ec1 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -49,6 +49,28 @@ add_custom_target(check ALL
     -Dtest_colons_3=$<1:Qt5::Core>
     -Dtest_colons_4=$<1:C:\\CMake>
     -Dtest_colons_5=$<1:C:/CMake>
+    -Dtest_incomplete_1=$<
+    -Dtest_incomplete_2=$<something
+    -Dtest_incomplete_3=$<something:
+    -Dtest_incomplete_4=$<something:,
+    -Dtest_incomplete_5=$something:,>
+    -Dtest_incomplete_6=<something:,>
+    -Dtest_incomplete_7=$<something::
+    -Dtest_incomplete_8=$<something:,
+    -Dtest_incomplete_9=$<something:,,
+    -Dtest_incomplete_10=$<something:,:
+    -Dtest_incomplete_11=$<something,,
+    -Dtest_incomplete_12=$<,,
+    -Dtest_incomplete_13=$<some$<1:special>thing
+    -Dtest_incomplete_14=$<<something
+    -Dtest_incomplete_15=$<some$<thing
+    -Dtest_incomplete_16=$<<some$<thing
+    -Dtest_incomplete_17=$<1:some$thing>
+    -Dtest_incomplete_18=$<1:some,thing
+    -Dtest_incomplete_19=$<1:some,thing$<ANGLE-R>
+    -Dtest_incomplete_20=$<CONFIGURATION$<ANGLE-R>
+    -Dtest_incomplete_21=$<BOOL:something$<ANGLE-R>
+    -Dtest_incomplete_22=$<BOOL:something
     -P ${CMAKE_CURRENT_SOURCE_DIR}/check.cmake
   COMMAND ${CMAKE_COMMAND} -E echo "check done"
   VERBATIM
diff --git a/Tests/GeneratorExpression/check.cmake b/Tests/GeneratorExpression/check.cmake
index e46c1c1..bfdbd65 100644
--- a/Tests/GeneratorExpression/check.cmake
+++ b/Tests/GeneratorExpression/check.cmake
@@ -50,3 +50,25 @@ check(test_colons_2 "::")
 check(test_colons_3 "Qt5::Core")
 check(test_colons_4 "C:\\\\CMake")
 check(test_colons_5 "C:/CMake")
+check(test_incomplete_1 "$<")
+check(test_incomplete_2 "$<something")
+check(test_incomplete_3 "$<something:")
+check(test_incomplete_4 "$<something:,")
+check(test_incomplete_5 "$something:,>")
+check(test_incomplete_6 "<something:,>")
+check(test_incomplete_7 "$<something::")
+check(test_incomplete_8 "$<something:,")
+check(test_incomplete_9 "$<something:,,")
+check(test_incomplete_10 "$<something:,:")
+check(test_incomplete_11 "$<something,,")
+check(test_incomplete_12 "$<,,")
+check(test_incomplete_13 "$<somespecialthing")
+check(test_incomplete_14 "$<<something")
+check(test_incomplete_15 "$<some$<thing")
+check(test_incomplete_16 "$<<some$<thing")
+check(test_incomplete_17 "some$thing")
+check(test_incomplete_18 "$<1:some,thing")
+check(test_incomplete_19 "$<1:some,thing>")
+check(test_incomplete_20 "$<CONFIGURATION>")
+check(test_incomplete_21 "$<BOOL:something>")
+check(test_incomplete_22 "$<BOOL:something")

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c68eaa030f1e6e45a1f2a99d34389f8d27ebd671
commit c68eaa030f1e6e45a1f2a99d34389f8d27ebd671
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Oct 12 17:17:30 2012 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Fri Oct 12 17:22:26 2012 +0200

    Test the use of generator expressions to generate lists.
    
    We can't test this in the GeneratorExpression unit test because
    the ';' chars are processed specically by the CMake function argument
    parser.

diff --git a/Tests/CompileDefinitions/compiletest.cpp b/Tests/CompileDefinitions/compiletest.cpp
index 4a68a07..f18e59e 100644
--- a/Tests/CompileDefinitions/compiletest.cpp
+++ b/Tests/CompileDefinitions/compiletest.cpp
@@ -34,6 +34,15 @@ enum {
 #ifdef GE_NOT_DEFINED
 #error Expect not defined generator expression
 #endif
+
+#ifndef ARGUMENT
+#error Expected define expanded from list
+#endif
+#ifndef LIST
+#error Expected define expanded from list
+#endif
+
+// TEST_GENERATOR_EXPRESSIONS
 #endif
 
 int main(int argc, char **argv)
diff --git a/Tests/CompileDefinitions/target_prop/CMakeLists.txt b/Tests/CompileDefinitions/target_prop/CMakeLists.txt
index fcb22b0..abdf257 100644
--- a/Tests/CompileDefinitions/target_prop/CMakeLists.txt
+++ b/Tests/CompileDefinitions/target_prop/CMakeLists.txt
@@ -12,4 +12,5 @@ set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS
   TEST_GENERATOR_EXPRESSIONS
     "$<1:CMAKE_IS_DECLARATIVE>"
     "$<0:GE_NOT_DEFINED>"
+    "$<1:ARGUMENT;LIST>"
 )
diff --git a/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt
index 4b6f682..d71f92e 100644
--- a/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt
+++ b/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt
@@ -15,6 +15,8 @@ create_header(baz)
 create_header(bang)
 create_header(bing)
 create_header(bung)
+create_header(arguments)
+create_header(list)
 
 set(CMAKE_INCLUDE_CURRENT_DIR ON)
 
@@ -30,3 +32,5 @@ set_property(TARGET TargetIncludeDirectories APPEND PROPERTY
 include_directories("${CMAKE_CURRENT_BINARY_DIR}/baz")
 include_directories("$<1:${CMAKE_CURRENT_BINARY_DIR}/bung>")
 include_directories("sing$<1:/ting>")
+
+include_directories("$<1:${CMAKE_CURRENT_BINARY_DIR}/arguments;${CMAKE_CURRENT_BINARY_DIR}/list>")
diff --git a/Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp b/Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp
index 63217f4..030bb1c 100644
--- a/Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp
+++ b/Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp
@@ -7,6 +7,8 @@
 #include "bing.h"
 #include "bung.h"
 #include "ting.h"
+#include "arguments.h"
+#include "list.h"
 
 int main(int, char**)
 {

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=10e8b3f8ad4deeb0fa5c67813a3ed34aa1121c07
commit 10e8b3f8ad4deeb0fa5c67813a3ed34aa1121c07
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Oct 12 16:51:16 2012 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Fri Oct 12 17:15:02 2012 +0200

    Parse colon after arguments separator colon specially.
    
    The rationale is similar to that
    in b3d8f5dab7f33dba4f327ab7ef4bd7ea90d6b651, in that colon tokens
    should not be parsed as identifier-argument delimiters after the
    first colon.

diff --git a/Source/cmGeneratorExpressionParser.cxx b/Source/cmGeneratorExpressionParser.cxx
index d95e1cc..d09e412 100644
--- a/Source/cmGeneratorExpressionParser.cxx
+++ b/Source/cmGeneratorExpressionParser.cxx
@@ -14,6 +14,8 @@
 
 #include "cmGeneratorExpressionEvaluator.h"
 
+#include "assert.h"
+
 //----------------------------------------------------------------------------
 cmGeneratorExpressionParser::cmGeneratorExpressionParser(
                       const std::vector<cmGeneratorExpressionToken> &tokens)
@@ -124,6 +126,11 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
       parameters.resize(parameters.size() + 1);
       ++this->it;
       }
+    while (this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator)
+      {
+      extendText(*(parameters.end() - 1), this->it);
+      ++this->it;
+      }
     while(this->it->TokenType != cmGeneratorExpressionToken::EndExpression)
       {
       this->ParseContent(*(parameters.end() - 1));
@@ -133,7 +140,7 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
         parameters.resize(parameters.size() + 1);
         ++this->it;
         }
-      if (this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator)
+      while (this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator)
         {
         extendText(*(parameters.end() - 1), this->it);
         ++this->it;
@@ -233,7 +240,7 @@ void cmGeneratorExpressionParser::ParseContent(
         }
       else
         {
-        // TODO: Unreachable. Assert?
+          assert(!"Got unexpected syntax token.");
         }
       ++this->it;
       return;
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index 8bc4f32..4967ac0 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -44,6 +44,11 @@ add_custom_target(check ALL
     -Dtest_strequal_one_empty=$<STREQUAL:something,>
     -Dtest_angle_r=$<ANGLE-R>
     -Dtest_comma=$<COMMA>
+    -Dtest_colons_1=$<1::>
+    -Dtest_colons_2=$<1:::>
+    -Dtest_colons_3=$<1:Qt5::Core>
+    -Dtest_colons_4=$<1:C:\\CMake>
+    -Dtest_colons_5=$<1:C:/CMake>
     -P ${CMAKE_CURRENT_SOURCE_DIR}/check.cmake
   COMMAND ${CMAKE_COMMAND} -E echo "check done"
   VERBATIM
diff --git a/Tests/GeneratorExpression/check.cmake b/Tests/GeneratorExpression/check.cmake
index ec1f130..e46c1c1 100644
--- a/Tests/GeneratorExpression/check.cmake
+++ b/Tests/GeneratorExpression/check.cmake
@@ -45,3 +45,8 @@ check(test_strequal_both_empty "1")
 check(test_strequal_one_empty "0")
 check(test_angle_r ">")
 check(test_comma ",")
+check(test_colons_1 ":")
+check(test_colons_2 "::")
+check(test_colons_3 "Qt5::Core")
+check(test_colons_4 "C:\\\\CMake")
+check(test_colons_5 "C:/CMake")

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

Summary of changes:
 Source/cmGeneratorExpressionParser.cxx             |   44 ++++++++++++++------
 Tests/CompileDefinitions/compiletest.cpp           |    9 ++++
 .../CompileDefinitions/target_prop/CMakeLists.txt  |    1 +
 Tests/GeneratorExpression/CMakeLists.txt           |   27 ++++++++++++
 Tests/GeneratorExpression/check.cmake              |   27 ++++++++++++
 .../TargetIncludeDirectories/CMakeLists.txt        |    4 ++
 .../TargetIncludeDirectories/main.cpp              |    2 +
 7 files changed, 101 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list