From 7dee9936074bcbbf9dfe4faf2d86165abb7d9eb9 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 24 May 2018 09:30:55 +0200 Subject: Fix bug in TU checksum depdb saving logic in case of reprocess=true --- build2/cc/compile-rule.cxx | 6 +++--- build2/depdb.cxx | 2 +- build2/depdb.hxx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build2/cc/compile-rule.cxx b/build2/cc/compile-rule.cxx index f57d5b3..b81b19a 100644 --- a/build2/cc/compile-rule.cxx +++ b/build2/cc/compile-rule.cxx @@ -858,7 +858,7 @@ namespace build2 // (whitespaces, comments, etc). // { - string cs; + optional cs; if (string* l = dd.read ()) cs = move (*l); else @@ -871,7 +871,7 @@ namespace build2 { auto p (parse_unit (a, t, li, src, psrc.first, md)); - if (cs != p.second) + if (!cs || *cs != p.second) { assert (first); // Unchanged TU has a different checksum? dd.write (p.second); @@ -880,7 +880,7 @@ namespace build2 // Don't clear if it was forced or the checksum should not be // relied upon. // - else if (first && !cs.empty ()) + else if (first && !p.second.empty ()) { // Clear the update flag and set the touch flag. Unless there // is no object file, of course. See also the md.mt logic diff --git a/build2/depdb.cxx b/build2/depdb.cxx index a66afdf..df73dfd 100644 --- a/build2/depdb.cxx +++ b/build2/depdb.cxx @@ -109,7 +109,7 @@ namespace build2 if (state_ == state::read_eof) return nullptr; - getline (fs_, line_); // Calls data_.erase(). + getline (fs_, line_); // Calls line_.erase(). // The line should always end with a newline. If it doesn't, then this // line (and the rest of the database) is assumed corrupted. Also peek at diff --git a/build2/depdb.hxx b/build2/depdb.hxx index 906cbe5..9885723 100644 --- a/build2/depdb.hxx +++ b/build2/depdb.hxx @@ -97,7 +97,7 @@ namespace build2 // the next line in the database (which you are free to move from). If you // then call write(), this line will be overwritten. // - // If the result is NULL, then it means no next line is available. This + // If the result is NULL, then it means no next line is unavailable. This // can be due to several reasons: // // - eof reached (you can detect this by calling more() before read()) -- cgit v1.1