Evan Martin [Thu, 12 Sep 2013 02:05:21 +0000 (19:05 -0700)]
mark this 1.4.0.git, update RELEASING
Nico Weber [Wed, 11 Sep 2013 21:50:04 +0000 (14:50 -0700)]
Merge pull request #657 from sgraham/keeprsp2
add -d keeprsp to preserve @rsp files on success on windows
Scott Graham [Tue, 10 Sep 2013 22:34:01 +0000 (15:34 -0700)]
add -d keeprsp to preserve @rsp files on success on windows
Nico Weber [Sun, 8 Sep 2013 02:16:49 +0000 (19:16 -0700)]
Merge pull request #655 from nico/simp
Simplify.
Nico Weber [Sun, 8 Sep 2013 02:16:21 +0000 (19:16 -0700)]
Simplify.
Nico Weber [Sun, 8 Sep 2013 02:14:17 +0000 (19:14 -0700)]
Merge pull request #654 from rgeary1/buildTestFix
Fix for build test for BuildWithDepsLogTest.RestatMissingDepfileDepslog
Richard Geary [Sat, 7 Sep 2013 14:03:00 +0000 (10:03 -0400)]
Fix for build test for BuildWithDepsLogTest.RestatMissingDepfileDepslog
Nico Weber [Fri, 6 Sep 2013 21:37:33 +0000 (14:37 -0700)]
Merge pull request #653 from nico/msg
Make depslog v1->v3 message less scary.
Nico Weber [Fri, 6 Sep 2013 21:29:32 +0000 (14:29 -0700)]
Make depslog v1->v3 message less scary.
See the comment 5 lines up for details.
Nico Weber [Mon, 2 Sep 2013 23:10:59 +0000 (16:10 -0700)]
Merge pull request #650 from nico/simplify
Simplify.
Nico Weber [Mon, 2 Sep 2013 23:09:00 +0000 (16:09 -0700)]
Simplify.
Nico Weber [Mon, 2 Sep 2013 23:02:44 +0000 (16:02 -0700)]
Merge pull request #649 from nico/fff
Delete a line I failed to delete in
d7a46654a7be1.
Nico Weber [Mon, 2 Sep 2013 23:01:46 +0000 (16:01 -0700)]
Delete a line I failed to delete in
d7a46654a7be1.
Nico Weber [Mon, 2 Sep 2013 22:52:21 +0000 (15:52 -0700)]
Merge pull request #648 from nico/landmaxim
Land the majority of pull request #608.
Maxim Kalaev [Mon, 2 Sep 2013 22:44:32 +0000 (15:44 -0700)]
Fix restat rebuild if deps are missing.
Fixes issue #603.
Apparently, the problem was caused by my fix r "consider target dirty if
depfile is missing" (bcc8ad1), which was not working correctly with
restat rules cleaning nodes. Switching to deps only triggered an easily
observable issue.
Fix by setting a flag in edges with invalid deps, and not cleaning edges
with that flag set.
Maxim Kalaev [Mon, 2 Sep 2013 22:32:19 +0000 (15:32 -0700)]
Share more code between CleanNode() and RecomputeDirty().
Move a common loop into the new function RecomputeOutputsDirty().
Simplifies things a bit, and makes it harder for the restat path to have
different behavior from the regular path.
No dramatic behavior change (the restat path now also calls
RestatIfNecessary()).
Maxim Kalaev [Mon, 2 Sep 2013 22:24:26 +0000 (15:24 -0700)]
Check depslog timestamp in LoadDepsFromLog(), not in RecomputeOutputDirty().
RecomputeOutputDirty() is called from two places:
1. RecomputeDirty(), which calls LoadDeps().
2. CleanNode(), which always passes 0 for the deps mtime.
So this is no behavior change in either case.
deps_mtime was nonzero only in deps mode, and it got passed all over the
place. This makes things simpler.
Evan Martin [Mon, 2 Sep 2013 19:12:23 +0000 (12:12 -0700)]
Merge pull request #647 from bmeurer/SimplifyGetProcessorCount
Simplify implementation of GetProcessorCount().
Benedikt Meurer [Sun, 1 Sep 2013 09:12:23 +0000 (11:12 +0200)]
Simplify implementation of GetProcessorCount().
The current implementation is unnecessarily complex, because:
- The BSD derived systems implement sysconf(_SC_NPROCESSORS_ONLN)
in terms of sysctl({CTL_HW,HW_NCPU}).
- get_nprocs() is a GNU extension, and glibc implements
sysconf(_SC_NPROCESSORS_ONLN) in terms of get_nprocs().
Nico Weber [Wed, 28 Aug 2013 22:03:10 +0000 (15:03 -0700)]
Merge pull request #645 from nico/maximfix
Fix an issue with more than 64k deps, spotted by maximuska.
Nico Weber [Wed, 28 Aug 2013 22:00:05 +0000 (15:00 -0700)]
Fix an issue with more than 64k deps, spotted by maximuska.
Also add a test for this case, which would have spotted the issue too.
Nico Weber [Wed, 28 Aug 2013 21:05:04 +0000 (14:05 -0700)]
Merge pull request #644 from nico/v3
Deps log format v3
Nico Weber [Wed, 28 Aug 2013 21:03:53 +0000 (14:03 -0700)]
document an assumption
Nico Weber [Wed, 28 Aug 2013 20:29:02 +0000 (13:29 -0700)]
Deps log format v3
This fixes two bugs.
1.) It makes the record size field 4 byte instead of 2, and allows a max
record size of 512kB. This fixes #605, ninja "only" supporting 8k
dependencies per file -- 512kB have room for 128k dependencies. (If that's
still not enough, the current design can support at least 4x that if the
constant is tweaked.)
2.) It makes all records 4-byte aligned, which is probably needed to make the
`reinterpret_cast<int*>(buf)` work on SPARC (cf issue #481), and it's
generally nicer too. (Since there's already one reinterpret_cast, convert
a memcpy() to reinterpret_cast in another branch too).
Nico Weber [Mon, 26 Aug 2013 23:10:24 +0000 (16:10 -0700)]
Merge pull request #642 from nico/depslogidx
Suffix depslog path records with their expected index.
Nico Weber [Mon, 26 Aug 2013 22:19:21 +0000 (15:19 -0700)]
Suffix depslog path records with their expected index.
ninja assumes that numbering path entries in the deps log in order produces
valid dense integer ids. If two ninja processes write to the same deps log
concurrently, this is not true. Store the expected indices of path records
in the log and treat the rest of a deps log as invalid if the dense id of a
path record doesn't match the expected id stored in the log. Addresses the
rest of issue #595.
This requires bumping the deps log file format version. Do not migrate the
old version to the new, as the old format did not have this protection, and
might hence contain invalid data. (Unlikely, but possible.)
Also store the record id as one's complement, to make them look less like
regular deps record values. Since each record is written atomically this
isn't really necessary, but it makes the format somewhat more robust (and
easier to read in a hex editor).
Nico Weber [Fri, 23 Aug 2013 19:22:08 +0000 (12:22 -0700)]
Merge pull request #641 from nico/ocd2
Minor style fixes, no behavior change.
Nico Weber [Fri, 23 Aug 2013 19:20:55 +0000 (15:20 -0400)]
Minor style fixes, no behavior change.
Nico Weber [Fri, 23 Aug 2013 13:59:05 +0000 (06:59 -0700)]
Merge pull request #628 from rnk/wstr
Use fwrite in the msvc tool instead of printf
Nico Weber [Thu, 22 Aug 2013 23:27:29 +0000 (16:27 -0700)]
Merge pull request #640 from nico/edgetest
Add a test for issue #638.
Nico Weber [Thu, 22 Aug 2013 23:24:04 +0000 (19:24 -0400)]
Add a test for issue #638.
Nico Weber [Thu, 22 Aug 2013 23:16:23 +0000 (16:16 -0700)]
Merge pull request #639 from rgeary1/StatusMessageFix
Fix for #638 incorrect number of total edges in the status message
Richard Geary [Thu, 22 Aug 2013 22:08:12 +0000 (18:08 -0400)]
Fix for incorrect number of total edges in the status message
Reid Kleckner [Mon, 19 Aug 2013 23:44:30 +0000 (16:44 -0700)]
Merge branch 'master' into wstr
Reid Kleckner [Mon, 19 Aug 2013 23:44:16 +0000 (16:44 -0700)]
Avoid indexing into an empty string.
Nico Weber [Tue, 13 Aug 2013 22:49:38 +0000 (15:49 -0700)]
Merge pull request #635 from johan/patch-1
Proof reading
Johan Sundström [Tue, 13 Aug 2013 01:47:06 +0000 (18:47 -0700)]
Proof reading
Evan Martin [Sun, 11 Aug 2013 17:02:06 +0000 (10:02 -0700)]
Merge pull request #633 from rgeary1/NestedPhonyPrintsDone
Fix : Pure nested phony rules do not print "no work to do"
Richard Geary [Sun, 11 Aug 2013 00:14:49 +0000 (20:14 -0400)]
Fix for missing "no work to do." message if all build edges are phony rules.
Added NestedPhonyPrintsDone unit test
Richard Geary [Sun, 11 Aug 2013 00:13:41 +0000 (20:13 -0400)]
Add to .gitignore : SublimeText project files, *.patch files, ..ninja_deps, .ninja_log
Evan Martin [Wed, 7 Aug 2013 16:19:47 +0000 (09:19 -0700)]
Merge pull request #631 from kimgr/master
Fix tabs/spaces inconsistency.
Kim Grasman [Mon, 5 Aug 2013 15:52:51 +0000 (17:52 +0200)]
Fix tabs/spaces inconsistency.
Evan Martin [Fri, 26 Jul 2013 22:32:39 +0000 (15:32 -0700)]
Merge pull request #627 from idealisms/master
Fix the browse tool.
Reid Kleckner [Fri, 26 Jul 2013 22:27:30 +0000 (15:27 -0700)]
Use fwrite in the msvc tool instead of printf
This allows wide characters from the compiler to propagate through the
msvc tool. Similar to
ad76e867f782e75e0fed620e7b39f7099af154a9.
Tony Chang [Fri, 26 Jul 2013 21:24:52 +0000 (14:24 -0700)]
Fix the browse tool.
ReadFlags was altering argv in real_main causing us
to pass the wrong value into the NinjaMain constructor.
Fix this by storing the ninja command before real_main
runs.
Evan Martin [Wed, 24 Jul 2013 22:38:12 +0000 (15:38 -0700)]
Merge pull request #626 from nico/logwrite
Build log write error checking.
Nico Weber [Wed, 24 Jul 2013 21:07:12 +0000 (14:07 -0700)]
Build log write error checking.
Like
f6f00aa40f0c541df06, but for the build log instead of the deps log.
Nico Weber [Wed, 24 Jul 2013 20:30:29 +0000 (13:30 -0700)]
Merge pull request #612 from maximuska/proposed/deps_log_write_errors_checking
Proposed/deps log write errors checking
Nico Weber [Sat, 20 Jul 2013 19:14:07 +0000 (12:14 -0700)]
Merge pull request #625 from nico/land
Merge pull request #617.
Chris Hopman [Tue, 16 Jul 2013 23:00:28 +0000 (16:00 -0700)]
Add test for correct restat logic
When a single output of an edge is dirty, the restat check should
leave all outputs of that edge dirty.
Chris Hopman [Wed, 3 Jul 2013 21:26:25 +0000 (14:26 -0700)]
Fix restat dirty check logic for edges with multiple outputs
In a normal dependency scan (see DependencyScan::RecomputeDirty) we mark
all outputs of an Edge as dirty if any of the outputs is dirty. This is
the correct behavior because if any output is dirty, we will run the
command for that Edge and that can touch any of the outputs of the Edge
and so all the outputs should be marked dirty.
When updating the dirty state of Node's for a restat check, we were not
applying this logic, instead only those outputs that were actually
"dirty" were marked dirty.
Before this patch, restat edges with multiple outputs caused not all
dependent edges to run.
Nico Weber [Sat, 20 Jul 2013 04:47:00 +0000 (21:47 -0700)]
Merge pull request #624 from nico/landmaxim
Land the first two commits of pull request #608.
Maxim Kalaev [Fri, 28 Jun 2013 17:48:30 +0000 (20:48 +0300)]
minor: removing noop call to MarkDirty(), fixing comment
Maxim Kalaev [Thu, 27 Jun 2013 18:55:38 +0000 (21:55 +0300)]
Removing a redundant stat() call with 'deps' and 'restat = 1'
Nico Weber [Fri, 19 Jul 2013 00:54:33 +0000 (17:54 -0700)]
Merge pull request #623 from nico/fix
Fix diagnostic formatting regression caused by
adaa91a33eb2cf23b88.
Nico Weber [Fri, 19 Jul 2013 00:51:10 +0000 (17:51 -0700)]
Fix diagnostic formatting regression caused by
adaa91a33eb2cf23b88.
Ninja regressed to include a location for every file on the include stack for
nested diagnostics, i.e. it would print:
input:1: include.ninja:1: expected path
Fix this so that it prints only the current file location, like it used to:
include.ninja:1: expected path
Also add a test for this.
Nico Weber [Thu, 18 Jul 2013 21:41:16 +0000 (14:41 -0700)]
Merge pull request #622 from nico/test
Add test for a manifest ending in the middle of a keyword.
Nico Weber [Thu, 18 Jul 2013 21:39:41 +0000 (14:39 -0700)]
Add test for a manifest ending in the middle of a keyword.
Evan Martin [Thu, 18 Jul 2013 20:36:58 +0000 (13:36 -0700)]
Merge pull request #621 from nico/ninjaload
Reuse ManifestParser::Load() in ManifestParser::ParseFileInclude().
Nico Weber [Thu, 18 Jul 2013 00:55:36 +0000 (17:55 -0700)]
Add back contents.resize(), but with a comment and just 1 instead of 10.
Nico Weber [Thu, 11 Jul 2013 00:43:29 +0000 (17:43 -0700)]
Let the ".ninja parse" metric include the time to read the toplevel ninja file.
Loads of included ninja files were covered by the ".ninja parse" in Parse()
further up the stack from the toplevel file, but the load of the toplevel
file wasn't counted. Fix that.
Nico Weber [Thu, 11 Jul 2013 00:30:16 +0000 (17:30 -0700)]
Reuse ManifestParser::Load() in ManifestParser::ParseFileInclude().
ParseFileInclude() was doing the work that Load() was doing. Instead, just
make it call Load().
Also, remove a FIXME about using ReadPath() in ParseFileInclude() -- it's
already being used. (The FIXME was added in the same commit that added the
call to ReadPath() --
8a0c96075786c19 -- it probably should've been deleted
before that commit.)
Also, remove a `contents.resize(contents.size() + 10);`. It's not clear what
it's for, but if it was important then ManifestParser::ParseFileInclude()
would have needed that call too, and it didn't have it.
No intended behavior change.
Evan Martin [Mon, 8 Jul 2013 20:55:23 +0000 (13:55 -0700)]
Merge pull request #616 from nico/recompact
Add a 'recompact' tool, which forces recompaction of the build and deps ...
Evan Martin [Mon, 8 Jul 2013 20:53:22 +0000 (13:53 -0700)]
Merge pull request #614 from nico/pooldoc
Mention pools in the discussion of ninja's toplevel declarations.
Evan Martin [Mon, 8 Jul 2013 20:53:04 +0000 (13:53 -0700)]
Merge pull request #611 from nico/testparse
Improve error message for duplicate rules and unknown pools.
Maxim Kalaev [Sun, 30 Jun 2013 19:59:54 +0000 (22:59 +0300)]
Introducing tool 'deps' dumping ninja deps log entries
Nico Weber [Mon, 8 Jul 2013 19:34:46 +0000 (12:34 -0700)]
Add a 'recompact' tool, which forces recompaction of the build and deps logs.
This is useful for performance comparisons between two build directories.
Nico Weber [Mon, 8 Jul 2013 18:58:18 +0000 (11:58 -0700)]
Merge pull request #615 from mdempsky/strict-murmur
Fix murmur hash implementations to work on strict alignment architectures
Matthew Dempsky [Mon, 8 Jul 2013 17:47:57 +0000 (10:47 -0700)]
Fix murmur hash implementations to work on strict alignment
architectures like OpenBSD/mips64el and OpenBSD/hppa64.
Nico Weber [Sun, 7 Jul 2013 19:22:38 +0000 (12:22 -0700)]
Mention pools in the discussion of ninja's toplevel declarations.
Nico Weber [Tue, 2 Jul 2013 22:43:40 +0000 (15:43 -0700)]
Improve error message for duplicate rules and unknown pools.
Also add more tests for invalid manifests. According to gcov, these invalid
inputs weren't tested before.
Nico Weber [Tue, 2 Jul 2013 18:13:00 +0000 (11:13 -0700)]
Merge pull request #610 from rnk/wstr
Use fwrite to print whatever the subcommand wrote
Reid Kleckner [Tue, 2 Jul 2013 06:00:22 +0000 (02:00 -0400)]
Use fwrite to print whatever the subcommand wrote
Subcommands can write things like UTF-16, which some terminals can
understand. printf() will interpret the null bytes as the end of the
string.
In particular, MSVC's assert() will print wide characters by default,
and I can't find a way to disable it, leading to clang assertion
failures looking like:
FAILED: ...clang.exe ...
Aninja: build stopped: subcommand failed.
With this fix, I get the desired:
FAILED: ...clang.exe ...
Assertion failed: SymbolMap...
ninja: build stopped: subcommand failed.
Nico Weber [Mon, 1 Jul 2013 21:34:05 +0000 (14:34 -0700)]
Merge pull request #607 from dajohi/master
Support Bitrig
Maxim Kalaev [Mon, 1 Jul 2013 21:09:43 +0000 (00:09 +0300)]
Adding checks for record overflow in deps_log
David Hill [Mon, 1 Jul 2013 20:05:30 +0000 (16:05 -0400)]
use !defined(NOT_PPOLL)
Maxim Kalaev [Mon, 1 Jul 2013 18:33:12 +0000 (21:33 +0300)]
Adding error checking on fwrite/fflush in deps_log
David Hill [Mon, 1 Jul 2013 18:11:05 +0000 (14:11 -0400)]
Exclude Windows as well
David Hill [Sat, 29 Jun 2013 23:21:15 +0000 (19:21 -0400)]
ugh, missing #
David Hill [Sat, 29 Jun 2013 23:16:51 +0000 (19:16 -0400)]
cleanup based on comments from martine
David Hill [Sat, 29 Jun 2013 21:34:51 +0000 (17:34 -0400)]
support Bitrig
Nico Weber [Sat, 22 Jun 2013 00:42:15 +0000 (17:42 -0700)]
Merge pull request #601 from nico/109fix
Add stdlib.h include for atol().
Nico Weber [Sat, 22 Jun 2013 00:40:40 +0000 (17:40 -0700)]
Add stdlib.h include for atol().
This attempts to fix issue #600. `man atol` claims that atol() is in
stdlib.h, which wasn't included yet.
Evan Martin [Fri, 14 Jun 2013 06:17:10 +0000 (23:17 -0700)]
Merge pull request #596 from nico/chunk
Make sure to not write partial deps entries.
Nico Weber [Fri, 14 Jun 2013 05:11:34 +0000 (22:11 -0700)]
Make sure to not write partial deps entries.
When two ninja instances run in parallel in the same build directory,
one instance could write a deps entry header and a few ids, and then the
other instance could write a file name in the middle of the deps header.
When ninja reads this deps log on the next run, it will deserialize the
file name as indices, which will cause an out-of-bounds read.
(This can happen if a user runs a "compile this file" that uses ninja to
compile the current buffer in an editor, and also does a full build in a
terminal at the same time for example.)
While running two ninja instances in parallel in the same build
directory isn't a good idea, it happens to mostly work in non-deps mode:
There's redundant edge execution, but nothing crashes. This is partially
because the command log is line-buffered and a single log entry only
consists of a single line.
This change makes sure that deps entries are always written in one go,
like command log entries currently are. Running two ninja binaries in
parallel on the same build directory still isn't a great idea, but it's
less likely to lead to crashes.
See issue #595.
Evan Martin [Thu, 6 Jun 2013 17:54:53 +0000 (10:54 -0700)]
Merge pull request #593 from nico/moretest
Add a test for CreatePhonyInEdge() in depsmode path.
Nico Weber [Thu, 6 Jun 2013 01:51:00 +0000 (18:51 -0700)]
Add a test for CreatePhonyInEdge() in depsmode path.
Removing the `CreatePhonyInEdge(node);` line in
`ImplicitDepLoader::LoadDepsFromLog()` made no tests fail before this change.
The new test is a port to depsmode of the existing DepFileOK test.
Nico Weber [Thu, 6 Jun 2013 01:28:00 +0000 (18:28 -0700)]
Merge pull request #592 from nico/addtest
Add test that proves `node->AddOutEdge(edge);` in `LoadDepFile()` is nee...
Nico Weber [Mon, 3 Jun 2013 23:56:46 +0000 (16:56 -0700)]
Add test that proves `node->AddOutEdge(edge);` in `LoadDepFile()` is needed.
No functionality change. Related to issue #590.
Nico Weber [Tue, 4 Jun 2013 01:54:30 +0000 (18:54 -0700)]
Merge pull request #591 from nico/fixrestat
Fix restat builds with edges generating headers depended on through deps...
Nico Weber [Mon, 3 Jun 2013 23:37:57 +0000 (16:37 -0700)]
Fix restat builds with edges generating headers depended on through deps files
in deps mode.
`ImplicitDepLoader::LoadDepFile()` already adds a depfile edge from every file
mentioned in a depfile to the depfile's output.
`ImplicitDepLoader::LoadDepsFromLog()` didn't do this yet, so add it. Else,
if a restat rule clears a generated .h file, this wouldn't propagate to cc files
depending on that .h file through a depfile.
Fixues issue #590.
Nico Weber [Wed, 29 May 2013 17:20:56 +0000 (10:20 -0700)]
Merge pull request #589 from nico/wincase
Stop `-t msvc -o` from lowercasing paths from /showIncludes output.
Nico Weber [Wed, 29 May 2013 14:37:06 +0000 (07:37 -0700)]
Stop `-t msvc -o` from lowercasing paths from /showIncludes output.
/showIncludes prints absolute paths. If a source file says
`#include <WiNdOwS.h>`, /showIncludes will use that spelling in
its output for the basename and use the on-disk cache for the
directory names in the rest for its output.
This makes the .d files created by `-t msvc -o` consistent with the
.d files written by gcc and clang.
\vBefore this change, `-t msvc -o` would convert this output to
lower case. This is a problem if a build step produces a header file
with mixed case, such as "RuntimeFeatures.h". Due to the lowercasing,
the .d file would contain "runtimefeatures.h", while the build step
will create "RuntimeFeatures.h". Due to the case difference, ninja
would not realize that regeneration of the .h file would require
a rebuild of all source files having the header in the .d file.
(On the next build, ninja would rebuild them since stat()ing is not
case-sensitive on Windows.) One possible fix for this is to make sure
that generators always write generated header files in lower case too,
but on Mac gcc doesn't do lower-casing and .d files end up with the
case-as-written, so generators would have to be different on Mac and
Windows, which is undesirable.
If case-insensitve path comparisons are useful, they should be done
somewhere else (e.g. in CanonicalizePath()) where they affect both
paths read from .d files and paths read from .ninja files. This should
then be controlled by a top-level variable.
This patch changes behavior, but it only has an effect on generated
header files, which aren't common, and it only affects -t msvc, which
is still marked as experimental. (cmake doesn't use it yet.)
(If a file has both `#include <windows.h>` and `<Windows.h>`, this
will now take 2 stat() calls instead of just one, but that should
have a negligible cost.)
Evan Martin [Wed, 29 May 2013 03:18:03 +0000 (20:18 -0700)]
Merge pull request #586 from grimmy/master
Build fails on Debian/kfreebsd
Evan Martin [Sat, 25 May 2013 15:30:57 +0000 (08:30 -0700)]
Merge pull request #588 from jonforums/mingw-fix
Fix mingw based builds. Fixes #587
Jon [Sat, 25 May 2013 14:29:24 +0000 (10:29 -0400)]
Fix mingw based builds. Fixes #587
Gary Kramlich [Sat, 25 May 2013 09:46:36 +0000 (04:46 -0500)]
Fixed the build on Debian/kfreebsd
Evan Martin [Fri, 24 May 2013 23:32:49 +0000 (16:32 -0700)]
refactor ninja main() into a struct with methods
This removes the ugly Globals struct, and the ResetState() hack.
This also eliminates the only goto!
Evan Martin [Thu, 23 May 2013 21:09:27 +0000 (14:09 -0700)]
simplify some ifdefs
Evan Martin [Thu, 23 May 2013 21:06:27 +0000 (14:06 -0700)]
factor out flag parsing from enormous NinjaMain()