From 482d28f130511e7ce5f94dfcb03e020b4e1d9831 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 24 Sep 2020 15:32:13 +0200 Subject: Fix target declaration upgrade logic --- libbuild2/target.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'libbuild2/target.cxx') diff --git a/libbuild2/target.cxx b/libbuild2/target.cxx index 8d76f56..df03128 100644 --- a/libbuild2/target.cxx +++ b/libbuild2/target.cxx @@ -484,12 +484,16 @@ namespace build2 // Fall through (continue as if the first find() returned this target). } - if (decl > t->decl) + // Without resorting to something like atomic we can only upgrade the + // declaration to real (which is expected to only happen during the load + // phase). + // + if (decl == target_decl::real) { - // The decl value can only be adjusted during the load phase. - // assert (ctx.phase == run_phase::load); - t->decl = decl; + + if (t->decl != target_decl::real) + t->decl = decl; } return pair (*t, ulock ()); -- cgit v1.1