[Cmake-commits] CMake branch, next, updated. v2.8.8-3198-gc97752f

Peter Kuemmel syntheticpp at gmx.net
Sat Jun 16 06:42:54 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  c97752fcf55029c6c95d69f7945cf11cb7d3083b (commit)
       via  44b9bbc89dee8c86cfc48ec4cb2cbe952b05c20f (commit)
       via  57156a5d30aae61f170e8721f330a0b207797330 (commit)
      from  c38083148dea10f00da9ca41d3aff2d9628f9eae (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=c97752fcf55029c6c95d69f7945cf11cb7d3083b
commit c97752fcf55029c6c95d69f7945cf11cb7d3083b
Merge: c380831 44b9bbc
Author:     Peter Kuemmel <syntheticpp at gmx.net>
AuthorDate: Sat Jun 16 06:42:51 2012 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sat Jun 16 06:42:51 2012 -0400

    Merge topic 'ninja-cldeps' into next
    
    44b9bbc Ninja: build with old msvc versions
    57156a5 Ninja: build server fixes


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=44b9bbc89dee8c86cfc48ec4cb2cbe952b05c20f
commit 44b9bbc89dee8c86cfc48ec4cb2cbe952b05c20f
Author:     Peter Kuemmel <syntheticpp at gmx.net>
AuthorDate: Sat Jun 16 12:40:59 2012 +0200
Commit:     Peter Kuemmel <syntheticpp at gmx.net>
CommitDate: Sat Jun 16 12:40:59 2012 +0200

    Ninja: build with old msvc versions

diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx
index ce7ffc3..d62bd90 100644
--- a/Source/cmcldeps.cxx
+++ b/Source/cmcldeps.cxx
@@ -31,6 +31,12 @@
 #include <signal.h>
 #endif
 
+#if defined(_WIN64)
+typedef unsigned __int64 cmULONG_PTR;
+#else
+typedef unsigned long cmULONG_PTR;
+#endif
+
 //#include "exit_status.h"
 enum ExitStatus {
   ExitSuccess,
@@ -57,7 +63,8 @@ struct Subprocess {
 
  private:
   Subprocess();
-  bool Start(struct SubprocessSet* set, const std::string& command, const std::string& dir);
+  bool Start(struct SubprocessSet* set, const std::string& command,
+                                        const std::string& dir);
   void OnPipeReady();
 
   std::string buf_;
@@ -67,7 +74,7 @@ struct Subprocess {
   /// other end of the pipe, usable in the child process.
   HANDLE SetupPipe(HANDLE ioport);
 
-  HANDLE child_;
+  PROCESS_INFORMATION child_;
   HANDLE pipe_;
   OVERLAPPED overlapped_;
   char overlapped_buf_[4 << 10];
@@ -193,8 +200,9 @@ void Win32Fatal(const char* function) {
 
 }  // anonymous namespace
 
-Subprocess::Subprocess() : child_(NULL) , overlapped_(), is_reading_(false),
+Subprocess::Subprocess() : overlapped_(), is_reading_(false),
                            exit_code_(1) {
+  child_.hProcess = NULL;
 }
 
 Subprocess::~Subprocess() {
@@ -203,7 +211,7 @@ Subprocess::~Subprocess() {
       Win32Fatal("CloseHandle");
   }
   // Reap child if forgotten.
-  if (child_)
+  if (child_.hProcess)
     Finish();
 }
 
@@ -220,7 +228,7 @@ HANDLE Subprocess::SetupPipe(HANDLE ioport) {
   if (pipe_ == INVALID_HANDLE_VALUE)
     Win32Fatal("CreateNamedPipe");
 
-  if (!CreateIoCompletionPort(pipe_, ioport, (ULONG_PTR)this, 0))
+  if (!CreateIoCompletionPort(pipe_, ioport, (cmULONG_PTR)this, 0))
     Win32Fatal("CreateIoCompletionPort");
 
   memset(&overlapped_, 0, sizeof(overlapped_));
@@ -299,7 +307,7 @@ bool Subprocess::Start(SubprocessSet* set, const std::string& command,
   CloseHandle(nul);
 
   CloseHandle(process_info.hThread);
-  child_ = process_info.hProcess;
+  child_ = process_info;
 
   return true;
 }
@@ -336,17 +344,17 @@ void Subprocess::OnPipeReady() {
 }
 
 ExitStatus Subprocess::Finish() {
-  if (!child_)
+  if (!child_.hProcess)
     return ExitFailure;
 
   // TODO: add error handling for all of these.
-  WaitForSingleObject(child_, INFINITE);
+  WaitForSingleObject(child_.hProcess, INFINITE);
 
   DWORD exit_code = 0;
-  GetExitCodeProcess(child_, &exit_code);
+  GetExitCodeProcess(child_.hProcess, &exit_code);
 
-  CloseHandle(child_);
-  child_ = NULL;
+  CloseHandle(child_.hProcess);
+  child_.hProcess = NULL;
   exit_code_ = exit_code;
   return exit_code == 0              ? ExitSuccess :
          exit_code == CONTROL_C_EXIT ? ExitInterrupted :
@@ -388,13 +396,14 @@ BOOL WINAPI SubprocessSet::NotifyInterrupted(DWORD dwCtrlType) {
   return FALSE;
 }
 
-Subprocess *SubprocessSet::Add(const std::string& command, const std::string& dir) {
+Subprocess *SubprocessSet::Add(const std::string& command,
+                               const std::string& dir) {
   Subprocess *subprocess = new Subprocess;
   if (!subprocess->Start(this, command, dir)) {
     delete subprocess;
     return 0;
   }
-  if (subprocess->child_)
+  if (subprocess->child_.hProcess)
     running_.push_back(subprocess);
   else
     finished_.push(subprocess);
@@ -406,7 +415,7 @@ bool SubprocessSet::DoWork() {
   Subprocess* subproc;
   OVERLAPPED* overlapped;
 
-  if (!GetQueuedCompletionStatus(ioport_, &bytes_read, (PULONG_PTR)&subproc,
+  if (!GetQueuedCompletionStatus(ioport_, &bytes_read, (cmULONG_PTR*)&subproc,
                                  &overlapped, INFINITE)) {
     if (GetLastError() != ERROR_BROKEN_PIPE)
       Win32Fatal("GetQueuedCompletionStatus");
@@ -441,10 +450,11 @@ Subprocess* SubprocessSet::NextFinished() {
 void SubprocessSet::Clear() {
   for (std::vector<Subprocess*>::iterator i = running_.begin();
        i != running_.end(); ++i) {
-    if ((*i)->child_)
+    if ((*i)->child_.hProcess) {
       if (!GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT,
-                                    GetProcessId((*i)->child_)))
+                                    (*i)->child_.dwProcessId))
         Win32Fatal("GenerateConsoleCtrlEvent");
+      }
   }
   for (std::vector<Subprocess*>::iterator i = running_.begin();
        i != running_.end(); ++i)
@@ -504,7 +514,8 @@ static std::string trimLeadingSpace(const std::string& cmdline) {
   return cmdline.substr(i);
 }
 
-static void doEscape(std::string& str, const std::string& search, const std::string& repl) {
+static void doEscape(std::string& str, const std::string& search,
+                                       const std::string& repl) {
   std::string::size_type pos = 0;
   while ((pos = str.find(search, pos)) != std::string::npos) {
     str.replace(pos, search.size(), repl);
@@ -578,12 +589,12 @@ static void outputDepFile(const std::string& dfile, const std::string& objfile,
   doEscape(tmp, " ", "\\ ");
   fprintf(out, "%s: \\\n", tmp.c_str());
 
-  for (std::vector<std::string>::iterator i(incs.begin()); i != incs.end(); ++i) {
-    tmp = *i;
+  std::vector<std::string>::iterator it = incs.begin();
+  for (; it != incs.end(); ++it) {
+    tmp = *it;
     doEscape(tmp, "\\", "/");
     doEscape(tmp, " ", "\\ ");
     fprintf(out, "%s \\\n", tmp.c_str());
-    //printf("include: %s \n", tmp.c_str());
   }
 
   fprintf(out, "\n");

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=57156a5d30aae61f170e8721f330a0b207797330
commit 57156a5d30aae61f170e8721f330a0b207797330
Author:     Peter Kuemmel <syntheticpp at gmx.net>
AuthorDate: Sat Jun 16 12:31:50 2012 +0200
Commit:     Peter Kuemmel <syntheticpp at gmx.net>
CommitDate: Sat Jun 16 12:31:50 2012 +0200

    Ninja: build server fixes
    
    - disable cldeps on cygwin
    - don't "use" namespace std

diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 3f8a27e..557f065 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -383,7 +383,7 @@ IF(CMAKE_ENABLE_NINJA)
     cmNinjaUtilityTargetGenerator.h
     )
   ADD_DEFINITIONS(-DCMAKE_USE_NINJA)
-  IF(WIN32)
+  IF(WIN32 AND NOT CYGWIN)
     SET_SOURCE_FILES_PROPERTIES(cmcldeps.cxx PROPERTIES COMPILE_DEFINITIONS _WIN32_WINNT=0x0501)
     ADD_EXECUTABLE(cmcldeps cmcldeps.cxx)
     INSTALL_TARGETS(/bin cmcldeps)
diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx
index 962acdb..ce7ffc3 100644
--- a/Source/cmcldeps.cxx
+++ b/Source/cmcldeps.cxx
@@ -24,7 +24,6 @@
 #include <queue>
 #include <cstdio>
 
-using namespace std;
 
 #ifdef _WIN32
 #include <windows.h>
@@ -52,16 +51,16 @@ struct Subprocess {
 
   bool Done() const;
 
-  const string& GetOutput() const;
+  const std::string& GetOutput() const;
 
   int ExitCode() const { return exit_code_; }
 
  private:
   Subprocess();
-  bool Start(struct SubprocessSet* set, const string& command, const string& dir);
+  bool Start(struct SubprocessSet* set, const std::string& command, const std::string& dir);
   void OnPipeReady();
 
-  string buf_;
+  std::string buf_;
 
 #ifdef _WIN32
   /// Set up pipe_ as the parent-side pipe of the subprocess; return the
@@ -89,13 +88,13 @@ struct SubprocessSet {
   SubprocessSet();
   ~SubprocessSet();
 
-  Subprocess* Add(const string& command, const string& dir);
+  Subprocess* Add(const std::string& command, const std::string& dir);
   bool DoWork();
   Subprocess* NextFinished();
   void Clear();
 
-  vector<Subprocess*> running_;
-  queue<Subprocess*> finished_;
+  std::vector<Subprocess*> running_;
+  std::queue<Subprocess*> finished_;
 
 #ifdef _WIN32
   static BOOL WINAPI NotifyInterrupted(DWORD dwCtrlType);
@@ -137,7 +136,7 @@ static void Fatal(const char* msg, ...) {
 
 
 #ifdef _WIN32
-string GetLastErrorString() {
+std::string GetLastErrorString() {
   DWORD err = GetLastError();
 
   char* msg_buf;
@@ -151,7 +150,7 @@ string GetLastErrorString() {
         (char*)&msg_buf,
         0,
         NULL);
-  string msg = msg_buf;
+  std::string msg = msg_buf;
   LocalFree(msg_buf);
   return msg;
 }
@@ -244,8 +243,8 @@ HANDLE Subprocess::SetupPipe(HANDLE ioport) {
   return output_write_child;
 }
 
-bool Subprocess::Start(SubprocessSet* set, const string& command,
-                                           const string& dir) {
+bool Subprocess::Start(SubprocessSet* set, const std::string& command,
+                                           const std::string& dir) {
   HANDLE child_pipe = SetupPipe(set->ioport_);
 
   SECURITY_ATTRIBUTES security_attributes;
@@ -358,7 +357,7 @@ bool Subprocess::Done() const {
   return pipe_ == NULL;
 }
 
-const string& Subprocess::GetOutput() const {
+const std::string& Subprocess::GetOutput() const {
   return buf_;
 }
 
@@ -389,7 +388,7 @@ BOOL WINAPI SubprocessSet::NotifyInterrupted(DWORD dwCtrlType) {
   return FALSE;
 }
 
-Subprocess *SubprocessSet::Add(const string& command, const string& dir) {
+Subprocess *SubprocessSet::Add(const std::string& command, const std::string& dir) {
   Subprocess *subprocess = new Subprocess;
   if (!subprocess->Start(this, command, dir)) {
     delete subprocess;
@@ -420,7 +419,7 @@ bool SubprocessSet::DoWork() {
   subproc->OnPipeReady();
 
   if (subproc->Done()) {
-    vector<Subprocess*>::iterator end =
+    std::vector<Subprocess*>::iterator end =
         std::remove(running_.begin(), running_.end(), subproc);
     if (running_.end() != end) {
       finished_.push(subproc);
@@ -440,14 +439,14 @@ Subprocess* SubprocessSet::NextFinished() {
 }
 
 void SubprocessSet::Clear() {
-  for (vector<Subprocess*>::iterator i = running_.begin();
+  for (std::vector<Subprocess*>::iterator i = running_.begin();
        i != running_.end(); ++i) {
     if ((*i)->child_)
       if (!GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT,
                                     GetProcessId((*i)->child_)))
         Win32Fatal("GenerateConsoleCtrlEvent");
   }
-  for (vector<Subprocess*>::iterator i = running_.begin();
+  for (std::vector<Subprocess*>::iterator i = running_.begin();
        i != running_.end(); ++i)
     delete *i;
   running_.clear();
@@ -498,16 +497,16 @@ static void usage(const char* msg) {
           "<rest of command ...>\n", msg);
 }
 
-static string trimLeadingSpace(const string& cmdline) {
+static std::string trimLeadingSpace(const std::string& cmdline) {
   int i = 0;
   for (; cmdline[i] == ' '; ++i)
     ;
   return cmdline.substr(i);
 }
 
-static void doEscape(string& str, const string& search, const string& repl) {
-  string::size_type pos = 0;
-  while ((pos = str.find(search, pos)) != string::npos) {
+static void doEscape(std::string& str, const std::string& search, const std::string& repl) {
+  std::string::size_type pos = 0;
+  while ((pos = str.find(search, pos)) != std::string::npos) {
     str.replace(pos, search.size(), repl);
     pos += repl.size();
   }
@@ -515,8 +514,8 @@ static void doEscape(string& str, const string& search, const string& repl) {
 
 // Strips one argument from the cmdline and returns it. "surrounding quotes"
 // are removed from the argument if there were any.
-static string getArg(string& cmdline) {
-  string ret;
+static std::string getArg(std::string& cmdline) {
+  std::string ret;
   bool in_quoted = false;
   unsigned int i = 0;
 
@@ -539,15 +538,15 @@ static string getArg(string& cmdline) {
 }
 
 static void parseCommandLine(LPTSTR wincmdline,
-                             string& lang,
-                             string& srcfile,
-                             string& dfile,
-                             string& objfile,
-                             string& prefix,
-                             string& clpath,
-                             string& binpath,
-                             string& rest) {
-  string cmdline(wincmdline);
+                             std::string& lang,
+                             std::string& srcfile,
+                             std::string& dfile,
+                             std::string& objfile,
+                             std::string& prefix,
+                             std::string& clpath,
+                             std::string& binpath,
+                             std::string& rest) {
+  std::string cmdline(wincmdline);
   /* self */ getArg(cmdline);
   lang = getArg(cmdline);
   srcfile = getArg(cmdline);
@@ -559,8 +558,8 @@ static void parseCommandLine(LPTSTR wincmdline,
   rest = trimLeadingSpace(cmdline);
 }
 
-static void outputDepFile(const string& dfile, const string& objfile,
-        vector<string>& incs) {
+static void outputDepFile(const std::string& dfile, const std::string& objfile,
+        std::vector<std::string>& incs) {
 
   if (dfile.empty())
     return;
@@ -575,11 +574,11 @@ static void outputDepFile(const string& dfile, const string& objfile,
   if (!out)
     return;
 
-  string tmp = objfile;
+  std::string tmp = objfile;
   doEscape(tmp, " ", "\\ ");
   fprintf(out, "%s: \\\n", tmp.c_str());
 
-  for (vector<string>::iterator i(incs.begin()); i != incs.end(); ++i) {
+  for (std::vector<std::string>::iterator i(incs.begin()); i != incs.end(); ++i) {
     tmp = *i;
     doEscape(tmp, "\\", "/");
     doEscape(tmp, " ", "\\ ");
@@ -611,12 +610,12 @@ std::string replace(const std::string& str, const std::string& what,
 
 
 
-static int process( const string& srcfilename,
-                    const string& dfile,
-                    const string& objfile,
-                    const string& prefix,
-                    const string& cmd,
-                    const string& dir = "",
+static int process( const std::string& srcfilename,
+                    const std::string& dfile,
+                    const std::string& objfile,
+                    const std::string& prefix,
+                    const std::string& cmd,
+                    const std::string& dir = "",
                     bool quiet = false) {
 
   SubprocessSet subprocs;
@@ -632,17 +631,17 @@ static int process( const string& srcfilename,
   bool success = subproc->Finish() == ExitSuccess;
   int exit_code = subproc->ExitCode();
 
-  string output = subproc->GetOutput();
+  std::string output = subproc->GetOutput();
   delete subproc;
 
   // process the include directives and output everything else
-  stringstream ss(output);
-  string line;
-  vector<string> includes;
+  std::stringstream ss(output);
+  std::string line;
+  std::vector<std::string> includes;
   bool isFirstLine = true; // cl prints always first the source filename
   while (getline(ss, line)) {
     if (startsWith(line, prefix)) {
-      string inc = trimLeadingSpace(line.substr(prefix.size()).c_str());
+      std::string inc = trimLeadingSpace(line.substr(prefix.size()).c_str());
       if (inc[inc.size() - 1] == '\r') // blech, stupid \r\n
         inc = inc.substr(0, inc.size() - 1);
       includes.push_back(inc);
@@ -676,14 +675,14 @@ int main() {
   // subprocesses, so by avoiding argc/argv, the subprocess is called with
   // the same command line verbatim.
 
-  string lang, srcfile, dfile, objfile, prefix, cl, binpath, rest;
+  std::string lang, srcfile, dfile, objfile, prefix, cl, binpath, rest;
   parseCommandLine(GetCommandLine(), lang, srcfile, dfile, objfile,
                                      prefix, cl, binpath, rest);
 
   // needed to suppress filename output of msvc tools
-  string srcfilename;
+  std::string srcfilename;
   std::string::size_type pos = srcfile.rfind("\\");
-  if (pos != string::npos) {
+  if (pos != std::string::npos) {
     srcfilename = srcfile.substr(pos + 1);
   }
 
@@ -695,7 +694,7 @@ int main() {
   } else if (lang == "RC") {
     // "misuse" cl.exe to get headers from .rc files
 
-    string clrest = rest;
+    std::string clrest = rest;
     // rc: /fo x.dir\x.rc.res  ->  cl: /out:x.dir\x.rc.res.dep.obj
     clrest = replace(clrest, "/fo", "/out:");
     clrest = replace(clrest, objfile, objfile + ".dep.obj ");
@@ -705,9 +704,9 @@ int main() {
     cl = "\"" + cl + "\" /P /DRC_INVOKED ";
 
     // call cl in object dir so the .i is generated there
-    string objdir;
+    std::string objdir;
     std::string::size_type pos = objfile.rfind("\\");
-    if (pos != string::npos) {
+    if (pos != std::string::npos) {
       objdir = objfile.substr(0, pos);
     }
 

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

Summary of changes:
 Source/CMakeLists.txt |    2 +-
 Source/cmcldeps.cxx   |  146 ++++++++++++++++++++++++++-----------------------
 2 files changed, 79 insertions(+), 69 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list