From bf4822a17eed8bdaf9d337caf806c63c82b06a89 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 18 Jul 2017 13:36:04 +0300 Subject: Make buildtab target to be non-optional --- libbbot/build-config.cxx | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) (limited to 'libbbot/build-config.cxx') diff --git a/libbbot/build-config.cxx b/libbbot/build-config.cxx index f18c48a..855b093 100644 --- a/libbbot/build-config.cxx +++ b/libbbot/build-config.cxx @@ -63,39 +63,26 @@ namespace bbot // Make sure the name is unique. // for (const auto& c: r) + { if (c.name == config.name) bad_line ("duplicate configuration name"); + } - // If there is no target nor configuration variables then save the - // configuration and proceed with the next line. - // if (++i == n) + bad_line ("no target found"); + + try { - r.emplace_back (move (config)); - continue; + config.target = target_triplet (tl[i].value); } - - // If the third field doesn't start with '~' character and doesn't - // contain '=' character, then we will treat it as a target. - // - const string& v (tl[i].value); - if (v[0] != '~' && v.find ('=') == string::npos) + catch (const invalid_argument& e) { - try - { - config.target = target_triplet (v); - } - catch (const invalid_argument& e) - { - bad_line (e.what ()); - } - - ++i; + bad_line (e.what ()); } try { - for (; i < n; ++i) + for (++i; i < n; ++i) { string& v (tl[i].value); -- cgit v1.1