diff options
| author | Curtis J Bezault <curtbezault@gmail.com> | 2019-08-21 14:23:15 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-21 14:23:15 -0700 |
| commit | 94ef325828961dc5c9f721a0eb9fcc5ba8a2b765 (patch) | |
| tree | a3f3e44463fe19469b89dd96ec79a9eddde7c41f /toolsrc/src | |
| parent | 34a26540b1d2034aa8802feb1078a54b74368fcd (diff) | |
| download | vcpkg-94ef325828961dc5c9f721a0eb9fcc5ba8a2b765.tar.gz vcpkg-94ef325828961dc5c9f721a0eb9fcc5ba8a2b765.zip | |
[vcpkg] Fix gcc-9 warning (#7816)
* drop one usage of span in export. Span is not appropriate for rvalues
* Add back reference
* Fix @ubsan 's comments
Diffstat (limited to 'toolsrc/src')
| -rw-r--r-- | toolsrc/src/vcpkg/export.cpp | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/toolsrc/src/vcpkg/export.cpp b/toolsrc/src/vcpkg/export.cpp index 8f5034eee..5ceb47adf 100644 --- a/toolsrc/src/vcpkg/export.cpp +++ b/toolsrc/src/vcpkg/export.cpp @@ -339,26 +339,27 @@ namespace vcpkg::Export struct OptionPair { - const std::string& name; + const StringLiteral& name; Optional<std::string>& out_opt; }; - const auto options_implies = - [&](const std::string& main_opt_name, bool main_opt, Span<const OptionPair> implying_opts) { - if (main_opt) - { - for (auto&& opt : implying_opts) - opt.out_opt = maybe_lookup(options.settings, opt.name); - } - else - { - for (auto&& opt : implying_opts) - Checks::check_exit(VCPKG_LINE_INFO, - !maybe_lookup(options.settings, opt.name), - "%s is only valid with %s", - opt.name, - main_opt_name); - } - }; + const auto options_implies = [&](const StringLiteral& main_opt_name, + bool is_main_opt, + const std::initializer_list<OptionPair>& implying_opts) { + if (is_main_opt) + { + for (auto&& opt : implying_opts) + opt.out_opt = maybe_lookup(options.settings, opt.name); + } + else + { + for (auto&& opt : implying_opts) + Checks::check_exit(VCPKG_LINE_INFO, + !maybe_lookup(options.settings, opt.name), + "%s is only valid with %s", + opt.name, + main_opt_name); + } + }; #if defined(_MSC_VER) && _MSC_VER <= 1900 // there's a bug in VS 2015 that causes a bunch of "unreferenced local variable" warnings |
