aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/variable.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-04-26 10:39:03 +0200
committerKaren Arutyunov <karen@codesynthesis.com>2022-07-07 18:08:25 +0300
commita473abe80f4c42a366f0573bbbc762fa440b7fe6 (patch)
tree6214c1d25162c2e614ed91e163011ac13091e7e3 /libbuild2/variable.hxx
parent900436dd83787f2cd47e7fc37f0530fc581a3e3b (diff)
Use new cmdline type for canned command lines in {Build,Test}script
Diffstat (limited to 'libbuild2/variable.hxx')
-rw-r--r--libbuild2/variable.hxx29
1 files changed, 29 insertions, 0 deletions
diff --git a/libbuild2/variable.hxx b/libbuild2/variable.hxx
index 6047bf3..c03838f 100644
--- a/libbuild2/variable.hxx
+++ b/libbuild2/variable.hxx
@@ -1147,6 +1147,35 @@ namespace build2
static const map_value_type<K, V> value_type;
};
+ // Canned command line to be re-lexed (used in {Build,Test}scripts).
+ //
+ // Note that because the executable can be specific as a target or as
+ // process_path_ex, this is a list of names rather than a list of strings.
+ // Note also that unlike vector<name> this type allows name pairs.
+ //
+ struct cmdline: vector<name>
+ {
+ using vector<name>::vector;
+
+ cmdline () {} // For Clang.
+ };
+
+ template <>
+ struct LIBBUILD2_SYMEXPORT value_traits<cmdline>
+ {
+ static_assert (sizeof (cmdline) <= value::size_, "insufficient space");
+
+ static cmdline convert (names&&);
+ static void assign (value&, cmdline&&);
+ static void append (value&, cmdline&&);
+ static void prepend (value&, cmdline&&);
+ static bool empty (const cmdline& x) {return x.empty ();}
+
+ static const cmdline empty_instance;
+ static const char* const type_name;
+ static const build2::value_type value_type;
+ };
+
// Explicitly pre-instantiate and export value_traits templates for
// vector/map value types used in the build2 project. Note that this is not
// merely an optimization since not doing so we may end up with multiple