diff options
| author | Billy O'Neal <bion@microsoft.com> | 2020-05-14 12:49:31 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-14 12:49:31 -0700 |
| commit | 5504dfa7da38a65981868fc7885744ac5d8f234e (patch) | |
| tree | 1d95de86ef1604d2393a05d5be16437d36fe6822 /toolsrc/include | |
| parent | 4727bc86a4d6fa2c009ae9932eef3a668a358e60 (diff) | |
| download | vcpkg-5504dfa7da38a65981868fc7885744ac5d8f234e.tar.gz vcpkg-5504dfa7da38a65981868fc7885744ac5d8f234e.zip | |
[vcpkg] Turn on tests and PREfast in CI, and fix tests to pass. (#11239)
Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
Diffstat (limited to 'toolsrc/include')
| -rw-r--r-- | toolsrc/include/catch2/catch.hpp | 4 | ||||
| -rw-r--r-- | toolsrc/include/pch.h | 2 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg-test/util.h | 2 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/json.h | 9 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/optional.h | 22 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/pragmas.h (renamed from toolsrc/include/vcpkg/pragmas.h) | 16 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/strings.h | 3 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/dependencies.h | 5 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/statusparagraph.h | 4 |
9 files changed, 35 insertions, 32 deletions
diff --git a/toolsrc/include/catch2/catch.hpp b/toolsrc/include/catch2/catch.hpp index 303f664ff..f471a2ec6 100644 --- a/toolsrc/include/catch2/catch.hpp +++ b/toolsrc/include/catch2/catch.hpp @@ -11282,10 +11282,10 @@ namespace Catch { Capturer::Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ) { auto trimmed = [&] (size_t start, size_t end) { - while (names[start] == ',' || isspace(names[start])) { + while (names[start] == ',' || isspace(static_cast<unsigned char>(names[start]))) { ++start; } - while (names[end] == ',' || isspace(names[end])) { + while (names[end] == ',' || isspace(static_cast<unsigned char>(names[end]))) { --end; } return names.substr(start, end - start + 1); diff --git a/toolsrc/include/pch.h b/toolsrc/include/pch.h index bdc13aedf..03e3f59f7 100644 --- a/toolsrc/include/pch.h +++ b/toolsrc/include/pch.h @@ -1,6 +1,6 @@ #pragma once -#include <vcpkg/pragmas.h> +#include <vcpkg/base/pragmas.h> #if defined(_WIN32) #define NOMINMAX diff --git a/toolsrc/include/vcpkg-test/util.h b/toolsrc/include/vcpkg-test/util.h index c15846d05..b6ea4b01d 100644 --- a/toolsrc/include/vcpkg-test/util.h +++ b/toolsrc/include/vcpkg-test/util.h @@ -1,5 +1,5 @@ #include <catch2/catch.hpp> -#include <vcpkg/pragmas.h> +#include <vcpkg/base/pragmas.h> #include <vcpkg/base/files.h> #include <vcpkg/statusparagraph.h> diff --git a/toolsrc/include/vcpkg/base/json.h b/toolsrc/include/vcpkg/base/json.h index 3da7ed776..2a1808857 100644 --- a/toolsrc/include/vcpkg/base/json.h +++ b/toolsrc/include/vcpkg/base/json.h @@ -5,9 +5,9 @@ #include <vcpkg/base/parse.h> #include <vcpkg/base/stringview.h> -#include <functional> #include <stddef.h> #include <stdint.h> +#include <memory> #include <string> #include <utility> #include <vector> @@ -148,11 +148,6 @@ namespace vcpkg::Json return this->underlying_[idx]; } - void sort(const std::function<bool(const Value&, const Value&)>& lt) - { - std::sort(this->begin(), this->end(), std::ref(lt)); - } - Array clone() const noexcept; iterator begin() { return underlying_.begin(); } @@ -205,8 +200,6 @@ namespace vcpkg::Json std::size_t size() const noexcept { return this->underlying_.size(); } - void sort_keys(const std::function<bool(StringView, StringView)>& lt) noexcept; - Object clone() const noexcept; struct const_iterator diff --git a/toolsrc/include/vcpkg/base/optional.h b/toolsrc/include/vcpkg/base/optional.h index 50586ecc8..0d77f4b03 100644 --- a/toolsrc/include/vcpkg/base/optional.h +++ b/toolsrc/include/vcpkg/base/optional.h @@ -1,5 +1,7 @@ #pragma once +#include <vcpkg/base/pragmas.h> + #include <vcpkg/base/lineinfo.h> #include <type_traits> @@ -19,9 +21,7 @@ namespace vcpkg template<class T, bool B = std::is_copy_constructible<T>::value> struct OptionalStorage { -#if defined(_WIN32) -#pragma warning(suppress : 26495) -#endif + VCPKG_MSVC_WARNING(suppress : 26495) constexpr OptionalStorage() noexcept : m_is_present(false), m_inactive() {} constexpr OptionalStorage(const T& t) : m_is_present(true), m_t(t) {} constexpr OptionalStorage(T&& t) : m_is_present(true), m_t(std::move(t)) {} @@ -31,17 +31,13 @@ namespace vcpkg if (m_is_present) m_t.~T(); } -#if defined(_WIN32) -#pragma warning(suppress : 26495) -#endif + VCPKG_MSVC_WARNING(suppress : 26495) OptionalStorage(const OptionalStorage& o) : m_is_present(o.m_is_present), m_inactive() { if (m_is_present) new (&m_t) T(o.m_t); } -#if defined(_WIN32) -#pragma warning(suppress : 26495) -#endif + VCPKG_MSVC_WARNING(suppress : 26495) OptionalStorage(OptionalStorage&& o) noexcept : m_is_present(o.m_is_present), m_inactive() { if (m_is_present) @@ -109,9 +105,7 @@ namespace vcpkg template<class T> struct OptionalStorage<T, false> { -#if defined(_WIN32) -#pragma warning(suppress : 26495) -#endif + VCPKG_MSVC_WARNING(suppress : 26495) constexpr OptionalStorage() noexcept : m_is_present(false), m_inactive() {} constexpr OptionalStorage(T&& t) : m_is_present(true), m_t(std::move(t)) {} @@ -120,9 +114,7 @@ namespace vcpkg if (m_is_present) m_t.~T(); } -#if defined(_WIN32) -#pragma warning(suppress : 26495) -#endif + VCPKG_MSVC_WARNING(suppress : 26495) OptionalStorage(OptionalStorage&& o) noexcept : m_is_present(o.m_is_present), m_inactive() { if (m_is_present) diff --git a/toolsrc/include/vcpkg/pragmas.h b/toolsrc/include/vcpkg/base/pragmas.h index 69b958fff..97d01955e 100644 --- a/toolsrc/include/vcpkg/pragmas.h +++ b/toolsrc/include/vcpkg/base/pragmas.h @@ -14,3 +14,19 @@ // [[nodiscard]] is not recognized before GCC version 7 #pragma GCC diagnostic ignored "-Wattributes" #endif + +#if defined(_MSC_VER) +#include <sal.h> +#endif + +#ifndef _Analysis_assume_ +#define _Analysis_assume_(...) +#endif + +#ifdef _MSC_VER +#define VCPKG_MSVC_WARNING(...) __pragma(warning(__VA_ARGS__)) +#define GCC_DIAGNOSTIC(...) +#else +#define VCPKG_MSVC_WARNING(...) +#define GCC_DIAGNOSTIC(...) _Pragma("diagnostic " #__VA_ARGS__) +#endif diff --git a/toolsrc/include/vcpkg/base/strings.h b/toolsrc/include/vcpkg/base/strings.h index 481e686d1..d80e040ee 100644 --- a/toolsrc/include/vcpkg/base/strings.h +++ b/toolsrc/include/vcpkg/base/strings.h @@ -1,11 +1,12 @@ #pragma once +#include <vcpkg/base/pragmas.h> + #include <vcpkg/base/cstringview.h> #include <vcpkg/base/optional.h> #include <vcpkg/base/stringliteral.h> #include <vcpkg/base/stringview.h> #include <vcpkg/base/view.h> -#include <vcpkg/pragmas.h> #include <vector> diff --git a/toolsrc/include/vcpkg/dependencies.h b/toolsrc/include/vcpkg/dependencies.h index 26ba9a67c..d2eca4408 100644 --- a/toolsrc/include/vcpkg/dependencies.h +++ b/toolsrc/include/vcpkg/dependencies.h @@ -10,6 +10,7 @@ #include <vcpkg/vcpkgpaths.h> #include <functional> +#include <map> #include <vector> namespace vcpkg::Graphs @@ -50,7 +51,7 @@ namespace vcpkg::Dependencies InstallPlanAction(const PackageSpec& spec, const SourceControlFileLocation& scfl, const RequestType& request_type, - std::unordered_map<std::string, std::vector<FeatureSpec>>&& dependencies); + std::map<std::string, std::vector<FeatureSpec>>&& dependencies); std::string displayname() const; const std::string& public_abi() const; @@ -64,7 +65,7 @@ namespace vcpkg::Dependencies RequestType request_type; Build::BuildPackageOptions build_options; - std::unordered_map<std::string, std::vector<FeatureSpec>> feature_dependencies; + std::map<std::string, std::vector<FeatureSpec>> feature_dependencies; std::vector<PackageSpec> package_dependencies; std::vector<std::string> feature_list; diff --git a/toolsrc/include/vcpkg/statusparagraph.h b/toolsrc/include/vcpkg/statusparagraph.h index 2c6d34865..fdcb5337d 100644 --- a/toolsrc/include/vcpkg/statusparagraph.h +++ b/toolsrc/include/vcpkg/statusparagraph.h @@ -2,7 +2,7 @@ #include <vcpkg/binaryparagraph.h> -#include <unordered_map> +#include <map> namespace vcpkg { @@ -56,7 +56,7 @@ namespace vcpkg const PackageSpec& spec() const { return core->package.spec; } std::vector<PackageSpec> dependencies() const; - std::unordered_map<std::string, std::vector<FeatureSpec>> feature_dependencies() const; + std::map<std::string, std::vector<FeatureSpec>> feature_dependencies() const; const StatusParagraph* core; std::vector<const StatusParagraph*> features; |
