aboutsummaryrefslogtreecommitdiff
path: root/build2/target.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-05-31 16:29:33 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-05-31 16:36:49 +0200
commitb2fc1fb4a13ffa58640333a3909dd0e53bd21995 (patch)
tree34060557c92a581847a4f411cf25a0258c357790 /build2/target.cxx
parenta0577305165ea4116ea72b5529c61966eea1c6e9 (diff)
Adjust extension semantics in file rule to match search_existing_file()
Diffstat (limited to 'build2/target.cxx')
-rw-r--r--build2/target.cxx13
1 files changed, 9 insertions, 4 deletions
diff --git a/build2/target.cxx b/build2/target.cxx
index 1b6757c..3ee9850 100644
--- a/build2/target.cxx
+++ b/build2/target.cxx
@@ -530,8 +530,8 @@ namespace build2
// path_target
//
- const string& path_target::
- derive_extension (const char* de, bool search)
+ const string* path_target::
+ derive_extension (bool search, const char* de)
{
// See also search_existing_file() if updating anything here.
//
@@ -541,7 +541,7 @@ namespace build2
// Note that returning by reference is now MT-safe since once the
// extension is specified, it is immutable.
//
- return *p;
+ return p;
else
{
optional<string> e;
@@ -559,10 +559,15 @@ namespace build2
if (de != nullptr)
e = de;
else
+ {
+ if (search)
+ return nullptr;
+
fail << "no default extension for target " << *this;
+ }
}
- return ext (move (*e));
+ return &ext (move (*e));
}
}