aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2022-08-25 12:25:16 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2022-08-26 16:25:59 +0300
commit02c759ee303c740d287054f3042911aac1bf046a (patch)
tree0762af5bc660dcba142a2480901fc040a5594010
parentb41e4bf1a9266c180c4208ca5fc864e918b842b2 (diff)
Make configuration name/target unique
-rw-r--r--libbbot/build-config.cxx16
-rw-r--r--libbbot/build-config.hxx3
-rw-r--r--tests/buildtab/testscript20
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
//
// <machine-pattern> <config> <target>[/<environment>] <classes> [<config-arg>]* [<warning-regex>]*
//
+ // Note that each <config>/<target> 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
:
$* <<EOI >>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
:
- $* <<EOI 2>'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
+ $* <<EOI 2>'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
}