[Cmake-commits] CMake branch, next, updated. v3.0.0-rc4-2683-g19dc6d0

Ben Boeckel ben.boeckel at kitware.com
Thu May 1 14:43:03 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  19dc6d010dba3a135f71d61a9bfee562d1016868 (commit)
       via  d720a7cbb80e849f541f05e03fae8f060af2150c (commit)
       via  d5174e3b5ca94d14dd020024d347831b093f2a4b (commit)
      from  b085788ea4ac01b2bd53ccc65c60287295610b95 (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=19dc6d010dba3a135f71d61a9bfee562d1016868
commit 19dc6d010dba3a135f71d61a9bfee562d1016868
Merge: b085788 d720a7c
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Thu May 1 14:43:03 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu May 1 14:43:03 2014 -0400

    Merge topic 'dev/faster-evis' into next
    
    d720a7cb Help: Add documentation on escaping changes with CMP0053
    d5174e3b EVIS: Remove strings from the stack


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d720a7cbb80e849f541f05e03fae8f060af2150c
commit d720a7cbb80e849f541f05e03fae8f060af2150c
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Thu May 1 14:47:18 2014 -0400
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Thu May 1 14:47:18 2014 -0400

    Help: Add documentation on escaping changes with CMP0053

diff --git a/Help/manual/cmake-language.7.rst b/Help/manual/cmake-language.7.rst
index e8d2670..45f4bac 100644
--- a/Help/manual/cmake-language.7.rst
+++ b/Help/manual/cmake-language.7.rst
@@ -296,16 +296,15 @@ An *escape sequence* is a ``\`` followed by one character:
 
 .. productionlist::
  escape_sequence: `escape_identity` | `escape_encoded` | `escape_semicolon`
- escape_identity: '\(' | '\)' | '\#' | '\"' | '\ ' |
-                : '\\' | '\$' | '\@' | '\^'
+ escape_identity: '\' <match '[^a-zA-Z]'>
  escape_encoded: '\t' | '\r' | '\n'
  escape_semicolon: '\;'
 
-A ``\`` followed by one of ``()#" \#@^`` simply encodes the literal
+A ``\`` followed by a non-alphanumeric character simply encodes the literal
 character without interpreting it as syntax.  A ``\t``, ``\r``, or ``\n``
-encodes a tab, carriage return, or newline character, respectively.
-A ``\;`` encodes itself but may be used in an `Unquoted Argument`_
-to encode the ``;`` without dividing the argument value on it.
+encodes a tab, carriage return, or newline character, respectively. A ``\;``
+encodes itself but may be used in an `Unquoted Argument`_ to encode the ``;``
+without dividing the argument value on it.
 
 .. _`Variable References`:
 
diff --git a/Help/policy/CMP0053.rst b/Help/policy/CMP0053.rst
index 542de63..9657368 100644
--- a/Help/policy/CMP0053.rst
+++ b/Help/policy/CMP0053.rst
@@ -28,6 +28,12 @@ cleaned up to simplify the behavior.  Specifically:
 * The setting of policy :policy:`CMP0010` is not considered,
   so improper variable reference syntax is always an error.
 
+* More characters are allowed to be escaped in variable names.
+  Previously, only ``()#" \#@^`` were valid characters to
+  escape. Now any non-alphanumeric, non-semicolon, non-NUL
+  character may be escaped following the ``escape_identity``
+  rule from :manual:`cmake-language`.
+
 The ``OLD`` behavior for this policy is to honor the legacy behavior for
 variable references and escape sequences.  The ``NEW`` behavior is to
 use the simpler variable expansion and escape sequence evaluation rules.

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d5174e3b5ca94d14dd020024d347831b093f2a4b
commit d5174e3b5ca94d14dd020024d347831b093f2a4b
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Thu May 1 14:34:06 2014 -0400
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Thu May 1 14:34:06 2014 -0400

    EVIS: Remove strings from the stack
    
    Keep a single string around and build it up incrementally. This avoids
    string allocation within the stack which is much faster.

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index cc52c24..481bb05 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2813,7 +2813,7 @@ typedef enum
 struct t_lookup
   {
   t_domain domain;
-  std::string lookup;
+  size_t loc;
   };
 
 cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
@@ -2834,6 +2834,8 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
 
   const char* in = source.c_str();
   const char* last = in;
+  std::string result;
+  result.reserve(source.size());
   std::stack<t_lookup> openstack;
   bool error = false;
   bool done = false;
@@ -2850,8 +2852,8 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
           {
           t_lookup var = openstack.top();
           openstack.pop();
-          std::string& lookup = var.lookup;
-          lookup.append(last, in - last);
+          result.append(last, in - last);
+          std::string const& lookup = result.substr(var.loc);
           const char* value = NULL;
           static const std::string lineVar = "CMAKE_CURRENT_LIST_LINE";
           switch(var.domain)
@@ -2861,7 +2863,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
                 {
                 cmOStringStream ostr;
                 ostr << line;
-                openstack.top().lookup.append(ostr.str());
+                result.append(ostr.str());
                 }
               else
                 {
@@ -2876,16 +2878,16 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
               break;
             }
           // Get the string we're meant to append to.
-          std::string result;
+          std::string varresult;
           if(value)
             {
             if(escapeQuotes)
               {
-              result = cmSystemTools::EscapeQuotes(value);
+              varresult = cmSystemTools::EscapeQuotes(value);
               }
             else
               {
-              result = value;
+              varresult = value;
               }
             }
           else if(!removeEmpty)
@@ -2914,7 +2916,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
                 }
               }
             }
-          openstack.top().lookup.append(result);
+          result.replace(var.loc, result.size() - var.loc, varresult);
           // Start looking from here on out.
           last = in + 1;
           }
@@ -2937,7 +2939,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
             }
           else if(!nextc)
             {
-            openstack.top().lookup.append(last, next - last);
+            result.append(last, next - last);
             last = next;
             }
           else if(cmHasLiteralPrefix(next, "ENV{"))
@@ -2966,9 +2968,10 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
             }
           if(start)
             {
-            openstack.top().lookup.append(last, in - last);
+            result.append(last, in - last);
             last = start;
             in = start - 1;
+            lookup.loc = result.size();
             openstack.push(lookup);
             }
           break;
@@ -2980,20 +2983,20 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
           char nextc = *next;
           if(nextc == 't')
             {
-            openstack.top().lookup.append(last, in - last);
-            openstack.top().lookup.append("\t");
+            result.append(last, in - last);
+            result.append("\t");
             last = next + 1;
             }
           else if(nextc == 'n')
             {
-            openstack.top().lookup.append(last, in - last);
-            openstack.top().lookup.append("\n");
+            result.append(last, in - last);
+            result.append("\n");
             last = next + 1;
             }
           else if(nextc == 'r')
             {
-            openstack.top().lookup.append(last, in - last);
-            openstack.top().lookup.append("\r");
+            result.append(last, in - last);
+            result.append("\r");
             last = next + 1;
             }
           else if(nextc == ';' && openstack.size() == 1)
@@ -3017,7 +3020,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
           else
             {
             // Take what we've found so far, skipping the escape character.
-            openstack.top().lookup.append(last, in - last);
+            result.append(last, in - last);
             // Start tracking from the next character.
             last = in + 1;
             }
@@ -3047,14 +3050,14 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
                 "0123456789/_.+-"))
             {
             std::string variable(in + 1, nextAt - in - 1);
-            std::string result = this->GetSafeDefinition(variable.c_str());
+            std::string varresult = this->GetSafeDefinition(variable);
             if(escapeQuotes)
               {
-              result = cmSystemTools::EscapeQuotes(result.c_str());
+              varresult = cmSystemTools::EscapeQuotes(varresult);
               }
             // Skip over the variable.
-            openstack.top().lookup.append(last, in - last);
-            openstack.top().lookup.append(result);
+            result.append(last, in - last);
+            result.append(varresult);
             in = nextAt;
             last = in + 1;
             break;
@@ -3073,9 +3076,9 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
           {
           errorstr += "Invalid character (\'";
           errorstr += inc;
-          openstack.top().lookup.append(last, in - last);
+          result.append(last, in - last);
           errorstr += "\') in a variable name: "
-                      "'" + openstack.top().lookup + "'";
+                      "'" + result.substr(openstack.top().loc) + "'";
           mtype = cmake::FATAL_ERROR;
           error = true;
           }
@@ -3116,9 +3119,9 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
   else
     {
     // Append the rest of the unchanged part of the string.
-    openstack.top().lookup.append(last);
+    result.append(last);
 
-    source = openstack.top().lookup;
+    source = result;
     }
 
   return mtype;

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

Summary of changes:
 Help/manual/cmake-language.7.rst |   11 ++++----
 Help/policy/CMP0053.rst          |    6 +++++
 Source/cmMakefile.cxx            |   53 ++++++++++++++++++++------------------
 3 files changed, 39 insertions(+), 31 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list