[Cmake-commits] CMake branch, next, updated. v3.1.0-2270-g656ddc5
Ben Boeckel
ben.boeckel at kitware.com
Tue Jan 20 14:53:28 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 656ddc52c42f8fdfd22d331ceaa669c479124555 (commit)
via ddfe463d8f62641f2e80e0c5cc0cb78203ea63ac (commit)
from 850d020125bddf09624713a1c49fd42030b04ab1 (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=656ddc52c42f8fdfd22d331ceaa669c479124555
commit 656ddc52c42f8fdfd22d331ceaa669c479124555
Merge: 850d020 ddfe463
Author: Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Tue Jan 20 14:53:27 2015 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Jan 20 14:53:27 2015 -0500
Merge topic 'ninja-rsp_file-calculation' into next
ddfe463d ninja: use the minimum of all possible command line lengths
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ddfe463d8f62641f2e80e0c5cc0cb78203ea63ac
commit ddfe463d8f62641f2e80e0c5cc0cb78203ea63ac
Author: Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Wed Jan 14 13:11:44 2015 -0500
Commit: Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Tue Jan 20 14:53:03 2015 -0500
ninja: use the minimum of all possible command line lengths
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index e344df4..a926447 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>
@@ -358,15 +359,29 @@ cmNinjaNormalTargetGenerator
static int calculateCommandLineLengthLimit(int linkRuleLength)
{
+ static int 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 - linkRuleLength,
#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)) - linkRuleLength - 1000,
+#endif
+#if defined(__linux)
+ // #define MAX_ARG_STRLEN (PAGE_SIZE * 32) in Linux's binfmts.h
+ ((int)sysconf(_SC_PAGESIZE) * 32) - linkRuleLength - 1000,
+#endif
+ std::numeric_limits<int>::max()
+ };
+
+ size_t arrSz = cmArraySize(limits);
+ int sz = *std::min_element(limits, limits + arrSz);
+ if (sz == std::numeric_limits<int>::max())
+ {
+ return -1;
+ }
+
+ return sz;
}
-----------------------------------------------------------------------
Summary of changes:
Source/cmNinjaNormalTargetGenerator.cxx | 29 ++++++++++++++++++++++-------
1 file changed, 22 insertions(+), 7 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list