From d402bc96297c6ed3dd6ee883dcff8cc39bd01030 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 18 Jan 2017 13:50:58 +0200 Subject: Ignore prerequisite mtimes that are not linker inputs This makes sure, for example, that we don't unnecessarily re-link an executable when its testscript prerequisite is changes. --- build2/cc/compile.cxx | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'build2/cc/compile.cxx') diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx index 6fd64c2..3318f21 100644 --- a/build2/cc/compile.cxx +++ b/build2/cc/compile.cxx @@ -888,16 +888,7 @@ namespace build2 } } - if (ts != timestamp_unknown) - { - timestamp mt (pt.mtime ()); - - // See execute_prerequisites() for rationale behind the equal part. - // - return ts < mt || (ts == mt && pt.state () != target_state::changed); - } - - return false; + return ts != timestamp_unknown ? pt.newer (ts) : false; }; // Update and add a header file to the list of prerequisite targets. @@ -1394,10 +1385,18 @@ namespace build2 perform_update (action a, target& xt) const { file& t (static_cast (xt)); - file* s (execute_prerequisites (x_src, a, t, t.mtime ())); - if (s == nullptr) - return target_state::unchanged; + // Update prerequisites and determine if any relevant ones render us + // out-of-date. Note that currently we treat all the prerequisites + // as potentially affecting the result (for simplicity/performance). + // + file* s; + { + auto p (execute_prerequisites (x_src, a, t, t.mtime ())); + + if ((s = p.first) == nullptr) + return p.second; + } scope& bs (t.base_scope ()); scope& rs (*bs.root_scope ()); -- cgit v1.1