aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-06-12 12:26:16 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-06-12 12:26:16 +0200
commite4a3a97bc76e6e88dede7e39afe126eb021a78d7 (patch)
treeb159a43950b7fc57d5b4b578670f6a6b5c4a4c59
parent08f36d41ea69ca331715ac8d70b0bf8fd849f401 (diff)
If target type doesn't use extensions, factor it back into name
-rw-r--r--build2/scope.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/build2/scope.cxx b/build2/scope.cxx
index d4ec9c8..ff004b5 100644
--- a/build2/scope.cxx
+++ b/build2/scope.cxx
@@ -674,6 +674,19 @@ namespace build2
r = &file::static_type;
}
+ // If the target type does not use extensions but one was specified,
+ // factor it back into the name (this way we won't assert when printing
+ // diagnostics; see to_stream(target_key) for details).
+ //
+ if (ext &&
+ r->fixed_extension == nullptr &&
+ r->default_extension == nullptr)
+ {
+ v += '.';
+ v += *ext;
+ ext = nullopt;
+ }
+
return r;
}