aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-07-20 07:30:19 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-07-20 07:30:19 +0200
commit7aabdc2ccfea23c93e3b94290df59708aa179104 (patch)
treef5118f12655feb787291b2be529cd8b15eca42cb /libbuild2
parentf1e4a38bd6818f49901cdc8348f5c7bd6d8cfd3f (diff)
Improve diagnostics
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/functions-name.cxx19
1 files changed, 16 insertions, 3 deletions
diff --git a/libbuild2/functions-name.cxx b/libbuild2/functions-name.cxx
index 84608d4..a853db1 100644
--- a/libbuild2/functions-name.cxx
+++ b/libbuild2/functions-name.cxx
@@ -48,9 +48,22 @@ namespace build2
if (const target* r = search_existing (n, s, o.dir))
return *r;
- fail << "target "
- << (n.pair ? names {move (n), move (o)} : names {move (n)})
- << " not found" << endf;
+ // Inside recipes we don't treat `{}` as special so a literal target name
+ // will have no type and won't be found, which is confusing as hell.
+ //
+ bool typed (n.typed ());
+
+ diag_record dr (fail);
+
+ dr << "target "
+ << (n.pair ? names {move (n), move (o)} : names {move (n)})
+ << " not found";
+
+ if (!typed)
+ dr << info << "wrap it in ([names] ...) if this is literal target name "
+ << "specified inside recipe";
+
+ dr << endf;
}
const target&