summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge pull request #601 from nico/109fixNico Weber2013-06-221-0/+1
|\ | | | | Add stdlib.h include for atol().
| * Add stdlib.h include for atol().Nico Weber2013-06-221-0/+1
| | | | | | | | | | This attempts to fix issue #600. `man atol` claims that atol() is in stdlib.h, which wasn't included yet.
* | Make sure to not write partial deps entries.Nico Weber2013-06-141-0/+9
|/ | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add a test for CreatePhonyInEdge() in depsmode path.Nico Weber2013-06-061-0/+61
| | | | | | 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.
* Add test that proves `node->AddOutEdge(edge);` in `LoadDepFile()` is needed.Nico Weber2013-06-042-4/+28
| | | | No functionality change. Related to issue #590.
* Fix restat builds with edges generating headers depended on through deps filesNico Weber2013-06-032-0/+65
| | | | | | | | | | | | | 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.
* Stop `-t msvc -o` from lowercasing paths from /showIncludes output.Nico Weber2013-05-295-17/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | /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. Before 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.)
* Fix mingw based builds. Fixes #587Jon2013-05-251-2/+2
|
* refactor ninja main() into a struct with methodsEvan Martin2013-05-241-159/+203
| | | | | This removes the ugly Globals struct, and the ResetState() hack. This also eliminates the only goto!
* simplify some ifdefsEvan Martin2013-05-241-7/+5
|
* factor out flag parsing from enormous NinjaMain()Evan Martin2013-05-241-44/+64
|
* Merge pull request #585 from nico/fixcrashNico Weber2013-05-243-4/+7
|\ | | | | Don't use va_start() with reference parameters, it's undefined behavior.
| * Don't use va_start() with reference parameters, it's undefined behavior.Nico Weber2013-05-243-4/+7
| | | | | | | | Should fix issue #584.
* | Merge pull request #470 from rgeary1/remotebrowserEvan Martin2013-05-231-2/+6
|\ \ | | | | | | Ninja -t browse opens localhost in browser, which doesn't work when using ssh
| * | Browse tool uses real hostname not localhost, to allow -t browse when using sshRichard Geary2013-05-221-2/+6
| | | | | | | | | | | | Change-Id: Ic4be6527151a7ff68afab62e61951071ad5694b7
* | | Merge pull request #578 from pinotree/remove-path-maxEvan Martin2013-05-231-3/+7
|\ \ \ | | | | | | | | do not unconditionally use PATH_MAX with getcwd
| * | | do not unconditionally use PATH_MAX with getcwdPino Toscano2013-05-211-3/+7
| |/ / | | | | | | | | | | | | | | | Instead, grow a buffer until getcwd either succeeds or fails with an errno different than ERANGE (meaning the passed buffer was too short to represent the actual path). Reset errno before calling getcwd to check it eventually did not fail.
* | | Merge pull request #583 from tru/add_force_pselectEvan Martin2013-05-231-3/+3
|\ \ \ | | | | | | | | Added bootstrap/configure option to force pselect
| * | | Added bootstrap/configure option to force pselectTobias Hieta2013-05-231-3/+3
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All modern Linux kernels have ppoll() but sometimes you might want to compile on something ancient. This patch adds the possibility to force the use of pselect() instead by passing --force-pselect to bootstrap/configure. The use of ppoll() is still default for Linux and OpenBSD
* | | Add error check for -j flag.Rui Ueyama2013-05-211-2/+7
|/ /
* | Merge pull request #576 from nico/newlinesEvan Martin2013-05-201-0/+6
|\ \ | | | | | | Set stdout to binary mode in -t msvc.
| * | Set stdout to binary mode in -t msvc.Nico Weber2013-05-171-0/+6
| | | | | | | | | | | | Fixes issue #575.
* | | Merge pull request #577 from tfarina/structsEvan Martin2013-05-192-4/+2
|\ \ \ | |/ / |/| | structs not classes.
| * | structs not classes.Thiago Farina2013-05-192-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For some reason that I do not, ninja prefers: struct Foo { Foo(); private: void Blah(); }; Rather than class Foo { public: Foo(); private: void Blah(); }; This catches the last two usages of "class" in the code base. Signed-off-by: Thiago Farina <tfarina@chromium.org>
* | | don't print output with extra newlineScott Graham2013-05-171-1/+1
| | |
* | | fix truncate compile error in ninja_test on windowsScott Graham2013-05-171-1/+2
| |/ |/|
* | call this version 1.3.0Evan Martin2013-05-161-5/+1
| |
* | Merge pull request #572 from nico/inclessEvan Martin2013-05-148-16/+4
|\ \ | | | | | | Remove a few unused includes.
| * | Remove a few unused includes.Nico Weber2013-05-128-16/+4
| |/
* | Fix Pool tests.Robert Iannucci2013-05-061-18/+37
|/ | | | | | | At any phase in the test where multiple edges are ready simultaneously, acquire all edges and sort them into a predictable order. This allows the test to execute deterministically regardless of the order of edge allocation.
* Merge pull request #565 from mdempsky/masterEvan Martin2013-05-012-27/+16
|\ | | | | Add support for OpenBSD.
| * Don't poll pipes using POLLRDHUPMatthew Dempsky2013-05-011-8/+1
| | | | | | | | | | | | POLLRDHUP is Linux-specific, and isn't necessary for polling pipes anyway. Linux and OpenBSD both return POLLHUP if no process has the pipe open for writing.
| * Add support for OpenBSD.Matthew Dempsky2013-05-012-19/+15
| | | | | | | | | | | | Use ppoll() on OpenBSD. Also, fix interrupt handling to recognize that on FreeBSD and OpenBSD, an interrupt might have been delivered even if pselect()/ppoll() don't return -1/EINTR.
* | minor formatting changeNico Weber2013-05-011-3/+2
| |
* | Merge pull request #563 from nico/recompact-depsNico Weber2013-05-013-32/+95
|\ \ | |/ |/| Implement deps log recompaction.
| * Recompact the deps log when it gets too big.Nico Weber2013-05-012-7/+22
| | | | | | | | | | Now that Recompact() keeps all data structures intact, it can just be called at the beginning of a build and the build will still work.
| * Keep a DepsLog's data valid after a call to DepsLog::Recompact().Nico Weber2013-05-012-7/+35
| | | | | | | | | | | | Previously, a DepsLog would become invalid after Recompact() was called, due to Recompact() making all node ids refer to a temporary DepsLog object constructed in Recompact().
| * Let DepsLog::RecordDeps() update its in-memory representation.Nico Weber2013-04-302-8/+21
| | | | | | | | | | | | This is a behavior change, but it should be safe: Graph only queries the deps log at startup, before running any command. Nothing else currently queries the deps log.
| * Move updating DepsLog's deps_ array into its own function.Nico Weber2013-04-302-6/+15
| | | | | | | | No functionality change.
| * Move some DepsLog::Deps initialization code into its constructor.Nico Weber2013-04-302-5/+3
| | | | | | | | No functionality change.
* | added missing windows includePatrick von Reth2013-04-301-0/+1
|/
* Fix Windows build more.Nico Weber2013-04-291-1/+1
|
* Merge pull request #558 from nico/buildfixEvan Martin2013-04-295-14/+27
|\ | | | | Introduce a Truncate() function that works on POSIX and Windows.
| * Introduce a Truncate() function that works on POSIX and Windows.Nico Weber2013-04-295-14/+27
| | | | | | | | Hopefully fixes the build on Windows.
* | Merge pull request #556 from nico/unlinkEvan Martin2013-04-291-0/+5
|\ \ | | | | | | Make sure that recompaction writes a pristine new depslog.
| * | Make sure that recompaction writes a pristine new depslog.Nico Weber2013-04-291-0/+5
| |/ | | | | | | | | | | | | | | | | | | | | | | ...even if a prior run of DepsLog::Recompact() exited without cleaning up, for example due to a crash or because someone added a `return true;` in the middle of the function while debugging. Or because someone hits ctrl-c during deps log recompaction. No test, because I can't think of a way to trigger this scenario programmatically. Part of issue #554.
* | Don't crash during deps log recompaction if there's more than one deps entry.Nico Weber2013-04-292-0/+8
|/ | | | Part of issue #554.
* don't count eof as truncatedEvan Martin2013-04-271-1/+2
|
* fix warningEvan Martin2013-04-271-1/+1
|
* deps log: recover on truncated entryEvan Martin2013-04-272-9/+103
| | | | | | If a read fails while reading an entry, truncate the log to the last successfully read entry. This prevents corruption when a subsequent run appends another entry.