diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-10-11 17:42:38 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-10-11 17:42:38 +0200 |
commit | d6858f2d1612027d79acf8ea231f7b4c5859efa1 (patch) | |
tree | 77920c35f45749b3fe8d0999482400ebf80f8f5a | |
parent | 61349dcf5fbfeab888ea345ebec3d887777a2782 (diff) |
Work around compiler issues in qualified_option class template
-rw-r--r-- | bpkg/auth.cxx | 6 | ||||
-rw-r--r-- | bpkg/options-types.hxx | 8 | ||||
-rw-r--r-- | bpkg/types-parsers.hxx | 2 | ||||
-rw-r--r-- | bpkg/types-parsers.txx | 6 |
4 files changed, 11 insertions, 11 deletions
diff --git a/bpkg/auth.cxx b/bpkg/auth.cxx index 48ba56f..787a705 100644 --- a/bpkg/auth.cxx +++ b/bpkg/auth.cxx @@ -29,9 +29,9 @@ namespace bpkg static const string openssl_rsautl ("rsautl"); static const string openssl_x509 ("x509"); - const char* openssl_commands[] = {openssl_rsautl.c_str (), - openssl_x509.c_str (), - nullptr}; + const char* openssl_commands[3] = {openssl_rsautl.c_str (), + openssl_x509.c_str (), + nullptr}; // Print process command line. // diff --git a/bpkg/options-types.hxx b/bpkg/options-types.hxx index 3438be1..76650f1 100644 --- a/bpkg/options-types.hxx +++ b/bpkg/options-types.hxx @@ -31,7 +31,7 @@ namespace bpkg // // const char* option_qualifiers[] = {"foo", "bar", nullptr}; // - template <const char* Q[], typename V> + template <const char* const* Q, typename V> class qualified_option: public std::map<string, V> { public: @@ -39,7 +39,7 @@ namespace bpkg template <typename T> explicit - qualified_option (T v) {this->emplace ("", std::move (v));} + qualified_option (T v) {this->emplace (string (), V (std::move (v)));} qualified_option (): qualified_option (V ()) {} @@ -50,7 +50,7 @@ namespace bpkg { auto verify = [&q] () { - for (const char** p (Q); *p != nullptr; ++p) + for (const char* const* p (Q); *p != nullptr; ++p) { if (q == *p) return true; @@ -70,7 +70,7 @@ namespace bpkg } }; - extern const char* openssl_commands[]; + extern const char* openssl_commands[3]; // Clang bug requres explicit size. } #endif // BPKG_OPTIONS_TYPES_HXX diff --git a/bpkg/types-parsers.hxx b/bpkg/types-parsers.hxx index 24cc92d..d384223 100644 --- a/bpkg/types-parsers.hxx +++ b/bpkg/types-parsers.hxx @@ -47,7 +47,7 @@ namespace bpkg parse (repository_type&, bool&, scanner&); }; - template <const char* Q[], typename V> + template <const char* const* Q, typename V> struct parser<qualified_option<Q, V>> { static void diff --git a/bpkg/types-parsers.txx b/bpkg/types-parsers.txx index 7a40b0e..a747417 100644 --- a/bpkg/types-parsers.txx +++ b/bpkg/types-parsers.txx @@ -6,7 +6,7 @@ namespace bpkg { namespace cli { - template <const char* Q[], typename V> + template <const char* const* Q, typename V> void parser<qualified_option<Q, V>>:: parse (qualified_option<Q, V>& x, bool& xs, scanner& s) { @@ -25,7 +25,7 @@ namespace bpkg if (n != string::npos) { - const char** q (Q); + const char* const* q (Q); for (; *q != nullptr; ++q) { if (v.compare (0, n, *q) == 0) @@ -58,7 +58,7 @@ namespace bpkg // if (qv.empty ()) { - for (const char** q (Q); *q != nullptr; ++q) + for (const char* const* q (Q); *q != nullptr; ++q) { argv_scanner s (0, ac, av); parser<V>::parse (x[*q], dummy, s); |