From 94ef325828961dc5c9f721a0eb9fcc5ba8a2b765 Mon Sep 17 00:00:00 2001 From: Curtis J Bezault Date: Wed, 21 Aug 2019 14:23:15 -0700 Subject: [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 --- toolsrc/src/vcpkg/export.cpp | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'toolsrc/src') 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& out_opt; }; - const auto options_implies = - [&](const std::string& main_opt_name, bool main_opt, Span 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& 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 -- cgit v1.2.3