diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-06-26 18:04:09 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2020-06-26 18:35:19 +0300 |
commit | e21cfd4593932caefc08d1f7ad0f966dcda324d9 (patch) | |
tree | ae84667cb325794803a725c89044873b23da9b94 | |
parent | 64429b9e46c988256a1d196aa0159ba71744b332 (diff) |
Drop workarounds for script::redirect struct compile errors
Thanks to the butl::optional improvement to better deal with lack of copy/move
constructors.
-rw-r--r-- | libbuild2/script/script.cxx | 51 | ||||
-rw-r--r-- | libbuild2/script/script.hxx | 11 |
2 files changed, 4 insertions, 58 deletions
diff --git a/libbuild2/script/script.cxx b/libbuild2/script/script.cxx index ee238cc..6ee702e 100644 --- a/libbuild2/script/script.cxx +++ b/libbuild2/script/script.cxx @@ -712,57 +712,6 @@ namespace build2 } } } - - redirect:: - redirect (const redirect& r) - : type (r.type), - token (r.token), - end (r.end), - end_line (r.end_line), - end_column (r.end_column) - { - switch (type) - { - case redirect_type::none: - case redirect_type::pass: - case redirect_type::null: - case redirect_type::trace: break; - - case redirect_type::merge: fd = r.fd; break; - - case redirect_type::here_str_literal: - case redirect_type::here_doc_literal: - { - new (&str) string (r.str); - break; - } - case redirect_type::here_str_regex: - case redirect_type::here_doc_regex: - { - new (®ex) regex_lines (r.regex); - break; - } - case redirect_type::file: - { - new (&file) file_type (r.file); - break; - } - case redirect_type::here_doc_ref: - { - new (&ref) reference_wrapper<const redirect> (r.ref); - break; - } - } - } - - redirect& redirect:: - operator= (const redirect& r) - { - if (this != &r) - *this = redirect (r); // Reduce to move-assignment. - return *this; - } - // environment // void environment:: diff --git a/libbuild2/script/script.hxx b/libbuild2/script/script.hxx index 8e1c852..4a62c77 100644 --- a/libbuild2/script/script.hxx +++ b/libbuild2/script/script.hxx @@ -210,16 +210,13 @@ namespace build2 assert (t == redirect_type::merge && (f == 1 || f == 2)); } + // Movable-only type. + // redirect (redirect&&) noexcept; redirect& operator= (redirect&&) noexcept; - // @@ Defining optional movable-only redirects in the command class make - // the older C++ compilers (GCC 4.9, Clang 4, VC 15) fail to compile the - // command vector manipulating code. Thus, we make the redirect class - // copyable to workaround the issue. - // - redirect (const redirect&); - redirect& operator= (const redirect&); + redirect (const redirect&) = delete; + redirect& operator= (const redirect&) = delete; ~redirect (); |