aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-08-07 18:27:55 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-08-07 18:27:55 +0200
commitdf4efffedae5117debbb5ba0f1479f1a53960a0d (patch)
tree6cfd4dd92ebd4d3928aea7ad875e057e8a67d663
parente4f41c7319261b9585bd501256664679457e1d9d (diff)
-rw-r--r--build2/parser.cxx7
-rw-r--r--build2/target.cxx4
-rw-r--r--build2/target.hxx5
3 files changed, 12 insertions, 4 deletions
diff --git a/build2/parser.cxx b/build2/parser.cxx
index 25742d0..e10d940 100644
--- a/build2/parser.cxx
+++ b/build2/parser.cxx
@@ -3214,14 +3214,19 @@ namespace build2
}
}
+ bool de (false); // Default extension.
if ((n.pair & 0x01) != 0)
+ {
+ de = static_cast<bool> (e);
tt->pattern (*tt, *scope_, v, e, true);
+ de = de && !e;
+ }
if (dir)
n.dir = dir_path (move (v));
else
{
- target::combine_name (v, e);
+ target::combine_name (v, e, de);
n.value = move (v);
}
diff --git a/build2/target.cxx b/build2/target.cxx
index ebc21db..b3f0fdc 100644
--- a/build2/target.cxx
+++ b/build2/target.cxx
@@ -240,7 +240,7 @@ namespace build2
}
void target::
- combine_name (string& v, const optional<string>& e)
+ combine_name (string& v, const optional<string>& e, bool de)
{
if (v.back () == '.')
{
@@ -258,7 +258,7 @@ namespace build2
v += '.';
v += *e; // Empty or not.
}
- else
+ else if (de)
{
if (path::traits::find_extension (v) != string::npos)
v += "...";
diff --git a/build2/target.hxx b/build2/target.hxx
index 127940a..8014d42 100644
--- a/build2/target.hxx
+++ b/build2/target.hxx
@@ -656,8 +656,11 @@ namespace build2
// Combine the target name and extension into the name leaf.
//
+ // If the target type has the default extension, then "escape" the
+ // existing extension if any.
+ //
static void
- combine_name (string&, const optional<string>&);
+ combine_name (string&, const optional<string>&, bool default_extension);
public:
virtual