From c28bb7c4038916d359228317d4ef5fe17dabce61 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 18 Nov 2019 15:11:53 +0200 Subject: Add couple of sanity checks --- libbuild2/cc/compile-rule.cxx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'libbuild2/cc/compile-rule.cxx') diff --git a/libbuild2/cc/compile-rule.cxx b/libbuild2/cc/compile-rule.cxx index 6e21a7e..da958f4 100644 --- a/libbuild2/cc/compile-rule.cxx +++ b/libbuild2/cc/compile-rule.cxx @@ -779,7 +779,7 @@ namespace build2 // t.prerequisite_targets since we used standard search() and match() // above. // - const file& src (*md.src.search (t).is_a ()); + const file& src (*md.src.load (memory_order_relaxed)->is_a ()); // Figure out if __symexport is used. While normally it is specified // on the project root (which we cached), it can be overridden with @@ -892,8 +892,13 @@ namespace build2 // Finally the source file. // - if (dd.expect (src.path ()) != nullptr) - l4 ([&]{trace << "source file mismatch forcing update of " << t;}); + { + const path& p (src.path ()); + assert (!p.empty ()); // Sanity check. + + if (dd.expect (p) != nullptr) + l4 ([&]{trace << "source file mismatch forcing update of " << t;}); + } // If any of the above checks resulted in a mismatch (different // compiler, options, or source file) or if the depdb is newer than -- cgit v1.1