From 89a2881d1128fd799479aca1883687553a359395 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 31 Aug 2016 12:22:46 +0200 Subject: Compile first source file, not last Some source files may include other files of the same type which can get injected at the end. --- build2/algorithm | 12 ++++++------ build2/algorithm.cxx | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build2/algorithm b/build2/algorithm index 9f43475..db2ccca 100644 --- a/build2/algorithm +++ b/build2/algorithm @@ -190,12 +190,12 @@ namespace build2 bool execute_prerequisites (action, target&, const timestamp&); - // Another version of the above that does two extra things for the - // caller: it determines whether the action needs to be executed on - // the target based on the passed timestamp and, if so, finds a - // prerequisite of the specified type (e.g., a source file). If - // there are multiple prerequisites of this type, then the last - // is returned. + // Another version of the above that does two extra things for the caller: + // it determines whether the action needs to be executed on the target based + // on the passed timestamp and, if so, finds a prerequisite of the specified + // type (e.g., a source file). If there are multiple prerequisites of this + // type, then the first is returned (this can become important if additional + // prerequisites of the same type may get injected). // template T* diff --git a/build2/algorithm.cxx b/build2/algorithm.cxx index 6b28232..8dc5621 100644 --- a/build2/algorithm.cxx +++ b/build2/algorithm.cxx @@ -494,7 +494,7 @@ namespace build2 } } - if (pt->is_a (tt)) + if (r == nullptr && pt->is_a (tt)) r = pt; } -- cgit v1.1