diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-03-25 07:35:40 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-03-25 07:35:40 +0200 |
commit | d1663e509e8cc77a8fbb8345bb1fbccacacf2429 (patch) | |
tree | 711a62d5cb5cccc14c20a039349344f331cdc7d4 | |
parent | a18661636cd169b0912cc58c623fdd69e3250229 (diff) |
Diagnose unnamed project in version module
-rw-r--r-- | libbuild2/version/init.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libbuild2/version/init.cxx b/libbuild2/version/init.cxx index c8e8559..135f2db 100644 --- a/libbuild2/version/init.cxx +++ b/libbuild2/version/init.cxx @@ -68,16 +68,19 @@ namespace build2 { if (nv.name == "name") { - auto& pn (cast<project_name> (rs.vars[ctx.var_project])); + auto* pn (cast_null<project_name> (rs.vars[ctx.var_project])); - if (nv.value != pn.string ()) + if (pn == nullptr) + fail (l) << "version module loaded in unnamed project"; + + if (nv.value != pn->string ()) { path bf (rs.src_path () / rs.root_extra->bootstrap_file); location ml (f, nv.value_line, nv.value_column); location bl (bf); fail (ml) << "package name " << nv.value << " does not match " - << "build system project name " << pn << + << "build system project name " << *pn << info (bl) << "build system project name specified here"; } } |