[Cmake-commits] CMake branch, next, updated. v3.1.1-2288-g57e6b1c

Brad King brad.king at kitware.com
Fri Jan 23 10:54:21 EST 2015


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  57e6b1c3eff6a8179e98517081b3258849e75884 (commit)
       via  097e26f4908b3099f112c3fdc5e043234f9adc53 (commit)
      from  0a0c008eb5bc0e6380d5166315f417f5c97cc66f (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=57e6b1c3eff6a8179e98517081b3258849e75884
commit 57e6b1c3eff6a8179e98517081b3258849e75884
Merge: 0a0c008 097e26f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Jan 23 10:54:21 2015 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Jan 23 10:54:21 2015 -0500

    Merge topic 'ninja-rsp_file-calculation' into next
    
    097e26f4 ninja: use the minimum of all command line length limits (#14892)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=097e26f4908b3099f112c3fdc5e043234f9adc53
commit 097e26f4908b3099f112c3fdc5e043234f9adc53
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Wed Jan 14 13:11:44 2015 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Jan 23 10:54:13 2015 -0500

    ninja: use the minimum of all command line length limits (#14892)
    
    When choosing whether to use a response file, consider several possible
    command line length limits for the current operating system, and choose
    the smallest.

diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index a05719d..5595557 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -22,6 +22,7 @@
 
 #include <assert.h>
 #include <algorithm>
+#include <limits>
 
 #ifndef _WIN32
 #include <unistd.h>
@@ -371,15 +372,29 @@ cmNinjaNormalTargetGenerator
 
 static int calculateCommandLineLengthLimit(int linkRuleLength)
 {
+  static int const limits[] = {
 #ifdef _WIN32
-  return 8000 - linkRuleLength;
-#elif defined(__linux) || defined(__APPLE__) || defined(__HAIKU__)
-  // for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac
-  return ((int)sysconf(_SC_ARG_MAX)) - linkRuleLength - 1000;
-#else
-  (void)linkRuleLength;
-  return -1;
+    8000,
 #endif
+#if defined(__APPLE__) || defined(__HAIKU__) || defined(__linux)
+    // for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac
+    ((int)sysconf(_SC_ARG_MAX)) - 1000,
+#endif
+#if defined(__linux)
+    // #define MAX_ARG_STRLEN (PAGE_SIZE * 32) in Linux's binfmts.h
+    ((int)sysconf(_SC_PAGESIZE) * 32) - 1000,
+#endif
+    std::numeric_limits<int>::max()
+  };
+
+  size_t const arrSz = cmArraySize(limits);
+  int const sz = *std::min_element(limits, limits + arrSz);
+  if (sz == std::numeric_limits<int>::max())
+    {
+    return -1;
+    }
+
+  return sz - linkRuleLength;
 }
 
 

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

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list