aboutsummaryrefslogtreecommitdiff
path: root/build2/parser.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'build2/parser.cxx')
-rw-r--r--build2/parser.cxx50
1 files changed, 31 insertions, 19 deletions
diff --git a/build2/parser.cxx b/build2/parser.cxx
index 47eca4b..d84ebfa 100644
--- a/build2/parser.cxx
+++ b/build2/parser.cxx
@@ -4055,34 +4055,46 @@ namespace build2
// target via an alias. If there are no targets in this buildfile,
// then we don't do anything.
//
- if (default_target_ == nullptr || // No targets in this buildfile.
- targets.find (dir::static_type, // Explicit current dir target.
- scope_->out_path (),
- dir_path (), // Out tree target.
- string (),
- nullopt,
- trace) != nullptr)
+ if (default_target_ == nullptr) // No targets in this buildfile.
return;
target& dt (*default_target_);
- l5 ([&]{trace (t) << "creating current directory alias for " << dt;});
-
- // While this target is not explicitly mentioned in the buildfile, we say
- // that we behave as if it were. Thus not implied.
- //
- target& ct (
- targets.insert (dir::static_type,
+ target* ct (
+ const_cast<target*> ( // Ok (serial execution).
+ targets.find (dir::static_type, // Explicit current dir target.
scope_->out_path (),
- dir_path (),
+ dir_path (), // Out tree target.
string (),
nullopt,
- false,
- trace).first);
+ trace)));
+
+ if (ct == nullptr)
+ {
+ l5 ([&]{trace (t) << "creating current directory alias for " << dt;});
+ // While this target is not explicitly mentioned in the buildfile, we
+ // say that we behave as if it were. Thus not implied.
+ //
+ ct = &targets.insert (dir::static_type,
+ scope_->out_path (),
+ dir_path (),
+ string (),
+ nullopt,
+ false,
+ trace).first;
+ // Fall through.
+ }
+ else if (ct->implied)
+ {
+ ct->implied = false;
+ // Fall through.
+ }
+ else
+ return; // Existing and not implied.
- ct.prerequisites_state_.store (2, memory_order_relaxed);
- ct.prerequisites_.emplace_back (prerequisite (dt));
+ ct->prerequisites_state_.store (2, memory_order_relaxed);
+ ct->prerequisites_.emplace_back (prerequisite (dt));
}
void parser::