[Cmake-commits] CMake branch, next, updated. v2.8.2-488-g21741c8

Brad King brad.king at kitware.com
Wed Aug 18 11:12:39 EDT 2010


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  21741c8cab95e9393501f402c1843993b0c2aceb (commit)
       via  cb9ea2647f66326dde34a15fde4d7d93a5c766ac (commit)
       via  5383657357b35481b5ff676736e36927339bea1c (commit)
      from  ff93e6f65dc70bde382664c2590f3c27130d909a (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=21741c8cab95e9393501f402c1843993b0c2aceb
commit 21741c8cab95e9393501f402c1843993b0c2aceb
Merge: ff93e6f cb9ea26
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Aug 18 11:12:37 2010 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Aug 18 11:12:37 2010 -0400

    Merge topic 'remove-EscapeSpaces' into next
    
    cb9ea26 Remove cmSystemTools::EscapeSpaces method
    5383657 CTest: Avoid use of old EscapeSpaces method


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cb9ea2647f66326dde34a15fde4d7d93a5c766ac
commit cb9ea2647f66326dde34a15fde4d7d93a5c766ac
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Aug 18 10:26:05 2010 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Aug 18 10:26:05 2010 -0400

    Remove cmSystemTools::EscapeSpaces method
    
    The last remaining call to this method exists only for compatibility.
    Remove the method and put its implementation inline in place of the last
    call.

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 07c92e5..bac0223 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2810,17 +2810,29 @@ cmLocalGenerator
 std::string cmLocalGenerator::EscapeForShellOldStyle(const char* str)
 {
   std::string result;
-  bool forceOn =  cmSystemTools::GetForceUnixPaths();
-  if(forceOn && this->WindowsShell)
+#if defined(_WIN32) && !defined(__CYGWIN__)
+  // if there are spaces
+  std::string temp = str;
+  if (temp.find(" ") != std::string::npos &&
+      temp.find("\"")==std::string::npos)
     {
-    cmSystemTools::SetForceUnixPaths(false);
+    result = "\"";
+    result += str;
+    result += "\"";
+    return result;
     }
-  result = cmSystemTools::EscapeSpaces(str);
-  if(forceOn && this->WindowsShell)
+  return str;
+#else
+  for(const char* ch = str; *ch != '\0'; ++ch)
     {
-    cmSystemTools::SetForceUnixPaths(true);
+    if(*ch == ' ')
+      {
+      result += '\\';
+      }
+    result += *ch;
     }
   return result;
+#endif
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 0e0a770..271a662 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -191,49 +191,6 @@ std::string cmSystemTools::EscapeQuotes(const char* str)
   return result;
 }
 
-std::string cmSystemTools::EscapeSpaces(const char* str)
-{
-#if defined(_WIN32) && !defined(__CYGWIN__)
-  bool useDoubleQ = true;
-#else
-  bool useDoubleQ = false;
-#endif
-  if(cmSystemTools::s_ForceUnixPaths)
-    {
-    useDoubleQ = false;
-    }
-  
-  if(useDoubleQ)
-    {
-    std::string result;
-    
-    // if there are spaces
-    std::string temp = str;
-    if (temp.find(" ") != std::string::npos && 
-        temp.find("\"")==std::string::npos)
-      {
-      result = "\"";
-      result += str;
-      result += "\"";
-      return result;
-      }
-    return str;
-    }
-  else
-    {
-    std::string result = "";
-    for(const char* ch = str; *ch != '\0'; ++ch)
-      {
-      if(*ch == ' ')
-        {
-        result += '\\';
-        }
-      result += *ch;
-      }
-    return result;
-    }
-}
-
 void cmSystemTools::Error(const char* m1, const char* m2,
                           const char* m3, const char* m4)
 {
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index da5da31..6a9d849 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -46,12 +46,6 @@ public:
   static void ExpandRegistryValues(std::string& source,
                                    KeyWOW64 view = KeyWOW64_Default);
 
-  /**
-   * Platform independent escape spaces, unix uses backslash,
-   * windows double quotes the string.
-   */
-  static std::string EscapeSpaces(const char* str);
-
   ///! Escape quotes in a string.
   static std::string EscapeQuotes(const char* str);
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5383657357b35481b5ff676736e36927339bea1c
commit 5383657357b35481b5ff676736e36927339bea1c
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Aug 18 10:14:09 2010 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Aug 18 10:14:09 2010 -0400

    CTest: Avoid use of old EscapeSpaces method
    
    Refactor how cmCTestMemCheckHandler computes the memory tester command
    line options to avoid encoding them in a single string just to parse
    them again.  The EscapeSpaces uses backslahes to escape spaces on UNIX
    platforms, so replace other calls to it in CTest that are used to create
    human-readable strings with simple double-quoting.

diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 0d15ddc..13a25cb 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -201,8 +201,7 @@ void cmCTestMemCheckHandler::Initialize()
   this->CustomMaximumPassedTestOutputSize = 0;
   this->CustomMaximumFailedTestOutputSize = 0;
   this->MemoryTester = "";
-  this->MemoryTesterOptionsParsed.clear();
-  this->MemoryTesterOptions = "";
+  this->MemoryTesterOptions.clear();
   this->MemoryTesterStyle = UNKNOWN;
   this->MemoryTesterOutputFile = "";
   int cc;
@@ -249,12 +248,12 @@ void cmCTestMemCheckHandler::GenerateTestCommand(
   std::vector<cmStdString>::size_type pp;
   std::string memcheckcommand = "";
   memcheckcommand = this->MemoryTester;
-  for ( pp = 0; pp < this->MemoryTesterOptionsParsed.size(); pp ++ )
+  for ( pp = 0; pp < this->MemoryTesterOptions.size(); pp ++ )
     {
-    args.push_back(this->MemoryTesterOptionsParsed[pp]);
-    memcheckcommand += " ";
-    memcheckcommand += cmSystemTools::EscapeSpaces(
-      this->MemoryTesterOptionsParsed[pp].c_str());
+    args.push_back(this->MemoryTesterOptions[pp]);
+    memcheckcommand += " \"";
+    memcheckcommand += this->MemoryTesterOptions[pp];
+    memcheckcommand += "\"";
     }
   cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Memory check command: "
     << memcheckcommand << std::endl);
@@ -440,18 +439,21 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
     }
 
   // Setup the options
+  std::string memoryTesterOptions;
   if ( this->CTest->GetCTestConfiguration(
       "MemoryCheckCommandOptions").size() )
     {
-    this->MemoryTesterOptions = this->CTest->GetCTestConfiguration(
+    memoryTesterOptions = this->CTest->GetCTestConfiguration(
       "MemoryCheckCommandOptions");
     }
   else if ( this->CTest->GetCTestConfiguration(
       "ValgrindCommandOptions").size() )
     {
-    this->MemoryTesterOptions = this->CTest->GetCTestConfiguration(
+    memoryTesterOptions = this->CTest->GetCTestConfiguration(
       "ValgrindCommandOptions");
     }
+  this->MemoryTesterOptions
+    = cmSystemTools::ParseArguments(memoryTesterOptions.c_str());
 
   this->MemoryTesterOutputFile
     = this->CTest->GetBinaryDir() + "/Testing/Temporary/MemoryChecker.log";
@@ -459,10 +461,14 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
   if ( this->MemoryTester.find("valgrind") != std::string::npos )
     {
     this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND;
-    if ( !this->MemoryTesterOptions.size() )
+    if ( this->MemoryTesterOptions.empty() )
       {
-      this->MemoryTesterOptions = "-q --tool=memcheck --leak-check=yes "
-        "--show-reachable=yes --workaround-gcc296-bugs=yes --num-callers=50";
+      this->MemoryTesterOptions.push_back("-q");
+      this->MemoryTesterOptions.push_back("--tool=memcheck");
+      this->MemoryTesterOptions.push_back("--leak-check=yes");
+      this->MemoryTesterOptions.push_back("--show-reachable=yes");
+      this->MemoryTesterOptions.push_back("--workaround-gcc296-bugs=yes");
+      this->MemoryTesterOptions.push_back("--num-callers=50");
       }
     if ( this->CTest->GetCTestConfiguration(
         "MemoryCheckSuppressionFile").size() )
@@ -476,17 +482,15 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
             "MemoryCheckSuppressionFile").c_str() << std::endl);
         return false;
         }
-      this->MemoryTesterOptions += " --suppressions=" +
-        cmSystemTools::EscapeSpaces(this->CTest->GetCTestConfiguration(
-            "MemoryCheckSuppressionFile").c_str()) + "";
+      std::string suppressions = "--suppressions="
+        + this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile");
+      this->MemoryTesterOptions.push_back(suppressions);
       }
     }
   else if ( this->MemoryTester.find("purify") != std::string::npos )
     {
     this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY;
-    std::string outputFile = 
-      cmSystemTools::EscapeSpaces(this->MemoryTesterOutputFile.c_str());
-
+    std::string outputFile;
 #ifdef _WIN32
     if( this->CTest->GetCTestConfiguration(
           "MemoryCheckSuppressionFile").size() )
@@ -500,31 +504,29 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
                      "MemoryCheckSuppressionFile").c_str() << std::endl);
         return false;
         }
-      this->MemoryTesterOptions += " /FilterFiles=" +
-        cmSystemTools::EscapeSpaces(this->CTest->GetCTestConfiguration(
-                                      "MemoryCheckSuppressionFile").c_str());
+      std::string filterFiles = "/FilterFiles="
+        + this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile");
+      this->MemoryTesterOptions.push_back(filterFiles);
       }
-    this->MemoryTesterOptions += " /SAVETEXTDATA=" + outputFile;
+    outputFile = "/SAVETEXTDATA=";
 #else
-    this->MemoryTesterOptions += " -log-file=" + outputFile;
+    outputFile = "-log-file=";
 #endif
+    outputFile += this->MemoryTesterOutputFile;
+    this->MemoryTesterOptions.push_back(outputFile);
     }
   else if ( this->MemoryTester.find("BC") != std::string::npos )
     { 
     this->BoundsCheckerXMLFile = this->MemoryTesterOutputFile;
-    std::string outputFile = 
-      cmSystemTools::EscapeSpaces(this->MemoryTesterOutputFile.c_str());
     std::string dpbdFile = this->CTest->GetBinaryDir()
       + "/Testing/Temporary/MemoryChecker.DPbd";
-    std::string errorFile = this->CTest->GetBinaryDir()
-      + "/Testing/Temporary/MemoryChecker.error";
-    errorFile = cmSystemTools::EscapeSpaces(errorFile.c_str());
     this->BoundsCheckerDPBDFile = dpbdFile;
-    dpbdFile = cmSystemTools::EscapeSpaces(dpbdFile.c_str());
     this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
-    this->MemoryTesterOptions += " /B " + dpbdFile;
-    this->MemoryTesterOptions += " /X " + outputFile;
-    this->MemoryTesterOptions += " /M ";
+    this->MemoryTesterOptions.push_back("/B");
+    this->MemoryTesterOptions.push_back(dpbdFile);
+    this->MemoryTesterOptions.push_back("/X");
+    this->MemoryTesterOptions.push_back(this->MemoryTesterOutputFile);
+    this->MemoryTesterOptions.push_back("/M");
     }
   else
     {
@@ -534,8 +536,6 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
     return false;
     }
 
-  this->MemoryTesterOptionsParsed
-    = cmSystemTools::ParseArguments(this->MemoryTesterOptions.c_str());
   std::vector<cmStdString>::size_type cc;
   for ( cc = 0; cmCTestMemCheckResultStrings[cc]; cc ++ )
     {
diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h
index db426f0..427d471 100644
--- a/Source/CTest/cmCTestMemCheckHandler.h
+++ b/Source/CTest/cmCTestMemCheckHandler.h
@@ -89,8 +89,7 @@ private:
   std::string              BoundsCheckerDPBDFile;
   std::string              BoundsCheckerXMLFile;
   std::string              MemoryTester;
-  std::vector<cmStdString> MemoryTesterOptionsParsed;
-  std::string              MemoryTesterOptions;
+  std::vector<cmStdString> MemoryTesterOptions;
   int                      MemoryTesterStyle;
   std::string              MemoryTesterOutputFile;
   int                      MemoryTesterGlobalResults[NO_MEMORY_FAULT];
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index ce44097..6570d0e 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -471,7 +471,7 @@ void cmCTestRunTest::ComputeArguments()
       this->TestProperties->Args[1].c_str());
     ++j; //skip the executable (it will be actualCommand)
     }
-  this->TestCommand
+  std::string testCommand
     = cmSystemTools::ConvertToOutputPath(this->ActualCommand.c_str());
 
   //Prepends memcheck args to our command string
@@ -479,22 +479,24 @@ void cmCTestRunTest::ComputeArguments()
   for(std::vector<std::string>::iterator i = this->Arguments.begin();
       i != this->Arguments.end(); ++i)
     {
-    this->TestCommand += " ";
-    this->TestCommand += cmSystemTools::EscapeSpaces(i->c_str());
+    testCommand += " \"";
+    testCommand += *i;
+    testCommand += "\"";
     }
 
   for(;j != this->TestProperties->Args.end(); ++j)
     {
-    this->TestCommand += " ";
-    this->TestCommand += cmSystemTools::EscapeSpaces(j->c_str());
+    testCommand += " \"";
+    testCommand += *j;
+    testCommand += "\"";
     this->Arguments.push_back(*j);
     }
-  this->TestResult.FullCommandLine = this->TestCommand;
+  this->TestResult.FullCommandLine = testCommand;
 
   cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl
              << this->Index << ": "
              << (this->TestHandler->MemCheck?"MemCheck":"Test") 
-             << " command: " << this->TestCommand
+             << " command: " << testCommand
              << std::endl);
 }
 
diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h
index e0cb888..66e6b7b 100644
--- a/Source/CTest/cmCTestRunTest.h
+++ b/Source/CTest/cmCTestRunTest.h
@@ -89,7 +89,6 @@ private:
   cmCTestTestHandler::cmCTestTestResult TestResult;
   int Index;
   std::string StartTime;
-  std::string TestCommand;
   std::string ActualCommand;
   std::vector<std::string> Arguments;
   bool StopTimePassed;

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

Summary of changes:
 Source/CTest/cmCTestMemCheckHandler.cxx |   68 +++++++++++++++---------------
 Source/CTest/cmCTestMemCheckHandler.h   |    3 +-
 Source/CTest/cmCTestRunTest.cxx         |   16 ++++---
 Source/CTest/cmCTestRunTest.h           |    1 -
 Source/cmLocalGenerator.cxx             |   24 ++++++++---
 Source/cmSystemTools.cxx                |   43 -------------------
 Source/cmSystemTools.h                  |    6 ---
 7 files changed, 62 insertions(+), 99 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list