From 02c759ee303c740d287054f3042911aac1bf046a Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 25 Aug 2022 12:25:16 +0300 Subject: Make configuration name/target unique --- libbbot/build-config.cxx | 16 ++++++++-------- libbbot/build-config.hxx | 3 +++ tests/buildtab/testscript | 20 ++++++++++++-------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/libbbot/build-config.cxx b/libbbot/build-config.cxx index c46cffd..01ce57e 100644 --- a/libbbot/build-config.cxx +++ b/libbbot/build-config.cxx @@ -75,14 +75,6 @@ namespace bbot config.name = move (tl[i].value); - // Make sure the name is unique. - // - for (const auto& c: r) - { - if (c.name == config.name) - bad_line ("duplicate configuration name"); - } - if (++i == n) bad_line ("no target found"); @@ -116,6 +108,14 @@ namespace bbot bad_line (e.what ()); } + // Make sure the name/target combination is unique. + // + for (const auto& c: r) + { + if (c.name == config.name && c.target == config.target) + bad_line ("duplicate configuration name/target"); + } + if (++i == n) bad_line ("no classes found"); diff --git a/libbbot/build-config.hxx b/libbbot/build-config.hxx index e4bb5cb..473e5d8 100644 --- a/libbbot/build-config.hxx +++ b/libbbot/build-config.hxx @@ -55,6 +55,9 @@ namespace bbot // // [/] []* []* // + // Note that each / pair is expected to be unique in the + // buildtab. + // using butl::tab_parsing; LIBBBOT_EXPORT build_configs diff --git a/tests/buildtab/testscript b/tests/buildtab/testscript index c9b5389..5631527 100644 --- a/tests/buildtab/testscript +++ b/tests/buildtab/testscript @@ -6,11 +6,13 @@ : Roundtrip buildtab. : { - : all-fileds-combinations + : all-fields-combinations : $* <>EOO - windows*-vc_14* windows-vc_14-32 i686-microsoft-win32-msvc14.0 all - windows*-vc_14* windows-vc_14-32-debug i686-microsoft-win32-msvc14.0 "" config.cc.coptions=/Z7 config.cc.loptions=/DEBUG ~"warning C4\d{3}: " + windows*-vc_14* windows-vc_14 i686-microsoft-win32-msvc14.0 all + windows*-vc_14* windows-vc_14-debug i686-microsoft-win32-msvc14.0 "" config.cc.coptions=/Z7 config.cc.loptions=/DEBUG ~"warning C4\d{3}: " + + windows*-vc_14* windows-vc_14 x86_64-microsoft-win32-msvc14.0 all linux_debian_8*-gcc_4.9 linux_debian_8-gcc_4.9 x86_64-linux-gnu "all default linux gcc gcc-4+:gcc-3+" - - - gcc-5+:gcc-4+ @@ -21,8 +23,9 @@ windows_10*-clang_9.0_msvc_16.3 windows_10-clang_9.0_msvc_16.3_lld x86_64-microsoft-win32-msvc14.2/lld "all default windows clang" EOI - windows*-vc_14* windows-vc_14-32 i686-microsoft-win32-msvc14.0 all - windows*-vc_14* windows-vc_14-32-debug i686-microsoft-win32-msvc14.0 "" config.cc.coptions=/Z7 config.cc.loptions=/DEBUG ~"warning C4\d{3}: " + windows*-vc_14* windows-vc_14 i686-microsoft-win32-msvc14.0 all + windows*-vc_14* windows-vc_14-debug i686-microsoft-win32-msvc14.0 "" config.cc.coptions=/Z7 config.cc.loptions=/DEBUG ~"warning C4\d{3}: " + windows*-vc_14* windows-vc_14 x86_64-microsoft-win32-msvc14.0 all linux_debian_8*-gcc_4.9 linux_debian_8-gcc_4.9 x86_64-linux-gnu "all default linux gcc gcc-4+:gcc-3+" linux_debian_9*-gcc_7.3 linux_debian_9-gcc_7.3 x86_64-linux-gnu "all default linux gcc gcc-7+:gcc-6+" linux_debian_9*-gcc_7.3 linux_debian_9-gcc_7.3-O3 x86_64-linux-gnu "all default linux gcc optimized gcc-7+:gcc-6+" config.cc.coptions=-O3 @@ -57,9 +60,10 @@ : dup : - $* <'cin:2:17: error: duplicate configuration name' == 1 - windows*-vc_14* windows-vc_14-32 i686-microsoft-win32-msvc14.0 default - windows*-vc_14* windows-vc_14-32 i686-microsoft-win32-msvc14.0 default + $* <'cin:3:31: error: duplicate configuration name/target' == 1 + windows*-vc_14* windows-vc_14 i686-microsoft-win32-msvc14.0 default + windows*-vc_14* windows-vc_14 x86_64-microsoft-win32-msvc14.0 default + windows*-vc_14* windows-vc_14 i686-microsoft-win32-msvc14.0 default EOI } -- cgit v1.1