summaryrefslogtreecommitdiffstats
path: root/src/deps_log.cc
Commit message (Collapse)AuthorAgeFilesLines
* [clang-tidy] check empty instead of size (#1784)Rosen Penev2020-06-041-1/+1
| | | | | Found with readability-container-size-empty Signed-off-by: Rosen Penev <rosenp@gmail.com>
* Ignore nonexistent .ninja_log/.ninja_deps for restat and recompactJan Niklas Hasse2019-12-231-7/+7
|
* Remove trailing whitespace from all filesJan Niklas Hasse2019-04-171-2/+2
|
* Fix older VS compatibility issues and PDB files generation issue. (#1435)ikifof2018-11-071-0/+3
| | | Fixes #1411.
* Merge pull request #1219 from QuLogic/resolutionNico Weber2017-10-201-7/+12
|\ | | | | Use high-resolution timestamps
| * Use 64-bit-alignment-safe timestamp reading.Elliott Sales de Andrade2017-09-161-2/+8
| | | | | | | | | | Read and write the timestamp as two separate 32-bit integers in a fixed order to prevent any issues with alignment or byte order.
| * Make TimeStamp 64-bit.Elliott Sales de Andrade2017-09-161-7/+6
| | | | | | | | This prepares it for higher-resolution timestamps.
* | Fix potential buffer overrunLogan Chien2017-10-161-1/+1
|/ | | | | This commit rearranges record size comparison and fread() to make sure fread() only reads the data that can fit into the buffer.
* Directly pass the string instead of char * to Truncate util function. It ↵Pierre Schweitzer2015-03-071-1/+1
| | | | will prevent useless conversions.
* Fix compilation errors on Visual Studio 2015 (_MSC_VER 1900).Beren Minor2014-12-311-2/+2
|
* Remove 'Recompacting...' messages.Nico Weber2014-12-181-2/+0
| | | | | | | | | | 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.
* no need to save slash_bits, add commentScott Graham2014-11-111-9/+9
|
* save slash_bits in depslogScott Graham2014-11-111-9/+8
|
* make all GetNode explicit, add DepsLog canonicalize testScott Graham2014-11-101-2/+8
|
* Don't print "Recompacting..." message from tests.Nico Weber2014-09-191-1/+2
| | | | Now tests don't print anything. Non-test behavior is unchanged.
* Move duplicated code into a helper function.Nico Weber2014-01-041-11/+11
|
* Add a test for collection of dead deps entries.Nico Weber2014-01-031-0/+6
|
* Remove dead entries in .ninja_log and .ninja_deps while recompacting.Nico Weber2014-01-021-0/+7
| | | | | | | | | | For .ninja_deps, remove objects that have no in-edges or whose in-edges do not have a "deps" attribute. (This matches the behaviour of `-t deps`). BuildLog doesn't know about state, so let its recompact method take delegate that decides is a path is life or not, and implement it in NinjaMain.
* Make depslog v1->v3 message less scary.Nico Weber2013-09-061-1/+1
| | | | See the comment 5 lines up for details.
* Fix an issue with more than 64k deps, spotted by maximuska.Nico Weber2013-08-281-1/+1
| | | | Also add a test for this case, which would have spotted the issue too.
* document an assumptionNico Weber2013-08-281-0/+1
|
* Deps log format v3Nico Weber2013-08-281-27/+32
| | | | | | | | | | | | | | | 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).
* Suffix depslog path records with their expected index.Nico Weber2013-08-261-6/+31
| | | | | | | | | | | | | | | | | | 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).
* Merge pull request #612 from maximuska/proposed/deps_log_write_errors_checkingNico Weber2013-07-241-14/+41
|\ | | | | Proposed/deps log write errors checking
| * Adding checks for record overflow in deps_logMaxim Kalaev2013-07-011-6/+21
| |
| * Adding error checking on fwrite/fflush in deps_logMaxim Kalaev2013-07-011-12/+24
| |
* | Add a 'recompact' tool, which forces recompaction of the build and deps logs.Nico Weber2013-07-081-1/+1
|/ | | | This is useful for performance comparisons between two build directories.
* 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.
* Recompact the deps log when it gets too big.Nico Weber2013-05-011-2/+19
| | | | | 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-011-5/+8
| | | | | | 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-301-0/+7
| | | | | | 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-301-6/+12
| | | | No functionality change.
* Move some DepsLog::Deps initialization code into its constructor.Nico Weber2013-04-301-4/+1
| | | | No functionality change.
* Merge pull request #558 from nico/buildfixEvan Martin2013-04-291-3/+1
|\ | | | | Introduce a Truncate() function that works on POSIX and Windows.
| * Introduce a Truncate() function that works on POSIX and Windows.Nico Weber2013-04-291-3/+1
| | | | | | | | 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-291-0/+2
|/ | | | 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-271-6/+35
| | | | | | 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.
* Merge pull request #535 from sgraham/fix-windows-depslogEvan Martin2013-04-091-0/+2
|\ | | | | fix windows build after depslog
| * fix windows build after depslogScott Graham2013-04-091-0/+2
| |
* | On invalid depslog header, restart build instead of showing an error.Nico Weber2013-04-091-9/+5
|/ | | | Also add tests for invalid headers.
* Write the depslog version in binary instead of text.Nico Weber2013-04-091-5/+12
| | | | | | This way, it doubles as a byte-order marker. The header is now exactly one line in a hex editor, and it's still relatively easy to look at the version in a text editor.
* add a test for the "deps out of date" caseEvan Martin2013-04-091-1/+5
| | | | It touched the various remaining XXXes in the code, hooray.
* don't call .front() on an empty vectorEvan Martin2013-04-081-1/+2
| | | | Fixes a gcc debug-mode assertion.
* missing headerEvan Martin2013-04-081-0/+1
|
* depslog: track dead record countEvan Martin2013-04-081-1/+3
|
* add recompaction to depslogEvan Martin2013-04-081-10/+53
| | | | Not done automatically yet, just an implementation and a test.