summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Make failing stat() calls abort the build.Nico Weber2015-03-196-40/+88
| | | | | | | | | | | | | | | | | | | | | | | | Fixes #830, fixes #904. In practice, this either happens with 64-bit inodes and a 32-bit userspace when building without -D_FILE_OFFSET_BITS=64 in CFLAGS, or when a filename is longer than the system file length limit. Since DiskInterface::Stat() returns -1 on error, and Node used -1 on "stat state unknown", not aborting the build lead to ninja stat()ing the same file over and over again, until it finally ran out of stack. That's now fixed. * Change RecomputeOutputsDirty() to return success instead of dirty state (like RecomputeDirty()) and return the dirty state in a bool outparam * Node::Stat()s old return value wasn't used anywhere, change the function to return success instead and add an |err| outparam * Node::StatIfNecessary()'s old return value was used only in one place. Change that place to explicitly check status_known() and make StatIfNecessary() return success and add an |err| outparam * Plan::CleanNode() can now fail, make it return bool and add an |err| outparam
* Add a missing &. (No behavior change, only used in tests.)Nico Weber2015-03-182-2/+2
|
* Env should only be about variables. No behavior change.Nico Weber2015-03-182-8/+2
|
* Merge pull request #930 from nico/depcolonNico Weber2015-03-175-6/+31
|\ | | | | On unexpected output in a .d file, rebuild instead erroring.
| * On unexpected output in a .d file, rebuild instead erroring.Nico Weber2015-03-122-3/+21
| | | | | | | | Fixes #417.
| * Reject depfiles that don't contain a : after the target name.Nico Weber2015-03-124-3/+10
| | | | | | | | This is a prerequisite for fixing #417.
* | Build self-consistent graphs for dupe edges with multiple outputs.Nico Weber2015-03-155-1/+46
|/ | | | | | | | | | | | | | | | | | | | | | Fixes #867, both the crashes and "[stuck]" issues. The problem was that a duplicate edge would modify the in_edge of the outputs of the new build rule, but the edge corresponding to the old build rule would still think that the in_edge points to itself. `old_edge->outputs_[0]->in_edge()` would not return `old_edge`, which confused the scan logic. As fix, let `State::AddOut()` reject changing in_edge if it's already set. This changes behavior in a minor way: Previously, if there were multiple edges for a single output, the last edge would be kept. Now, the first edge is kept. This only had mostly-well-defined semantics if all duplicate edges are the same (which is the only case I've seen in practice), and for that case the behavior doesn't change. For testing, add a VerifyGraph() function and call that every time any test graph is parsed. That's a bit more code than just copying the test cases from the bug into build_test.cc, but it also yields better test coverage overall.
* Merge pull request #917 from pinotree/rlimitNico Weber2015-03-091-2/+2
|\ | | | | subprocess_test: gracefully handle rlim.rlim_cur < kNumProcs
| * subprocess_test: gracefully handle rlim.rlim_cur < kNumProcsPino Toscano2015-02-281-2/+2
| | | | | | | | | | | | Instead of expecting that the number of open files is well above kNumProcs, simply "skip" the test in that case, still printing the message about the test limit (adding the current system limit too).
* | Merge pull request #910 from jlnt/masterNico Weber2015-03-092-5/+33
|\ \ | | | | | | POSIX: detach background subprocesses from terminal.
| * | POSIX: detach background subprocesses from terminal.Julien Tinnes2015-01-292-5/+33
| | | | | | | | | | | | | | | | | | | | | | | | Put background subprocesses (i.e. subprocesses with no access to the console) in their own session and detach them from the terminal. This fixes martine/ninja#909.
* | | Fix build with libc++ after #921.Nico Weber2015-03-091-29/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | It failed with error: field has incomplete type 'EvalString' note: in instantiation of exception specification for 'map' requested here explicit Rule(const string& name) : name_(name) {} ^
* | | Merge pull request #921 from mohamed/masterNico Weber2015-03-0910-87/+117
|\ \ \ | | | | | | | | Allow scoping rules through subninja
| * | | Added a new test to illustrate scoped rulesMohamed Bamakhrama2015-03-081-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | The new test shows the added value of scoped rules by demonstrating a multi-level build where a single rules file gets included at all the levels. By scoping rules, this is possible.
| * | | Allow scoping rules through subninjaMohamed Bamakhrama2015-03-0110-87/+104
| | |/ | |/| | | | | | | | | | | | | | | | | | | Ninja didn't support scoping rules through subninja and assumed a unique rule name in the whole namespace. With this change, this behavior is changed to allow scoping rules. Two rules can have the same name if they belong to two different scopes. However, two rules can NOT have the same name in the same scope.
* | | Directly pass the string instead of char * to Truncate util function. It ↵Pierre Schweitzer2015-03-071-1/+1
|/ / | | | | | | will prevent useless conversions.
* | Typo fix in graph.cctzik2015-02-061-1/+1
| |
* | Allow manifest rebuild to loop up to 100 timesColin Cross2015-02-031-14/+13
|/ | | | | | | | | Ninja generators that bootstrap themselves with Ninja may need to rebuild build.ninja multiple times. Replace the 2 cycle loop with a 100 cycle loop, and print the pass number each time it restarts. Original-author: Jamie Gennis <jgennis@gmail.com>
* Merge pull request #897 from tzik/pendingNico Weber2015-01-241-0/+21
|\ | | | | Check pending SIGINT after ppoll/pselect
| * Check pending SIGINT after ppoll/pselectTaiju Tsuiki2015-01-191-0/+21
| | | | | | | | | | | | | | | | | | ppoll/pselect prioritizes file descriptor events over a signal delivery. So a flood of events prevents ninja from reacting keyboard interruption by the user. This CL adds a check for pending keyboard interruptions after file descriptor events.
* | Remove an incorrect assert.Nico Weber2015-01-202-1/+10
| | | | | | | | | | | | The assert fires on cyclic manifests (found by afl-fuzz). Since there was explicit error handing for this case already, just remove the assert.
* | Merge pull request #894 from tfarina/has-indentNico Weber2015-01-141-4/+4
|\ \ | |/ |/| Cleanup: Fix 'hasIdent' variable name/style.
| * Cleanup: Fix 'hasIdent' variable name/style.Thiago Farina2015-01-101-4/+4
| | | | | | | | | | | | | | Seems more correct to name it has_indent_token and to use the unix_hacker style. Signed-off-by: Thiago Farina <tfarina@chromium.org>
* | Try to simplify d1e6a29 a bit.Nico Weber2015-01-041-3/+3
| |
* | Remove unused hash<std::string>.Nico Weber2015-01-041-9/+0
| | | | | | | | | | ExternalStringHashMap used to store std::strings long ago. Since it doesn't anymore, this specialization isn't needed. No behavior change.
* | Fix compilation errors on Visual Studio 2015 (_MSC_VER 1900).Beren Minor2014-12-312-4/+21
|/
* Remove 'Recompacting...' messages.Nico Weber2014-12-186-13/+2
| | | | | | | | | | Recompacting the build log used to be slow, so it made sense to print this message. We then made recompaction much faster, but didn't remove this message back then. The deps log only has it because the build log had it. Since both steps are effectively instant in practice, remove these log messages.
* Let DependencyScan::RecomputeDirty() work correclty with cyclic graphs.Nico Weber2014-12-083-4/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RecomputDirty(edge) currently works roughly like this: RecomputeDirty(edge): LoadDeps(edge) for in in edge.inputs: if in.StatIfNecessary(): RecomputeDirty(in.in_edge) # recurse into inputs for out in edge.outputs: out.StatIfNecessary() # mark outputs as visited It uses the stat state of each node to mark nodes as visited and doesn't traverse across nodes that have been visited already. For cyclic graphs with an edge with multiple outputs on the cycle, nothing prevents an edge to be visited more than once if the cycle is entered through an output that isn't on the cycle. In other words, RecomputeDirty() for the same edge can be on the call stack more than once. This is bad for at least two reasons: 1. Deps are added multiple times, making the graph confusing to reason about. 2. LoadDeps() will insert into the inputs_ of an edge that's iterated over in a callframe higher up. This can invalidate the iterator, which causes a crash when the callframe with the loop over the now-invalidated iterator resumes. To fix this, let RecomputeDirty() mark all outputs of an edge as visited as the first thing it does. This way, even if the edge is on a cycle with several outputs, each output is already marked and no edge will have its deps loaded more than once. Fixes the crashes in #875. (In practice, it turns the crashes into "stuck [this is a bug]" messages for now, due to the example without duplicate rules in #867)
* Rename a few iterators. No behavior change.Nico Weber2014-12-072-67/+67
| | | | | | | | | It confused me that the iterator iterating over `outputs_` was called `i` -- this always made me think of "input", not "iterator". Call iterators over edge outputs "o", iterators over edge inputs "i", iterators over node input edges "oe", and general iterators over edges "e".
* remove two unneeded `explicit`sNico Weber2014-12-072-3/+3
|
* Merge pull request #835 from rainlabs-eu/fix-cygwin-compatibilityNico Weber2014-12-041-1/+4
|\ | | | | Fixed cygwin compatibility (issue #806)
| * Fixed cygwin compatibility (issue #806)kwesolowski2014-10-251-1/+4
| | | | | | | | Fixed platform specific issues causing cygwin build to fail.
* | Rename num_collisions to collision_count.Nico Weber2014-12-041-3/+3
| | | | | | | | | | All other counting variables are called foo_count, not num_foos. No behavior change.
* | Revert #223, fixes #874.Nico Weber2014-12-041-5/+4
| | | | | | | | | | | | | | | | No test since there's still no good way to test code in ninja.cc. Going forward, either move NinjaMain to its own file with tests, or create a system that makes it possible to run integration tests on the ninja binary. Instead, add a comment that explains why the restat optimization isn't done.
* | win: Use full console width for status messages.Nico Weber2014-12-021-7/+4
| | | | | | | | | | | | | | | | | | | | The original overprinting code, added in 7b3d8c8e, used printf for printing the status. printf needs one column for the cursor, so the status message could only take up `width - 1` columns. fc554c22 changed Windows from printf to WriteConsoleOutput which doesn't move the cursor, so keeping one column empty is no longer needed. So stop doing that. Also remove a duplicate call to GetConsoleScreenBufferInfo.
* | win/lineprinter: Use a vector instead of manual memory management.Nico Weber2014-12-021-8/+4
| | | | | | | | No behavior change. Based on a patch from gmisocpp@gmail.com!
* | win: Let the "Pause" key or Ctrl-S pause output.Nico Weber2014-12-021-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | In cmd.exe, hitting the "Pause" key or Ctrl-S will pause programs until a key is pressed. This is apparently implemented when stdout is writing to, so use printf instead of Console functions to reset the cursor to the start of the line. Also happens to simplify the code. (This already worked in -v mode since that already prints using printf.) Based on a patch from gmisocpp@gmail.com!
* | mark this 1.5.3.gitNico Weber2014-11-241-1/+1
| |
* | drop NINJA_BOOTSTRAP defineEvan Martin2014-11-182-4/+3
| |
* | Make sure configure.py and ninja.cc always agree on if -t browse is included.Nico Weber2014-11-141-2/+2
| | | | | | | | | | | | | | | | | | No behavior change on most platforms. On solaris, -t browse was compiled in in ninja.cc but browse.cc wasn't compiled in, which probably means that building on Solaris didn't work. It might be better now. This also makes browse.cc automatically not included in bootstrap builds; previously this was done manually through the NINJA_BOOTSTRAP check.
* | Merge pull request #850 from sgraham/ocdNico Weber2014-11-123-19/+22
|\ \ | | | | | | whitespace/comment/wrap fixes, no intended functionality change
| * | whitespace/comment/wrap fixes, no intended functionality changeScott Graham2014-11-123-19/+22
| | |
* | | set *err when too many components in CanonicalizePathScott Graham2014-11-122-1/+7
|/ /
* | properly guard against slash_bits overflowScott Graham2014-11-122-2/+33
| |
* | fix not respecting lengthScott Graham2014-11-111-14/+18
| |
* | no need to save slash_bits, add commentScott Graham2014-11-111-9/+9
| |
* | save slash_bits in depslogScott Graham2014-11-111-9/+8
| |
* | no need to Decanonicalize on non-WindowsScott Graham2014-11-111-0/+2
| |
* | fix CanonicalizePath going past StringPiece length + testScott Graham2014-11-102-0/+12
| |
* | initialize slash_bits on non-winScott Graham2014-11-101-0/+2
| |