From 8901004f9e783fb3a30e2ddb1e69e8f8a7d085f5 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 28 Nov 2018 11:11:10 +0200 Subject: Add --[no-]mtime-check options to control this behavior at runtime By default the checks are enabled only for the staged toolchain. --- build2/depdb.hxx | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) (limited to 'build2/depdb.hxx') diff --git a/build2/depdb.hxx b/build2/depdb.hxx index 66d89e9..f93f16c 100644 --- a/build2/depdb.hxx +++ b/build2/depdb.hxx @@ -10,8 +10,6 @@ #include #include -#define BUILD2_MTIME_CHECK - namespace build2 { // Auxiliary dependency database (those .d files). Uses io_error and @@ -110,8 +108,8 @@ namespace build2 // may be left in the old/currupt state. Note that in the read mode this // function will "chop off" lines that haven't been read. // - // Make sure to also call verify() after updating the target to perform - // the target/database modification times sanity check. + // Make sure to also call check_mtime() after updating the target to + // perform the target/database modification times sanity checks. // void close (); @@ -119,13 +117,18 @@ namespace build2 // Perform target/database modification times sanity check. // void - verify (const path_type& target, timestamp end = timestamp_unknown); + check_mtime (const path_type& target, timestamp end = timestamp_unknown); static void - verify (timestamp start, - const path_type& db, - const path_type& target, - timestamp end); + check_mtime (timestamp start, + const path_type& db, + const path_type& target, + timestamp end); + + // Return true if mtime checks are enabled. + // + static bool + mtime_check (); // Read the next line. If the result is not NULL, then it is a pointer to // the next line in the database (which you are free to move from). If you @@ -251,13 +254,16 @@ namespace build2 string* read_ (); - private: - uint64_t pos_; // Start of the last returned line. - string line_; // Current line. + void + check_mtime_ (const path_type&, timestamp); + + static void + check_mtime_ (timestamp, const path_type&, const path_type&, timestamp); -#ifdef BUILD2_MTIME_CHECK - timestamp start_; -#endif + private: + uint64_t pos_; // Start of the last returned line. + string line_; // Current line. + timestamp start_; // Sequence start (mtime check). }; } -- cgit v1.1