platform/upstream/ninja.git
9 years agoPrint output file on failure
Colin Cross [Mon, 5 Oct 2015 21:17:56 +0000 (14:17 -0700)]
Print output file on failure

Modify the FAILED: output to provide the output files that failed to
build, followed by the failed command on the next line.  This makes the
failure much easier to read, as you can immediately see much shorter
name of the file that failed instead of trying to parse a very long
command line.  It also makes manually re-running the failed command much
easier because you can copy the whole line without ending up with the
FAILED: prefix.

9 years agoMerge pull request #1014 from moroten/optimize-stringpiece
Nico Weber [Mon, 7 Sep 2015 23:52:25 +0000 (16:52 -0700)]
Merge pull request #1014 from moroten/optimize-stringpiece

Optimize StringPiece hash map

9 years agoMerge pull request #1018 from nico/spell
Nico Weber [Mon, 7 Sep 2015 21:35:21 +0000 (14:35 -0700)]
Merge pull request #1018 from nico/spell

Merge LLVM r242069, make spell checking allocate less memory.

9 years agoMerge LLVM r242069, make spell checking allocate less memory.
Nico Weber [Mon, 7 Sep 2015 21:26:19 +0000 (14:26 -0700)]
Merge LLVM r242069, make spell checking allocate less memory.

9 years agoOptimize StringPiece hash map
Fredrik Medley [Fri, 12 Jun 2015 21:59:12 +0000 (23:59 +0200)]
Optimize StringPiece hash map

Replace strncmp with memcmp to improve performance.

Signed-off-by: Fredrik Medley <fredrik.medley@gmail.com>
9 years agoMerge pull request #1009 from sgraham/fix-null.o
Nico Weber [Thu, 27 Aug 2015 06:34:48 +0000 (23:34 -0700)]
Merge pull request #1009 from sgraham/fix-null.o

Don't output null.o during configure

9 years agoDon't output null.o during configure
Scott Graham [Thu, 27 Aug 2015 02:51:15 +0000 (19:51 -0700)]
Don't output null.o during configure

9 years agoMerge pull request #1003 from sgraham/2015-compile
Nico Weber [Mon, 10 Aug 2015 15:35:33 +0000 (08:35 -0700)]
Merge pull request #1003 from sgraham/2015-compile

Fix compile on VS2015

9 years agoRemove accidental changes
Scott Graham [Mon, 10 Aug 2015 04:27:39 +0000 (21:27 -0700)]
Remove accidental changes

9 years agoSome mucking with std:: for set_terminate and terminate_handler
Scott Graham [Mon, 10 Aug 2015 04:25:09 +0000 (21:25 -0700)]
Some mucking with std:: for set_terminate and terminate_handler

9 years agoSet _HAS_EXCEPTIONS=0 on MSVC
Scott Graham [Mon, 10 Aug 2015 04:02:23 +0000 (21:02 -0700)]
Set _HAS_EXCEPTIONS=0 on MSVC

9 years agoMerge pull request #998 from LindleyF/stdc-format-macros
Nico Weber [Mon, 3 Aug 2015 00:30:44 +0000 (17:30 -0700)]
Merge pull request #998 from LindleyF/stdc-format-macros

Make sure not to re-define __STDC_FORMAT_MACROS.

9 years agoMake sure not to re-define __STDC_FORMAT_MACROS.
Lindley French [Fri, 31 Jul 2015 00:33:11 +0000 (17:33 -0700)]
Make sure not to re-define __STDC_FORMAT_MACROS.

9 years agoMerge pull request #997 from mikesep/assert-arg-order
Nico Weber [Thu, 30 Jul 2015 18:21:47 +0000 (11:21 -0700)]
Merge pull request #997 from mikesep/assert-arg-order

Correct order of ASSERT_EQ arguments

9 years agoCorrect order of ASSERT_EQ arguments
Mike Seplowitz [Tue, 21 Jul 2015 22:13:26 +0000 (18:13 -0400)]
Correct order of ASSERT_EQ arguments

The correct order is ASSERT_EQ(expected, actual).

9 years agoMerge pull request #988 from nico/slashes
Nico Weber [Fri, 10 Jul 2015 19:24:23 +0000 (12:24 -0700)]
Merge pull request #988 from nico/slashes

win: print right slashes in 'unknown target' message

9 years agowin: print right slashes in 'unknown target' message
Nico Weber [Fri, 10 Jul 2015 19:15:00 +0000 (12:15 -0700)]
win: print right slashes in 'unknown target' message

9 years agoMerge pull request #973 from sgraham/canonicalize-fix
Nico Weber [Sun, 5 Jul 2015 22:53:46 +0000 (15:53 -0700)]
Merge pull request #973 from sgraham/canonicalize-fix

Fix crash in attempting to canonicalize paths longer than _MAX_PATH

9 years agoMerge pull request #979 from stinb/bootstrap-out-of-source
Nico Weber [Sun, 5 Jul 2015 22:53:28 +0000 (15:53 -0700)]
Merge pull request #979 from stinb/bootstrap-out-of-source

Bootstrap out of source

9 years agofix typos, punctuation, redundant words in HACKING.md
Nico Weber [Thu, 2 Jul 2015 00:52:16 +0000 (17:52 -0700)]
fix typos, punctuation, redundant words in HACKING.md

9 years agoMerge pull request #984 from martine/vcvars
Nico Weber [Wed, 1 Jul 2015 00:00:42 +0000 (17:00 -0700)]
Merge pull request #984 from martine/vcvars

point people at more detailed build docs if they're on Windows

9 years agopoint people at more detailed build docs if they're on Windows
Evan Martin [Tue, 30 Jun 2015 22:26:20 +0000 (15:26 -0700)]
point people at more detailed build docs if they're on Windows

It's a hard balance between "most people want to run configure --bootstrap" and
"here's a massive wall of text of every detail about building".  I think the
balance in this change is better than it was before -- most people on Windows
don't want to build their own binary.

Fixes #983.

9 years agomark this 1.6.0.git
Nico Weber [Mon, 29 Jun 2015 17:16:35 +0000 (10:16 -0700)]
mark this 1.6.0.git

9 years agoFix bootstrap from a source path containing spaces.
Jason Haslam [Mon, 22 Jun 2015 22:28:04 +0000 (16:28 -0600)]
Fix bootstrap from a source path containing spaces.

9 years agoSearch for generated headers relative to build dir.
Jason Haslam [Tue, 26 May 2015 22:47:18 +0000 (16:47 -0600)]
Search for generated headers relative to build dir.

9 years agoAllow configure script to bootstrap out of source.
Jason Haslam [Tue, 26 May 2015 21:19:28 +0000 (15:19 -0600)]
Allow configure script to bootstrap out of source.

9 years agoMerge pull request #978 from martine/revert-971-bootstrap-out-of-source
Nico Weber [Mon, 22 Jun 2015 20:44:24 +0000 (13:44 -0700)]
Merge pull request #978 from martine/revert-971-bootstrap-out-of-source

Revert "Bootstrap out of source"

9 years agoRevert "Bootstrap out of source"
Nico Weber [Mon, 22 Jun 2015 20:35:37 +0000 (13:35 -0700)]
Revert "Bootstrap out of source"

9 years agoMerge pull request #975 from nico/docs
Nico Weber [Fri, 19 Jun 2015 00:34:37 +0000 (17:34 -0700)]
Merge pull request #975 from nico/docs

Document the change from #921 in the manual.

9 years agoDocument the change from #921 in the manual.
Nico Weber [Fri, 19 Jun 2015 00:22:48 +0000 (17:22 -0700)]
Document the change from #921 in the manual.

9 years agoMerge pull request #971 from stinb/bootstrap-out-of-source
Nico Weber [Thu, 18 Jun 2015 23:39:30 +0000 (16:39 -0700)]
Merge pull request #971 from stinb/bootstrap-out-of-source

Bootstrap out of source

9 years agoMerge pull request #970 from nico/explain
Nico Weber [Thu, 18 Jun 2015 23:38:48 +0000 (16:38 -0700)]
Merge pull request #970 from nico/explain

Add a missing EXPLAIN() call.

9 years agodon't alias input/output in ExtractDeps (i.e. actually works now)
Scott Graham [Thu, 18 Jun 2015 22:52:25 +0000 (15:52 -0700)]
don't alias input/output in ExtractDeps (i.e. actually works now)

9 years agopropagate include normalization failure to caller instead
Scott Graham [Thu, 18 Jun 2015 22:41:47 +0000 (15:41 -0700)]
propagate include normalization failure to caller instead

9 years agoError+exit -> Fatal
Scott Graham [Thu, 18 Jun 2015 22:06:42 +0000 (15:06 -0700)]
Error+exit -> Fatal

9 years agoMerge pull request #974 from bradking/add-missing-initializer
Nico Weber [Thu, 18 Jun 2015 21:47:41 +0000 (14:47 -0700)]
Merge pull request #974 from bradking/add-missing-initializer

Add missing member initializer in Edge constructor

9 years agoAdd missing member initializer in Edge constructor
Brad King [Tue, 16 Jun 2015 17:38:55 +0000 (13:38 -0400)]
Add missing member initializer in Edge constructor

In commit v1.1.0^2~15^2~20 (stub out an api and de-constify Pool,
2012-10-03) the Edge "pool_" member was added as a raw pointer but the
initializer was accidentally left out of the constructor.  Add it now.

9 years agodon't abort()
Scott Graham [Tue, 9 Jun 2015 17:15:11 +0000 (10:15 -0700)]
don't abort()

9 years agopush error to caller and abort on failure
Scott Graham [Tue, 9 Jun 2015 00:17:55 +0000 (17:17 -0700)]
push error to caller and abort on failure

9 years agoFix crash in attempting to canonicalize paths longer than _MAX_PATH
Scott Graham [Mon, 8 Jun 2015 20:21:55 +0000 (13:21 -0700)]
Fix crash in attempting to canonicalize paths longer than _MAX_PATH

9 years agoSearch for generated headers relative to build dir.
Jason Haslam [Tue, 26 May 2015 22:47:18 +0000 (16:47 -0600)]
Search for generated headers relative to build dir.

9 years agoAllow configure script to bootstrap out of source.
Jason Haslam [Tue, 26 May 2015 21:19:28 +0000 (15:19 -0600)]
Allow configure script to bootstrap out of source.

9 years agoAdd a missing EXPLAIN() call.
Nico Weber [Fri, 15 May 2015 00:37:50 +0000 (17:37 -0700)]
Add a missing EXPLAIN() call.

9 years agoFix typo in comment.
Nico Weber [Sat, 2 May 2015 21:38:43 +0000 (14:38 -0700)]
Fix typo in comment.

9 years agoMerge pull request #962 from sgraham/pool-use-fix
Nico Weber [Wed, 29 Apr 2015 21:26:54 +0000 (14:26 -0700)]
Merge pull request #962 from sgraham/pool-use-fix

Fix pool use count going unbalanced

9 years agoMerge pull request #743 from nicolasdespres/sigterm
Nico Weber [Mon, 27 Apr 2015 23:42:39 +0000 (16:42 -0700)]
Merge pull request #743 from nicolasdespres/sigterm

Handle SIGTERM properly.

9 years agosimplify & inline
Scott Graham [Mon, 27 Apr 2015 18:12:43 +0000 (11:12 -0700)]
simplify & inline

9 years agoavoid calling ResumeDelayedJobs instead
Scott Graham [Fri, 24 Apr 2015 23:06:55 +0000 (16:06 -0700)]
avoid calling ResumeDelayedJobs instead

9 years agoadd comment
Scott Graham [Fri, 24 Apr 2015 21:25:17 +0000 (14:25 -0700)]
add comment

9 years agoForward interruption signal to child processes.
Nicolas Despres [Wed, 16 Apr 2014 08:08:42 +0000 (10:08 +0200)]
Forward interruption signal to child processes.

9 years agoAllow SIGTERM for interruption.
Nicolas Despres [Wed, 16 Apr 2014 08:05:25 +0000 (10:05 +0200)]
Allow SIGTERM for interruption.

Default signal sent by many other programs (mainly kill(1)) to gently
terminates another one is SIGTERM.

9 years agoFix pool use count going unbalanced
Scott Graham [Thu, 23 Apr 2015 22:54:28 +0000 (15:54 -0700)]
Fix pool use count going unbalanced

9 years agoMerge pull request #958 from rui314/master
Nico Weber [Sun, 19 Apr 2015 03:43:24 +0000 (20:43 -0700)]
Merge pull request #958 from rui314/master

Run more than 34 processes on Win32 if we have 32+ cores.

9 years agoRun more than 34 processes on Win32 if we have 32+ cores.
Rui Ueyama [Fri, 17 Apr 2015 21:14:44 +0000 (14:14 -0700)]
Run more than 34 processes on Win32 if we have 32+ cores.

For compatiblity reason, dwNumberOfProcessors in Win32 is capped at 32.
So even if your machine has more than 32 cores, Ninja spawns at most 34
subprocesses. This patch fixes the issue by using GetNativeSystemInfo,
which returns the system info from Wow64 point of view, instead of
GetSystemInfo.

9 years agoMerge pull request #954 from nico/fix
Nico Weber [Thu, 9 Apr 2015 18:47:28 +0000 (11:47 -0700)]
Merge pull request #954 from nico/fix

Fix an assert (and tests in --debug mode) after #921.

9 years agoFix an assert (and tests in --debug mode) after #921.
Nico Weber [Thu, 9 Apr 2015 18:41:40 +0000 (11:41 -0700)]
Fix an assert (and tests in --debug mode) after #921.

9 years agoMerge pull request #953 from Sushisource/graphivz_fix
Nico Weber [Wed, 8 Apr 2015 19:46:19 +0000 (12:46 -0700)]
Merge pull request #953 from Sushisource/graphivz_fix

Fix backslashes in graphviz causing incorrect rendering on windows.

9 years agoFix backslashes in graphviz causing incorrect rendering on windows.
Spencer Judge [Tue, 7 Apr 2015 21:18:43 +0000 (14:18 -0700)]
Fix backslashes in graphviz causing incorrect rendering on windows.

9 years agoMerge pull request #951 from nico/cyclefix2
Nico Weber [Wed, 1 Apr 2015 21:18:39 +0000 (14:18 -0700)]
Merge pull request #951 from nico/cyclefix2

Don't get stuck on cyclic graphs where one edge has multiple outputs.

9 years agoDon't get stuck on cyclic graphs where one edge has multiple outputs.
Nico Weber [Wed, 1 Apr 2015 15:09:28 +0000 (08:09 -0700)]
Don't get stuck on cyclic graphs where one edge has multiple outputs.

Fixes #934. Plan::AddSubTarget() tracks in want_ if each edge has been
visited and visits every edge only once.  But Plan::CheckDependencyCycle()
worked on nodes however, so if a cycle was entered through an edge with
multiple outputs, ninja would fail to detect that cycle.

Move cycle detection to look for duplicate edges instead of nodes to fix
this.  The extra jump makes CheckDependencyCycle() a bit slower: for a
synthetic build file with 10000 serial build steps, `ninja -n` now takes
0.32s instead of 0.26s before on my laptop.  In practice, projects have
a dependency change length on the order of 50, so there shouldn't be a
noticeable slowdown in practice.  (If this does end up being a problem:
CheckDependencyCycle() currently does O(n) work and is called O(m) times
from AddSubTarget(), so I think cycle checking is O(n^2) in the build
depth.  So instead of worrying about constant overhead, we could use
a set<> instead of a stack<>.  But it doesn't seem to be a problem in
practice.)

9 years agoMerge pull request #950 from nico/cleanup
Nico Weber [Wed, 1 Apr 2015 15:18:49 +0000 (08:18 -0700)]
Merge pull request #950 from nico/cleanup

Simplify Plan's cycle detection code. No behavior change.

9 years agoCleanup: Don't search stack for cycle elements twice.
Nico Weber [Wed, 1 Apr 2015 15:00:27 +0000 (08:00 -0700)]
Cleanup: Don't search stack for cycle elements twice.

The common case is that there is no cycle.  In that case,
CheckDependencyCycle() searched the stack for a dupe from the back,
wouldn't find one, and return false.

If there was a cycle, it would then search again from the front
(probably because the push_back() that used to be here would invalidate
the ri iterator).

Since the push_back() is gone, just search from the front once. No
intended behavior change.

9 years agoCleanup: Make stack a const ref now that it's no longer modified.
Nico Weber [Wed, 1 Apr 2015 14:59:38 +0000 (07:59 -0700)]
Cleanup: Make stack a const ref now that it's no longer modified.

9 years agoCleanup: Don't modify during cycle checking.
Nico Weber [Wed, 1 Apr 2015 14:56:14 +0000 (07:56 -0700)]
Cleanup: Don't modify  during cycle checking.

9 years agoMerge pull request #949 from nico/staterr
Nico Weber [Tue, 31 Mar 2015 19:59:49 +0000 (12:59 -0700)]
Merge pull request #949 from nico/staterr

Let Stat() have an err outparam instead of writing to stderr.

9 years agoLet Stat() have an err outparam instead of writing to stderr.
Nico Weber [Tue, 31 Mar 2015 15:12:12 +0000 (08:12 -0700)]
Let Stat() have an err outparam instead of writing to stderr.

Also check for Stat() failure in a few more places.

This way, ninja doesn't print two "ninja: error: " lines if stat() fails
during a build.  It also makes it easier to keep the stat tests quiet.
Every caller of Stat() needs to explicitly log the error string if
that's desired.

9 years agoMerge pull request #945 from nico/reldocs
Nico Weber [Wed, 25 Mar 2015 21:13:49 +0000 (14:13 -0700)]
Merge pull request #945 from nico/reldocs

make notes on how to update docs more detailed

9 years agomake notes on how to update docs more detailed
Nico Weber [Wed, 25 Mar 2015 19:19:14 +0000 (12:19 -0700)]
make notes on how to update docs more detailed

9 years agoMerge pull request #944 from nico/flags
Nico Weber [Wed, 25 Mar 2015 03:53:06 +0000 (20:53 -0700)]
Merge pull request #944 from nico/flags

Add an opt-in flag to make duplicate edges an error (`-w dupbuild=err`).

9 years agoAdd an opt-in flag to make duplicate edges an error (`-w dupbuild=err`).
Nico Weber [Tue, 24 Mar 2015 21:16:07 +0000 (14:16 -0700)]
Add an opt-in flag to make duplicate edges an error (`-w dupbuild=err`).

This is step 1 on #931.  Duplicated edges will become an error by default in
the future.

9 years agoSwap order of -k and -l in help output, to keep the list alphabetized.
Nico Weber [Tue, 24 Mar 2015 20:37:11 +0000 (13:37 -0700)]
Swap order of -k and -l in help output, to keep the list alphabetized.

9 years agoMerge pull request #943 from nico/ssshh
Nico Weber [Tue, 24 Mar 2015 02:51:35 +0000 (19:51 -0700)]
Merge pull request #943 from nico/ssshh

Make tests quiet again, and prepare for making duplicate build edges an error.

9 years agoMake tests quiet again.
Nico Weber [Tue, 24 Mar 2015 01:18:01 +0000 (18:18 -0700)]
Make tests quiet again.

9 years agoMove warning emission on dupe edges from State to ManifestParser.
Nico Weber [Tue, 24 Mar 2015 01:16:36 +0000 (18:16 -0700)]
Move warning emission on dupe edges from State to ManifestParser.

This will make it easier to optionally make this an error (because
ManifestParser has a way of printing errors), and it'll also make
it easier to make the tests quiet again.

No behavior change.

9 years agoMerge pull request #942 from nico/cyclefix2
Nico Weber [Sat, 21 Mar 2015 15:28:59 +0000 (08:28 -0700)]
Merge pull request #942 from nico/cyclefix2

Don't crash on cyclic references between rule bindings.

9 years agoPreallocate edge node vectors. ~1% faster.
Nico Weber [Sat, 21 Mar 2015 04:21:14 +0000 (21:21 -0700)]
Preallocate edge node vectors. ~1% faster.

9 years agoRecover slowdown for cyclic rule bindings fix.
Nico Weber [Sat, 21 Mar 2015 04:11:31 +0000 (21:11 -0700)]
Recover slowdown for cyclic rule bindings fix.

9 years agoDon't crash on cyclic references between rule bindings.
Nico Weber [Wed, 18 Mar 2015 20:54:16 +0000 (16:54 -0400)]
Don't crash on cyclic references between rule bindings.

Fixes #902.

This dynamically detects cycles.  I like this approach less than
detecting them statically when parsing rules [1], but it has the
advantage that it doesn't break existing ninja manifest files.

It has the disadvantage that it slows down manifest_parser_perftest by
3.9%.

1: https://github.com/martine/ninja/commit/cc6f54d6d436047

9 years agoMerge pull request #940 from nico/moredupes
Nico Weber [Thu, 19 Mar 2015 23:57:54 +0000 (16:57 -0700)]
Merge pull request #940 from nico/moredupes

Another crash fix for duplicate edges. Fixes #939.

9 years agoAnother crash fix for duplicate edges. Fixes #939.
Nico Weber [Thu, 19 Mar 2015 23:42:06 +0000 (16:42 -0700)]
Another crash fix for duplicate edges. Fixes #939.

Patch #933 fixed a crash with duplicate edges by not adding edges to the
graph if all the edge's outputs are already built by other edges.
However, it added the edge to the out_edges of the edge's input nodes
before deleting it, letting inputs refer to dead edges.

To fix, move the check for deleting an edge above the code that adds
inputs.  Expand VerifyGraph() to check that nodes don't refer to edges
that aren't present in the state.

9 years agoMerge pull request #938 from nico/aflclang
Nico Weber [Thu, 19 Mar 2015 18:49:53 +0000 (11:49 -0700)]
Merge pull request #938 from nico/aflclang

Add notes on using afl-fuzz to HACKING.

9 years agoAdd notes on using afl-fuzz to HACKING.
Nico Weber [Tue, 3 Mar 2015 01:11:30 +0000 (17:11 -0800)]
Add notes on using afl-fuzz to HACKING.

9 years agoMerge pull request #937 from nico/statfix
Nico Weber [Thu, 19 Mar 2015 17:13:43 +0000 (10:13 -0700)]
Merge pull request #937 from nico/statfix

Make failing stat() calls abort the build.

9 years agoMake failing stat() calls abort the build.
Nico Weber [Thu, 19 Mar 2015 15:42:46 +0000 (08:42 -0700)]
Make failing stat() calls abort the build.

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

9 years agoMerge pull request #936 from nico/cleanup
Nico Weber [Thu, 19 Mar 2015 03:56:28 +0000 (20:56 -0700)]
Merge pull request #936 from nico/cleanup

Minor cleanups. No behavior change.

9 years agoAdd a missing &. (No behavior change, only used in tests.)
Nico Weber [Wed, 18 Mar 2015 20:39:26 +0000 (16:39 -0400)]
Add a missing &.  (No behavior change, only used in tests.)

9 years agoEnv should only be about variables. No behavior change.
Nico Weber [Wed, 18 Mar 2015 16:35:57 +0000 (12:35 -0400)]
Env should only be about variables.  No behavior change.

9 years agoMerge pull request #930 from nico/depcolon
Nico Weber [Tue, 17 Mar 2015 01:21:15 +0000 (18:21 -0700)]
Merge pull request #930 from nico/depcolon

On unexpected output in a .d file, rebuild instead erroring.

9 years agoMerge pull request #933 from nico/dupeedgefix
Nico Weber [Sun, 15 Mar 2015 23:49:24 +0000 (16:49 -0700)]
Merge pull request #933 from nico/dupeedgefix

Build self-consistent graphs for dupe edges with multiple outputs.

9 years agoBuild self-consistent graphs for dupe edges with multiple outputs.
Nico Weber [Sun, 15 Mar 2015 23:34:03 +0000 (19:34 -0400)]
Build self-consistent graphs for dupe edges with multiple outputs.

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.

9 years agoOn unexpected output in a .d file, rebuild instead erroring.
Nico Weber [Thu, 12 Mar 2015 16:06:50 +0000 (12:06 -0400)]
On unexpected output in a .d file, rebuild instead erroring.

Fixes #417.

9 years agoReject depfiles that don't contain a : after the target name.
Nico Weber [Thu, 12 Mar 2015 15:59:45 +0000 (11:59 -0400)]
Reject depfiles that don't contain a : after the target name.

This is a prerequisite for fixing #417.

9 years agoMerge pull request #928 from nico/novar
Evan Martin [Tue, 10 Mar 2015 23:47:44 +0000 (16:47 -0700)]
Merge pull request #928 from nico/novar

Remove option no longer needed now that we don't use gtest.

9 years agoRemove option no longer needed now that we don't use gtest.
Nico Weber [Tue, 10 Mar 2015 20:45:17 +0000 (13:45 -0700)]
Remove option no longer needed now that we don't use gtest.

9 years agoSimplify. No behavior change.
Nico Weber [Tue, 10 Mar 2015 16:09:49 +0000 (09:09 -0700)]
Simplify.  No behavior change.

9 years agoMerge pull request #917 from pinotree/rlimit
Nico Weber [Mon, 9 Mar 2015 22:50:30 +0000 (15:50 -0700)]
Merge pull request #917 from pinotree/rlimit

subprocess_test: gracefully handle rlim.rlim_cur < kNumProcs

9 years agoMerge pull request #910 from jlnt/master
Nico Weber [Mon, 9 Mar 2015 18:32:25 +0000 (11:32 -0700)]
Merge pull request #910 from jlnt/master

POSIX: detach background subprocesses from terminal.

9 years agoMerge pull request #927 from nico/colorgcc
Nico Weber [Mon, 9 Mar 2015 17:34:08 +0000 (10:34 -0700)]
Merge pull request #927 from nico/colorgcc

Make diagnostics colored with new gccs (4.9+) too.

9 years agoMake diagnostics colored with new gccs (4.9+) too.
Nico Weber [Mon, 9 Mar 2015 17:24:41 +0000 (10:24 -0700)]
Make diagnostics colored with new gccs (4.9+) too.

Both clang and gcc understand -fdiagnostics-color, so use that flag name.
(This will disable colored diagnostics for clangs older than LLVM 3.3,
but that is several years old by now.)

9 years agoMerge pull request #926 from nico/fixlibcpp
Nico Weber [Mon, 9 Mar 2015 04:49:37 +0000 (21:49 -0700)]
Merge pull request #926 from nico/fixlibcpp

Fix build with libc++ after #921.