aboutsummaryrefslogtreecommitdiff
path: root/build2/depdb.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-11-28 11:11:10 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-11-28 11:11:10 +0200
commit8901004f9e783fb3a30e2ddb1e69e8f8a7d085f5 (patch)
tree11d4b80a099d1dcea5404ec45c52201d9ec23b38 /build2/depdb.hxx
parent9190569b69e34468841b18b33c98f78e66a3d26e (diff)
Add --[no-]mtime-check options to control this behavior at runtime
By default the checks are enabled only for the staged toolchain.
Diffstat (limited to 'build2/depdb.hxx')
-rw-r--r--build2/depdb.hxx36
1 files changed, 21 insertions, 15 deletions
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 <build2/types.hxx>
#include <build2/utility.hxx>
-#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).
};
}