[Cmake-commits] CMake branch, next, updated. v2.8.4-1563-ga5d8527

Brad King brad.king at kitware.com
Wed May 18 10:12:56 EDT 2011


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  a5d8527a445eae00f45ddf9dd2686e331b6795c1 (commit)
       via  c45c60b24ff52d9435ceab0de027fbadac130a1f (commit)
      from  83464577de235ee53d6f3b3c79fea1a365cb8a32 (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=a5d8527a445eae00f45ddf9dd2686e331b6795c1
commit a5d8527a445eae00f45ddf9dd2686e331b6795c1
Merge: 8346457 c45c60b
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed May 18 10:12:54 2011 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed May 18 10:12:54 2011 -0400

    Merge topic 'output-compile-lines' into next
    
    c45c60b run_compile_commands: Avoid extra stl vector conversion


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c45c60b24ff52d9435ceab0de027fbadac130a1f
commit c45c60b24ff52d9435ceab0de027fbadac130a1f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed May 18 09:44:28 2011 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed May 18 09:44:28 2011 -0400

    run_compile_commands: Avoid extra stl vector conversion
    
    The Sun compiler does not provide the proper vector constructor to
    initialize it from an iterator pair of a non-matching type.  Extend the
    ParseUnixCommandLine API to provide a vector of the proper type so no
    conversion is needed.

diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 7bc89a4..df6469f 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -440,6 +440,13 @@ public:
       args.push_back(*arg);
       }
     }
+  void Store(std::vector<cmStdString>& args) const
+    {
+    for(char** arg = this->ArgV; arg && *arg; ++arg)
+      {
+      args.push_back(*arg);
+      }
+    }
 };
 
 //----------------------------------------------------------------------------
@@ -451,6 +458,15 @@ void cmSystemTools::ParseUnixCommandLine(const char* command,
   argv.Store(args);
 }
 
+//----------------------------------------------------------------------------
+void cmSystemTools::ParseUnixCommandLine(const char* command,
+                                         std::vector<cmStdString>& args)
+{
+  // Invoke the underlying parser.
+  cmSystemToolsArgV argv = cmsysSystem_Parse_CommandForUnix(command, 0);
+  argv.Store(args);
+}
+
 std::string cmSystemTools::EscapeWindowsShellArgument(const char* arg,
                                                       int shell_flags)
 {
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 6f9147c..dfc6b7d 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -237,6 +237,8 @@ public:
   /** Parse arguments out of a unix command line string.  */
   static void ParseUnixCommandLine(const char* command,
                                    std::vector<std::string>& args);
+  static void ParseUnixCommandLine(const char* command,
+                                   std::vector<cmStdString>& args);
 
   /** Compute an escaped version of the given argument for use in a
       windows shell.  See kwsys/System.h.in for details.  */
diff --git a/Tests/CMakeLib/run_compile_commands.cxx b/Tests/CMakeLib/run_compile_commands.cxx
index cfb7ece..a0be2eb 100644
--- a/Tests/CMakeLib/run_compile_commands.cxx
+++ b/Tests/CMakeLib/run_compile_commands.cxx
@@ -127,9 +127,8 @@ int main ()
       it = parser.GetTranslationUnits().begin(),
       end = parser.GetTranslationUnits().end(); it != end; ++it)
     {
-    std::vector<std::string> std_command;
-    cmSystemTools::ParseUnixCommandLine(it->at("command").c_str(), std_command);
-    std::vector<cmStdString> command(std_command.begin(), std_command.end());
+    std::vector<cmStdString> command;
+    cmSystemTools::ParseUnixCommandLine(it->at("command").c_str(), command);
     if (!cmSystemTools::RunSingleCommand(
             command, 0, 0, it->at("directory").c_str()))
       {

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

Summary of changes:
 Source/cmSystemTools.cxx                |   16 ++++++++++++++++
 Source/cmSystemTools.h                  |    2 ++
 Tests/CMakeLib/run_compile_commands.cxx |    5 ++---
 3 files changed, 20 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list