diff options
| author | nicole mazzuca <mazzucan@outlook.com> | 2020-07-06 16:45:34 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-06 16:45:34 -0700 |
| commit | 6a41626eaf33d2f3392e06d98a94c630bfc30977 (patch) | |
| tree | fb92f59f27b99c56ed48f6cae649468b4407a073 /toolsrc/src | |
| parent | ae4968fad40e8c14541dae89c481ec32c0500426 (diff) | |
| download | vcpkg-6a41626eaf33d2f3392e06d98a94c630bfc30977.tar.gz vcpkg-6a41626eaf33d2f3392e06d98a94c630bfc30977.zip | |
[vcpkg] Format the C++ in CI (#11655)
* [vcpkg] Format the C++ in the CI
* format the C++
* CR
Diffstat (limited to 'toolsrc/src')
63 files changed, 333 insertions, 307 deletions
diff --git a/toolsrc/src/vcpkg-fuzz/main.cpp b/toolsrc/src/vcpkg-fuzz/main.cpp index bbff0d98d..af482fb56 100644 --- a/toolsrc/src/vcpkg-fuzz/main.cpp +++ b/toolsrc/src/vcpkg-fuzz/main.cpp @@ -1,16 +1,16 @@ +#include <string.h> + +#include <iostream> +#include <sstream> +#include <utility> + #include <vcpkg/base/checks.h> #include <vcpkg/base/json.h> #include <vcpkg/base/stringview.h> #include <vcpkg/base/system.print.h> #include <vcpkg/base/unicode.h> - #include <vcpkg/platform-expression.h> -#include <iostream> -#include <sstream> -#include <string.h> -#include <utility> - using namespace vcpkg; namespace @@ -86,9 +86,12 @@ namespace { auto first = std::find_if(arg.begin(), arg.end(), [](char c) { return c != '-'; }); auto division = std::find(first, arg.end(), '='); - if (division == arg.end()) { + if (division == arg.end()) + { return {StringView(first, arg.end()), StringView(arg.end(), arg.end())}; - } else { + } + else + { return {StringView(first, division), StringView(division + 1, arg.end())}; } } @@ -152,8 +155,10 @@ Options: [[noreturn]] void fuzz_platform_expr_and_exit(StringView text) { - auto res1 = PlatformExpression::parse_platform_expression(text, PlatformExpression::MultipleBinaryOperators::Deny); - auto res2 = PlatformExpression::parse_platform_expression(text, PlatformExpression::MultipleBinaryOperators::Allow); + auto res1 = + PlatformExpression::parse_platform_expression(text, PlatformExpression::MultipleBinaryOperators::Deny); + auto res2 = + PlatformExpression::parse_platform_expression(text, PlatformExpression::MultipleBinaryOperators::Allow); if (!res1) { diff --git a/toolsrc/src/vcpkg-test/arguments.cpp b/toolsrc/src/vcpkg-test/arguments.cpp index 3ce4c5a9b..a40edc945 100644 --- a/toolsrc/src/vcpkg-test/arguments.cpp +++ b/toolsrc/src/vcpkg-test/arguments.cpp @@ -1,9 +1,9 @@ #include <catch2/catch.hpp> -#include <vcpkg/vcpkgcmdarguments.h> - #include <vector> +#include <vcpkg/vcpkgcmdarguments.h> + using vcpkg::CommandSetting; using vcpkg::CommandStructure; using vcpkg::CommandSwitch; diff --git a/toolsrc/src/vcpkg-test/binarycaching.cpp b/toolsrc/src/vcpkg-test/binarycaching.cpp index b220b5ccb..49386b529 100644 --- a/toolsrc/src/vcpkg-test/binarycaching.cpp +++ b/toolsrc/src/vcpkg-test/binarycaching.cpp @@ -1,12 +1,14 @@ #include <catch2/catch.hpp> -#include <vcpkg/binarycaching.private.h> -#include <vcpkg/binarycaching.h> + +#include <string> + #include <vcpkg/base/files.h> +#include <vcpkg/binarycaching.h> +#include <vcpkg/binarycaching.private.h> #include <vcpkg/dependencies.h> -#include <vcpkg/vcpkgcmdarguments.h> -#include <vcpkg/sourceparagraph.h> #include <vcpkg/paragraphs.h> -#include <string> +#include <vcpkg/sourceparagraph.h> +#include <vcpkg/vcpkgcmdarguments.h> using namespace vcpkg; diff --git a/toolsrc/src/vcpkg-test/binaryconfigparser.cpp b/toolsrc/src/vcpkg-test/binaryconfigparser.cpp index 11ed32900..1fd158446 100644 --- a/toolsrc/src/vcpkg-test/binaryconfigparser.cpp +++ b/toolsrc/src/vcpkg-test/binaryconfigparser.cpp @@ -1,4 +1,5 @@ #include <catch2/catch.hpp> + #include <vcpkg/binarycaching.h> using namespace vcpkg; diff --git a/toolsrc/src/vcpkg-test/commands.build.cpp b/toolsrc/src/vcpkg-test/commands.build.cpp index bc0dc5b4e..573d217e4 100644 --- a/toolsrc/src/vcpkg-test/commands.build.cpp +++ b/toolsrc/src/vcpkg-test/commands.build.cpp @@ -1,12 +1,13 @@ #include <catch2/catch.hpp> -#include <string> #include <iterator> +#include <string> + +#include <vcpkg-test/util.h> #include <vcpkg/base/files.h> #include <vcpkg/commands.h> #include <vcpkg/vcpkgcmdarguments.h> #include <vcpkg/vcpkgpaths.h> -#include <vcpkg-test/util.h> using namespace vcpkg; diff --git a/toolsrc/src/vcpkg-test/commands.create.cpp b/toolsrc/src/vcpkg-test/commands.create.cpp index 4a89d0799..345527cca 100644 --- a/toolsrc/src/vcpkg-test/commands.create.cpp +++ b/toolsrc/src/vcpkg-test/commands.create.cpp @@ -1,7 +1,8 @@ #include <catch2/catch.hpp> -#include <string> #include <iterator> +#include <string> + #include <vcpkg/base/files.h> #include <vcpkg/commands.h> #include <vcpkg/vcpkgcmdarguments.h> @@ -11,7 +12,7 @@ TEST_CASE ("create smoke test", "[commands-create]") { using namespace vcpkg; static const std::string argsRaw[] = {"create", "zlib2", "http://zlib.net/zlib-1.2.11.tar.gz", "zlib-1.2.11.zip"}; - + auto& fsWrapper = Files::get_real_filesystem(); VcpkgCmdArguments args = VcpkgCmdArguments::create_from_arg_sequence(std::begin(argsRaw), std::end(argsRaw)); VcpkgPaths paths(fsWrapper, args); diff --git a/toolsrc/src/vcpkg-test/dependencies.cpp b/toolsrc/src/vcpkg-test/dependencies.cpp index 4a4b1ac06..ad4fff9e4 100644 --- a/toolsrc/src/vcpkg-test/dependencies.cpp +++ b/toolsrc/src/vcpkg-test/dependencies.cpp @@ -1,4 +1,5 @@ #include <catch2/catch.hpp> + #include <vcpkg-test/mockcmakevarprovider.h> #include <vcpkg-test/util.h> #include <vcpkg/dependencies.h> diff --git a/toolsrc/src/vcpkg-test/files.cpp b/toolsrc/src/vcpkg-test/files.cpp index cbe1e81c3..0a8362a51 100644 --- a/toolsrc/src/vcpkg-test/files.cpp +++ b/toolsrc/src/vcpkg-test/files.cpp @@ -1,14 +1,13 @@ #include <catch2/catch.hpp> -#include <vcpkg-test/util.h> - -#include <vcpkg/base/files.h> -#include <vcpkg/base/strings.h> #include <iostream> #include <random> - #include <vector> +#include <vcpkg-test/util.h> +#include <vcpkg/base/files.h> +#include <vcpkg/base/strings.h> + using vcpkg::Test::AllowSymlinks; using vcpkg::Test::base_temporary_directory; using vcpkg::Test::can_create_symlinks; @@ -38,21 +37,21 @@ namespace struct MaxDepth { std::uint64_t i; - explicit MaxDepth(std::uint64_t i) : i(i) {} + explicit MaxDepth(std::uint64_t i) : i(i) { } operator uint64_t() const { return i; } }; struct Width { std::uint64_t i; - explicit Width(std::uint64_t i) : i(i) {} + explicit Width(std::uint64_t i) : i(i) { } operator uint64_t() const { return i; } }; struct CurrentDepth { std::uint64_t i; - explicit CurrentDepth(std::uint64_t i) : i(i) {} + explicit CurrentDepth(std::uint64_t i) : i(i) { } operator uint64_t() const { return i; } CurrentDepth incremented() const { return CurrentDepth{i + 1}; } }; diff --git a/toolsrc/src/vcpkg-test/hash.cpp b/toolsrc/src/vcpkg-test/hash.cpp index 9f3ccc25e..88c7bd7b0 100644 --- a/toolsrc/src/vcpkg-test/hash.cpp +++ b/toolsrc/src/vcpkg-test/hash.cpp @@ -1,12 +1,12 @@ #include <catch2/catch.hpp> -#include <vcpkg/base/hash.h> - #include <algorithm> #include <iostream> #include <iterator> #include <map> +#include <vcpkg/base/hash.h> + namespace Hash = vcpkg::Hash; using vcpkg::StringView; diff --git a/toolsrc/src/vcpkg-test/json.cpp b/toolsrc/src/vcpkg-test/json.cpp index 86335d468..19aaaa6fe 100644 --- a/toolsrc/src/vcpkg-test/json.cpp +++ b/toolsrc/src/vcpkg-test/json.cpp @@ -1,10 +1,10 @@ #include <catch2/catch.hpp> #include <iostream> -#include <vcpkg/base/json.h> -#include <vcpkg/base/unicode.h> #include "math.h" +#include <vcpkg/base/json.h> +#include <vcpkg/base/unicode.h> // TODO: remove this once we switch to C++20 completely // This is the worst, but we also can't really deal with it any other way. @@ -178,7 +178,8 @@ TEST_CASE ("JSON parse full file", "[json]") ; auto res = Json::parse(json); - if (!res) { + if (!res) + { std::cerr << res.error()->format() << '\n'; } REQUIRE(res); diff --git a/toolsrc/src/vcpkg-test/manifests.cpp b/toolsrc/src/vcpkg-test/manifests.cpp index a6c661301..bfe15cd2a 100644 --- a/toolsrc/src/vcpkg-test/manifests.cpp +++ b/toolsrc/src/vcpkg-test/manifests.cpp @@ -1,6 +1,6 @@ #include <catch2/catch.hpp> -#include <vcpkg-test/util.h> +#include <vcpkg-test/util.h> #include <vcpkg/base/json.h> #include <vcpkg/base/util.h> #include <vcpkg/paragraphs.h> @@ -108,9 +108,12 @@ TEST_CASE ("manifest construct maximum", "[manifests]") REQUIRE(pgh.feature_paragraphs[0]->dependencies[2].name == "order.white-lotus"); REQUIRE(pgh.feature_paragraphs[0]->dependencies[2].features.size() == 1); REQUIRE(pgh.feature_paragraphs[0]->dependencies[2].features[0] == "the-ancient-ways"); - REQUIRE_FALSE(pgh.feature_paragraphs[0]->dependencies[2].platform.evaluate({{"VCPKG_CMAKE_SYSTEM_NAME", ""}, {"VCPKG_TARGET_ARCHITECTURE", "arm"}})); - REQUIRE(pgh.feature_paragraphs[0]->dependencies[2].platform.evaluate({{"VCPKG_CMAKE_SYSTEM_NAME", ""}, {"VCPKG_TARGET_ARCHITECTURE", "x86"}})); - REQUIRE(pgh.feature_paragraphs[0]->dependencies[2].platform.evaluate({{"VCPKG_CMAKE_SYSTEM_NAME", "Linux"}, {"VCPKG_TARGET_ARCHITECTURE", "x86"}})); + REQUIRE_FALSE(pgh.feature_paragraphs[0]->dependencies[2].platform.evaluate( + {{"VCPKG_CMAKE_SYSTEM_NAME", ""}, {"VCPKG_TARGET_ARCHITECTURE", "arm"}})); + REQUIRE(pgh.feature_paragraphs[0]->dependencies[2].platform.evaluate( + {{"VCPKG_CMAKE_SYSTEM_NAME", ""}, {"VCPKG_TARGET_ARCHITECTURE", "x86"}})); + REQUIRE(pgh.feature_paragraphs[0]->dependencies[2].platform.evaluate( + {{"VCPKG_CMAKE_SYSTEM_NAME", "Linux"}, {"VCPKG_TARGET_ARCHITECTURE", "x86"}})); REQUIRE(pgh.feature_paragraphs[1]->name == "zuko"); REQUIRE(pgh.feature_paragraphs[1]->description.size() == 2); @@ -230,6 +233,7 @@ TEST_CASE ("SourceParagraph manifest empty supports", "[manifests]") "name": "a", "version-string": "1.0", "supports": "" - })json", true); + })json", + true); REQUIRE_FALSE(m_pgh.has_value()); } diff --git a/toolsrc/src/vcpkg-test/optional.cpp b/toolsrc/src/vcpkg-test/optional.cpp index c2348c5c6..f7b2770b8 100644 --- a/toolsrc/src/vcpkg-test/optional.cpp +++ b/toolsrc/src/vcpkg-test/optional.cpp @@ -1,7 +1,9 @@ #include <catch2/catch.hpp> -#include <vcpkg/base/optional.h> + #include <vector> +#include <vcpkg/base/optional.h> + namespace { struct identity_projection diff --git a/toolsrc/src/vcpkg-test/paragraph.cpp b/toolsrc/src/vcpkg-test/paragraph.cpp index 6c2103d5f..e4b2cf0e2 100644 --- a/toolsrc/src/vcpkg-test/paragraph.cpp +++ b/toolsrc/src/vcpkg-test/paragraph.cpp @@ -1,8 +1,7 @@ #include <catch2/catch.hpp> -#include <vcpkg-test/util.h> +#include <vcpkg-test/util.h> #include <vcpkg/base/strings.h> - #include <vcpkg/paragraphs.h> namespace Strings = vcpkg::Strings; diff --git a/toolsrc/src/vcpkg-test/plan.cpp b/toolsrc/src/vcpkg-test/plan.cpp index b93ec54ce..a6c9a54ec 100644 --- a/toolsrc/src/vcpkg-test/plan.cpp +++ b/toolsrc/src/vcpkg-test/plan.cpp @@ -1,17 +1,17 @@ #include <catch2/catch.hpp> + +#include <memory> +#include <unordered_map> +#include <vector> + #include <vcpkg-test/mockcmakevarprovider.h> #include <vcpkg-test/util.h> - #include <vcpkg/base/graphs.h> #include <vcpkg/dependencies.h> #include <vcpkg/portfileprovider.h> #include <vcpkg/sourceparagraph.h> #include <vcpkg/triplet.h> -#include <memory> -#include <unordered_map> -#include <vector> - using namespace vcpkg; using Test::make_control_file; diff --git a/toolsrc/src/vcpkg-test/statusparagraphs.cpp b/toolsrc/src/vcpkg-test/statusparagraphs.cpp index acb8b333c..f2d8ba37c 100644 --- a/toolsrc/src/vcpkg-test/statusparagraphs.cpp +++ b/toolsrc/src/vcpkg-test/statusparagraphs.cpp @@ -1,6 +1,6 @@ #include <catch2/catch.hpp> -#include <vcpkg-test/util.h> +#include <vcpkg-test/util.h> #include <vcpkg/base/util.h> #include <vcpkg/paragraphs.h> #include <vcpkg/statusparagraphs.h> diff --git a/toolsrc/src/vcpkg-test/strings.cpp b/toolsrc/src/vcpkg-test/strings.cpp index 3172b557f..da3198976 100644 --- a/toolsrc/src/vcpkg-test/strings.cpp +++ b/toolsrc/src/vcpkg-test/strings.cpp @@ -1,11 +1,12 @@ #include <catch2/catch.hpp> -#include <vcpkg/base/strings.h> - #include <stdint.h> + +#include <string> #include <utility> #include <vector> -#include <string> + +#include <vcpkg/base/strings.h> TEST_CASE ("b32 encoding", "[strings]") { diff --git a/toolsrc/src/vcpkg-test/stringview.cpp b/toolsrc/src/vcpkg-test/stringview.cpp index 4df8e6be5..953a7de99 100644 --- a/toolsrc/src/vcpkg-test/stringview.cpp +++ b/toolsrc/src/vcpkg-test/stringview.cpp @@ -2,16 +2,18 @@ #include <vcpkg/base/stringview.h> -template <std::size_t N> -static vcpkg::StringView sv(const char (&cstr)[N]) { - return cstr; +template<std::size_t N> +static vcpkg::StringView sv(const char (&cstr)[N]) +{ + return cstr; } -TEST_CASE("string view operator==", "[stringview]") { - // these are due to a bug in operator== - // see commit 782723959399a1a0725ac49 - REQUIRE(sv("hey") != sv("heys")); - REQUIRE(sv("heys") != sv("hey")); - REQUIRE(sv("hey") == sv("hey")); - REQUIRE(sv("hey") != sv("hex")); +TEST_CASE ("string view operator==", "[stringview]") +{ + // these are due to a bug in operator== + // see commit 782723959399a1a0725ac49 + REQUIRE(sv("hey") != sv("heys")); + REQUIRE(sv("heys") != sv("hey")); + REQUIRE(sv("hey") == sv("hey")); + REQUIRE(sv("hey") != sv("hex")); } diff --git a/toolsrc/src/vcpkg-test/system.cpp b/toolsrc/src/vcpkg-test/system.cpp index 8b44f8f24..596b569a7 100644 --- a/toolsrc/src/vcpkg-test/system.cpp +++ b/toolsrc/src/vcpkg-test/system.cpp @@ -1,13 +1,15 @@ #include <vcpkg/base/system_headers.h> + #include <catch2/catch.hpp> #include <string> + #include <vcpkg/base/optional.h> -#include <vcpkg/base/stringview.h> -#include <vcpkg/base/zstringview.h> #include <vcpkg/base/strings.h> +#include <vcpkg/base/stringview.h> #include <vcpkg/base/system.h> #include <vcpkg/base/system.process.h> +#include <vcpkg/base/zstringview.h> using vcpkg::nullopt; using vcpkg::Optional; diff --git a/toolsrc/src/vcpkg-test/uint128.cpp b/toolsrc/src/vcpkg-test/uint128.cpp index 57d0169af..a13b25e4f 100644 --- a/toolsrc/src/vcpkg-test/uint128.cpp +++ b/toolsrc/src/vcpkg-test/uint128.cpp @@ -2,63 +2,67 @@ #include <vcpkg/base/uint128.h> -TEST_CASE ("uint128 constructor and assign", "[uint128]") { - vcpkg::UInt128 x = 120; - REQUIRE(x.bottom_64_bits() == 120); - REQUIRE(x.top_64_bits() == 0); +TEST_CASE ("uint128 constructor and assign", "[uint128]") +{ + vcpkg::UInt128 x = 120; + REQUIRE(x.bottom_64_bits() == 120); + REQUIRE(x.top_64_bits() == 0); - x = 3201; - REQUIRE(x.bottom_64_bits() == 3201); - REQUIRE(x.top_64_bits() == 0); - - x = 0xFFFF'FFFF'FFFF'FFFF; - REQUIRE(x.bottom_64_bits() == 0xFFFF'FFFF'FFFF'FFFF); - REQUIRE(x.top_64_bits() == 0); + x = 3201; + REQUIRE(x.bottom_64_bits() == 3201); + REQUIRE(x.top_64_bits() == 0); + + x = 0xFFFF'FFFF'FFFF'FFFF; + REQUIRE(x.bottom_64_bits() == 0xFFFF'FFFF'FFFF'FFFF); + REQUIRE(x.top_64_bits() == 0); } -TEST_CASE ("uint128 add-assign", "[uint128]") { - vcpkg::UInt128 x = 0xFFFF'FFFF'FFFF'FFFF; - x += 1; - REQUIRE(x.bottom_64_bits() == 0); - REQUIRE(x.top_64_bits() == 1); +TEST_CASE ("uint128 add-assign", "[uint128]") +{ + vcpkg::UInt128 x = 0xFFFF'FFFF'FFFF'FFFF; + x += 1; + REQUIRE(x.bottom_64_bits() == 0); + REQUIRE(x.top_64_bits() == 1); } -TEST_CASE ("uint128 shl-assign", "[uint128]") { - vcpkg::UInt128 x = 0xFFFF'FFFF'FFFF'FFFF; - x <<= 32; - REQUIRE(x.bottom_64_bits() == 0xFFFF'FFFF'0000'0000); - REQUIRE(x.top_64_bits() == 0x0000'0000'FFFF'FFFF); - - x <<= 60; - REQUIRE(x.bottom_64_bits() == 0); - REQUIRE(x.top_64_bits() == 0xFFFF'FFFF'F000'0000); +TEST_CASE ("uint128 shl-assign", "[uint128]") +{ + vcpkg::UInt128 x = 0xFFFF'FFFF'FFFF'FFFF; + x <<= 32; + REQUIRE(x.bottom_64_bits() == 0xFFFF'FFFF'0000'0000); + REQUIRE(x.top_64_bits() == 0x0000'0000'FFFF'FFFF); + + x <<= 60; + REQUIRE(x.bottom_64_bits() == 0); + REQUIRE(x.top_64_bits() == 0xFFFF'FFFF'F000'0000); - x = 1; - x <<= 96; - REQUIRE(x.bottom_64_bits() == 0); - REQUIRE(x.top_64_bits() == (uint64_t(1) << 32)); + x = 1; + x <<= 96; + REQUIRE(x.bottom_64_bits() == 0); + REQUIRE(x.top_64_bits() == (uint64_t(1) << 32)); } -TEST_CASE ("uint128 shr-assign", "[uint128]") { - vcpkg::UInt128 x = 0xFFFF'FFFF'FFFF'FFFF; - x <<= 64; - REQUIRE(x.bottom_64_bits() == 0x0000'0000'0000'0000); - REQUIRE(x.top_64_bits() == 0xFFFF'FFFF'FFFF'FFFF); +TEST_CASE ("uint128 shr-assign", "[uint128]") +{ + vcpkg::UInt128 x = 0xFFFF'FFFF'FFFF'FFFF; + x <<= 64; + REQUIRE(x.bottom_64_bits() == 0x0000'0000'0000'0000); + REQUIRE(x.top_64_bits() == 0xFFFF'FFFF'FFFF'FFFF); + + x >>= 32; + REQUIRE(x.bottom_64_bits() == 0xFFFF'FFFF'0000'0000); + REQUIRE(x.top_64_bits() == 0x0000'0000'FFFF'FFFF); - x >>= 32; - REQUIRE(x.bottom_64_bits() == 0xFFFF'FFFF'0000'0000); - REQUIRE(x.top_64_bits() == 0x0000'0000'FFFF'FFFF); - - x >>= 60; - REQUIRE(x.bottom_64_bits() == 0x0000'000F'FFFF'FFFF); - REQUIRE(x.top_64_bits() == 0x0000'0000'0000'0000); + x >>= 60; + REQUIRE(x.bottom_64_bits() == 0x0000'000F'FFFF'FFFF); + REQUIRE(x.top_64_bits() == 0x0000'0000'0000'0000); - x = 0x8000'0000'0000'0000; - x <<= 64; - REQUIRE(x.bottom_64_bits() == 0); - REQUIRE(x.top_64_bits() == 0x8000'0000'0000'0000); + x = 0x8000'0000'0000'0000; + x <<= 64; + REQUIRE(x.bottom_64_bits() == 0); + REQUIRE(x.top_64_bits() == 0x8000'0000'0000'0000); - x >>= 96; - REQUIRE(x.bottom_64_bits() == (uint64_t(1) << 31)); - REQUIRE(x.top_64_bits() == 0); + x >>= 96; + REQUIRE(x.bottom_64_bits() == (uint64_t(1) << 31)); + REQUIRE(x.top_64_bits() == 0); } diff --git a/toolsrc/src/vcpkg-test/update.cpp b/toolsrc/src/vcpkg-test/update.cpp index 5370a8421..0ae893855 100644 --- a/toolsrc/src/vcpkg-test/update.cpp +++ b/toolsrc/src/vcpkg-test/update.cpp @@ -1,8 +1,7 @@ #include <catch2/catch.hpp> -#include <vcpkg-test/util.h> +#include <vcpkg-test/util.h> #include <vcpkg/base/sortedvector.h> - #include <vcpkg/update.h> using namespace vcpkg; diff --git a/toolsrc/src/vcpkg-test/util.cpp b/toolsrc/src/vcpkg-test/util.cpp index c0b898145..c857db5b2 100644 --- a/toolsrc/src/vcpkg-test/util.cpp +++ b/toolsrc/src/vcpkg-test/util.cpp @@ -1,8 +1,8 @@ #include <vcpkg/base/system_headers.h> #include <catch2/catch.hpp> -#include <vcpkg-test/util.h> +#include <vcpkg-test/util.h> #include <vcpkg/base/checks.h> #include <vcpkg/base/files.h> #include <vcpkg/base/util.h> @@ -10,7 +10,6 @@ // used to get the implementation specific compiler flags (i.e., __cpp_lib_filesystem) #include <ciso646> - #include <iostream> #include <memory> @@ -114,18 +113,20 @@ namespace vcpkg::Test #elif !defined(_WIN32) // FILESYSTEM_SYMLINK == FILESYSTEM_SYMLINK_STD return AllowSymlinks::Yes; #else - constexpr static const wchar_t regkey[] = - LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock)"; + constexpr static const wchar_t regkey[] = LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock)"; constexpr static const wchar_t regkey_member[] = LR"(AllowDevelopmentWithoutDevLicense)"; DWORD data; DWORD dataSize = sizeof(data); - const auto status = RegGetValueW( - HKEY_LOCAL_MACHINE, regkey, regkey_member, RRF_RT_DWORD, nullptr, &data, &dataSize); + const auto status = + RegGetValueW(HKEY_LOCAL_MACHINE, regkey, regkey_member, RRF_RT_DWORD, nullptr, &data, &dataSize); - if (status == ERROR_SUCCESS && data == 1) { + if (status == ERROR_SUCCESS && data == 1) + { return AllowSymlinks::Yes; - } else { + } + else + { std::cout << "Symlinks are not allowed on this system\n"; return AllowSymlinks::No; } @@ -155,7 +156,6 @@ namespace vcpkg::Test #endif } - const fs::path& base_temporary_directory() noexcept { const static fs::path BASE_TEMPORARY_DIRECTORY = internal_base_temporary_directory(); diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index 9cd964067..b6f0782fa 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -1,9 +1,13 @@ -#include <vcpkg/base/pragmas.h> - #include <vcpkg/base/system_headers.h> +#include <cassert> +#include <fstream> +#include <memory> +#include <random> + #include <vcpkg/base/chrono.h> #include <vcpkg/base/files.h> +#include <vcpkg/base/pragmas.h> #include <vcpkg/base/strings.h> #include <vcpkg/base/system.debug.h> #include <vcpkg/base/system.print.h> @@ -17,11 +21,6 @@ #include <vcpkg/userconfig.h> #include <vcpkg/vcpkglib.h> -#include <cassert> -#include <fstream> -#include <memory> -#include <random> - #if defined(_WIN32) #pragma comment(lib, "ole32") #pragma comment(lib, "shell32") diff --git a/toolsrc/src/vcpkg/base/files.cpp b/toolsrc/src/vcpkg/base/files.cpp index 32a382154..551938990 100644 --- a/toolsrc/src/vcpkg/base/files.cpp +++ b/toolsrc/src/vcpkg/base/files.cpp @@ -10,6 +10,7 @@ #if !defined(_WIN32) #include <fcntl.h> + #include <sys/file.h> #include <sys/stat.h> #endif diff --git a/toolsrc/src/vcpkg/base/hash.cpp b/toolsrc/src/vcpkg/base/hash.cpp index 45ce43cdd..58e17e1ad 100644 --- a/toolsrc/src/vcpkg/base/hash.cpp +++ b/toolsrc/src/vcpkg/base/hash.cpp @@ -1,11 +1,10 @@ #include "pch.h" -#include <vcpkg/base/hash.h> - #include <vcpkg/base/checks.h> -#include <vcpkg/base/uint128.h> +#include <vcpkg/base/hash.h> #include <vcpkg/base/strings.h> #include <vcpkg/base/system.process.h> +#include <vcpkg/base/uint128.h> #include <vcpkg/base/util.h> #if defined(_WIN32) @@ -51,12 +50,14 @@ namespace vcpkg::Hash } } - template <class UIntTy> - auto top_bits(UIntTy x) -> std::enable_if_t<std::is_unsigned<UIntTy>::value, uchar> { + template<class UIntTy> + auto top_bits(UIntTy x) -> std::enable_if_t<std::is_unsigned<UIntTy>::value, uchar> + { return static_cast<uchar>(x >> ((sizeof(x) - 1) * 8)); } - template <class UIntTy> - auto top_bits(UIntTy x) -> decltype(top_bits(x.top_64_bits())) { + template<class UIntTy> + auto top_bits(UIntTy x) -> decltype(top_bits(x.top_64_bits())) + { return top_bits(x.top_64_bits()); } diff --git a/toolsrc/src/vcpkg/base/json.cpp b/toolsrc/src/vcpkg/base/json.cpp index 0972915eb..1e9b413c9 100644 --- a/toolsrc/src/vcpkg/base/json.cpp +++ b/toolsrc/src/vcpkg/base/json.cpp @@ -1,12 +1,12 @@ #include "pch.h" +#include <inttypes.h> + #include <vcpkg/base/files.h> #include <vcpkg/base/json.h> #include <vcpkg/base/system.debug.h> #include <vcpkg/base/unicode.h> -#include <inttypes.h> - namespace vcpkg::Json { using VK = ValueKind; @@ -154,10 +154,7 @@ namespace vcpkg::Json vcpkg::Checks::check_exit(VCPKG_LINE_INFO, is_array()); return underlying_->array; } - Array&& Value::array() && noexcept - { - return std::move(this->array()); - } + Array&& Value::array() && noexcept { return std::move(this->array()); } const Object& Value::object() const& noexcept { @@ -169,10 +166,7 @@ namespace vcpkg::Json vcpkg::Checks::check_exit(VCPKG_LINE_INFO, is_object()); return underlying_->object; } - Object&& Value::object() && noexcept - { - return std::move(this->object()); - } + Object&& Value::object() && noexcept { return std::move(this->object()); } Value::Value() noexcept = default; Value::Value(Value&&) noexcept = default; diff --git a/toolsrc/src/vcpkg/base/parse.cpp b/toolsrc/src/vcpkg/base/parse.cpp index 8e6b767d7..026b58b73 100644 --- a/toolsrc/src/vcpkg/base/parse.cpp +++ b/toolsrc/src/vcpkg/base/parse.cpp @@ -1,8 +1,8 @@ #include "pch.h" -#include <vcpkg/base/parse.h> - #include <utility> + +#include <vcpkg/base/parse.h> #include <vcpkg/base/system.print.h> #include <vcpkg/base/util.h> #include <vcpkg/packagespec.h> diff --git a/toolsrc/src/vcpkg/base/stringview.cpp b/toolsrc/src/vcpkg/base/stringview.cpp index 347982198..1528cdf45 100644 --- a/toolsrc/src/vcpkg/base/stringview.cpp +++ b/toolsrc/src/vcpkg/base/stringview.cpp @@ -1,11 +1,11 @@ #include "pch.h" +#include <cstring> + #include <vcpkg/base/checks.h> #include <vcpkg/base/lineinfo.h> #include <vcpkg/base/stringview.h> -#include <cstring> - namespace vcpkg { std::vector<StringView> StringView::find_all_enclosed(const StringView& input, @@ -71,7 +71,7 @@ namespace vcpkg return result.front(); } - StringView::StringView(const std::string& s) : m_ptr(s.data()), m_size(s.size()) {} + StringView::StringView(const std::string& s) : m_ptr(s.data()), m_size(s.size()) { } std::string StringView::to_string() const { return std::string(m_ptr, m_size); } void StringView::to_string(std::string& s) const { s.append(m_ptr, m_size); } diff --git a/toolsrc/src/vcpkg/base/system.cpp b/toolsrc/src/vcpkg/base/system.cpp index 6fdfeb6a7..d02c7ae4b 100644 --- a/toolsrc/src/vcpkg/base/system.cpp +++ b/toolsrc/src/vcpkg/base/system.cpp @@ -1,13 +1,13 @@ #include "pch.h" +#include <ctime> + #include <vcpkg/base/checks.h> #include <vcpkg/base/chrono.h> #include <vcpkg/base/system.debug.h> #include <vcpkg/base/system.h> #include <vcpkg/base/util.h> -#include <ctime> - using namespace vcpkg::System; namespace vcpkg diff --git a/toolsrc/src/vcpkg/base/system.process.cpp b/toolsrc/src/vcpkg/base/system.process.cpp index 96b4a9b4a..d709fdb60 100644 --- a/toolsrc/src/vcpkg/base/system.process.cpp +++ b/toolsrc/src/vcpkg/base/system.process.cpp @@ -1,5 +1,7 @@ #include "pch.h" +#include <ctime> + #include <vcpkg/base/checks.h> #include <vcpkg/base/chrono.h> #include <vcpkg/base/system.debug.h> @@ -7,8 +9,6 @@ #include <vcpkg/base/system.process.h> #include <vcpkg/base/util.h> -#include <ctime> - #if defined(__APPLE__) #include <mach-o/dyld.h> #endif @@ -30,7 +30,7 @@ namespace vcpkg { struct CtrlCStateMachine { - CtrlCStateMachine() : m_number_of_external_processes(0), m_global_job(NULL), m_in_interactive(0) {} + CtrlCStateMachine() : m_number_of_external_processes(0), m_global_job(NULL), m_in_interactive(0) { } void transition_to_spawn_process() noexcept { @@ -382,7 +382,7 @@ namespace vcpkg #if defined(_WIN32) struct ProcessInfo { - constexpr ProcessInfo() noexcept : proc_info{} {} + constexpr ProcessInfo() noexcept : proc_info{} { } ProcessInfo(ProcessInfo&& other) noexcept : proc_info(other.proc_info) { other.proc_info.hProcess = nullptr; @@ -724,6 +724,6 @@ namespace vcpkg SetConsoleCtrlHandler(reinterpret_cast<PHANDLER_ROUTINE>(ctrl_handler), TRUE); } #else - void System::register_console_ctrl_handler() {} + void System::register_console_ctrl_handler() { } #endif } diff --git a/toolsrc/src/vcpkg/base/uint128.cpp b/toolsrc/src/vcpkg/base/uint128.cpp index e0256075e..e5c872e45 100644 --- a/toolsrc/src/vcpkg/base/uint128.cpp +++ b/toolsrc/src/vcpkg/base/uint128.cpp @@ -1,55 +1,66 @@ +#include <limits> + #include <vcpkg/base/uint128.h> -#include <limits> +namespace vcpkg +{ + UInt128& UInt128::operator<<=(int by) noexcept + { + if (by == 0) + { + return *this; + } -namespace vcpkg { + if (by < 64) + { + top <<= by; + const auto shift_up = bottom >> (64 - by); + top |= shift_up; + bottom <<= by; + } + else + { + top = bottom; + top <<= (by - 64); + bottom = 0; + } -UInt128& UInt128::operator<<=(int by) noexcept { - if (by == 0) { return *this; } - if (by < 64) { - top <<= by; - const auto shift_up = bottom >> (64 - by); - top |= shift_up; - bottom <<= by; - } else { - top = bottom; - top <<= (by - 64); - bottom = 0; - } + UInt128& UInt128::operator>>=(int by) noexcept + { + if (by == 0) + { + return *this; + } - return *this; -} + if (by < 64) + { + bottom >>= by; + const auto shift_down = top << (64 - by); + bottom |= shift_down; + top >>= by; + } + else + { + bottom = top; + bottom >>= (by - 64); + top = 0; + } -UInt128& UInt128::operator>>=(int by) noexcept { - if (by == 0) { return *this; } - if (by < 64) { - bottom >>= by; - const auto shift_down = top << (64 - by); - bottom |= shift_down; - top >>= by; - } else { - bottom = top; - bottom >>= (by - 64); - top = 0; - } - - return *this; -} - -UInt128& UInt128::operator+=(uint64_t rhs) noexcept { - // bottom + lhs > uint64::max - if (bottom > std::numeric_limits<uint64_t>::max() - rhs) + UInt128& UInt128::operator+=(uint64_t rhs) noexcept { + // bottom + lhs > uint64::max + if (bottom > std::numeric_limits<uint64_t>::max() - rhs) + { top += 1; + } + bottom += rhs; + return *this; } - bottom += rhs; - return *this; -} } diff --git a/toolsrc/src/vcpkg/base/unicode.cpp b/toolsrc/src/vcpkg/base/unicode.cpp index 41f996cdd..149bad20f 100644 --- a/toolsrc/src/vcpkg/base/unicode.cpp +++ b/toolsrc/src/vcpkg/base/unicode.cpp @@ -1,8 +1,7 @@ #include "pch.h" -#include <vcpkg/base/unicode.h> - #include <vcpkg/base/checks.h> +#include <vcpkg/base/unicode.h> namespace vcpkg::Unicode { diff --git a/toolsrc/src/vcpkg/binarycaching.cpp b/toolsrc/src/vcpkg/binarycaching.cpp index 21ef7094a..fbff12833 100644 --- a/toolsrc/src/vcpkg/binarycaching.cpp +++ b/toolsrc/src/vcpkg/binarycaching.cpp @@ -68,7 +68,7 @@ namespace {
}
~ArchivesBinaryProvider() = default;
- void prefetch(const VcpkgPaths&, const Dependencies::ActionPlan&) override {}
+ void prefetch(const VcpkgPaths&, const Dependencies::ActionPlan&) override { }
RestoreResult try_restore(const VcpkgPaths& paths, const Dependencies::InstallPlanAction& action) override
{
const auto& abi_tag = action.abi_info.value_or_exit(VCPKG_LINE_INFO).package_abi;
@@ -522,12 +522,12 @@ namespace struct NullBinaryProvider : IBinaryProvider
{
- void prefetch(const VcpkgPaths&, const Dependencies::ActionPlan&) override {}
+ void prefetch(const VcpkgPaths&, const Dependencies::ActionPlan&) override { }
RestoreResult try_restore(const VcpkgPaths&, const Dependencies::InstallPlanAction&) override
{
return RestoreResult::missing;
}
- void push_success(const VcpkgPaths&, const Dependencies::InstallPlanAction&) override {}
+ void push_success(const VcpkgPaths&, const Dependencies::InstallPlanAction&) override { }
RestoreResult precheck(const VcpkgPaths&, const Dependencies::InstallPlanAction&) override
{
return RestoreResult::missing;
diff --git a/toolsrc/src/vcpkg/binaryparagraph.cpp b/toolsrc/src/vcpkg/binaryparagraph.cpp index 0b0819fd7..871a1ed62 100644 --- a/toolsrc/src/vcpkg/binaryparagraph.cpp +++ b/toolsrc/src/vcpkg/binaryparagraph.cpp @@ -3,7 +3,6 @@ #include <vcpkg/base/checks.h> #include <vcpkg/base/system.print.h> #include <vcpkg/base/util.h> - #include <vcpkg/binaryparagraph.h> #include <vcpkg/paragraphparser.h> #include <vcpkg/paragraphs.h> diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index 37bf8c780..8ae4531cc 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -11,7 +11,6 @@ #include <vcpkg/base/system.print.h>
#include <vcpkg/base/system.process.h>
#include <vcpkg/base/util.h>
-
#include <vcpkg/binarycaching.h>
#include <vcpkg/build.h>
#include <vcpkg/buildenvironment.h>
diff --git a/toolsrc/src/vcpkg/cmakevars.cpp b/toolsrc/src/vcpkg/cmakevars.cpp index de3b0204b..d9ce1f481 100644 --- a/toolsrc/src/vcpkg/cmakevars.cpp +++ b/toolsrc/src/vcpkg/cmakevars.cpp @@ -5,9 +5,8 @@ #include <vcpkg/base/span.h> #include <vcpkg/base/system.process.h> #include <vcpkg/base/util.h> - -#include <vcpkg/cmakevars.h> #include <vcpkg/buildenvironment.h> +#include <vcpkg/cmakevars.h> #include <vcpkg/dependencies.h> using namespace vcpkg; @@ -31,7 +30,7 @@ namespace vcpkg::CMakeVars { struct TripletCMakeVarProvider : Util::ResourceBase, CMakeVarProvider { - explicit TripletCMakeVarProvider(const vcpkg::VcpkgPaths& paths) : paths(paths) {} + explicit TripletCMakeVarProvider(const vcpkg::VcpkgPaths& paths) : paths(paths) { } void load_generic_triplet_vars(Triplet triplet) const override; diff --git a/toolsrc/src/vcpkg/commands.ci.cpp b/toolsrc/src/vcpkg/commands.ci.cpp index 8453d7af6..41bc7458e 100644 --- a/toolsrc/src/vcpkg/commands.ci.cpp +++ b/toolsrc/src/vcpkg/commands.ci.cpp @@ -14,8 +14,8 @@ #include <vcpkg/help.h> #include <vcpkg/input.h> #include <vcpkg/install.h> -#include <vcpkg/platform-expression.h> #include <vcpkg/packagespec.h> +#include <vcpkg/platform-expression.h> #include <vcpkg/vcpkglib.h> using namespace vcpkg; @@ -32,7 +32,7 @@ namespace fs::path base_path; public: - CiBuildLogsRecorder(const fs::path& base_path_) : base_path(base_path_) {} + CiBuildLogsRecorder(const fs::path& base_path_) : base_path(base_path_) { } virtual void record_build_result(const VcpkgPaths& paths, const PackageSpec& spec, diff --git a/toolsrc/src/vcpkg/commands.ciclean.cpp b/toolsrc/src/vcpkg/commands.ciclean.cpp index 74b9b35ab..33b7bf1c8 100644 --- a/toolsrc/src/vcpkg/commands.ciclean.cpp +++ b/toolsrc/src/vcpkg/commands.ciclean.cpp @@ -8,7 +8,8 @@ using namespace vcpkg;
-namespace {
+namespace
+{
void clear_directory(Files::Filesystem& fs, const fs::path& target)
{
using vcpkg::System::print2;
diff --git a/toolsrc/src/vcpkg/commands.cpp b/toolsrc/src/vcpkg/commands.cpp index be6d55304..6f17e2d7b 100644 --- a/toolsrc/src/vcpkg/commands.cpp +++ b/toolsrc/src/vcpkg/commands.cpp @@ -2,7 +2,6 @@ #include <vcpkg/base/hash.h> #include <vcpkg/base/system.print.h> - #include <vcpkg/build.h> #include <vcpkg/commands.h> #include <vcpkg/export.h> diff --git a/toolsrc/src/vcpkg/commands.dependinfo.cpp b/toolsrc/src/vcpkg/commands.dependinfo.cpp index c78c694f6..22e20c197 100644 --- a/toolsrc/src/vcpkg/commands.dependinfo.cpp +++ b/toolsrc/src/vcpkg/commands.dependinfo.cpp @@ -1,5 +1,7 @@ #include "pch.h"
+#include <vector>
+
#include <vcpkg/base/strings.h>
#include <vcpkg/base/system.print.h>
#include <vcpkg/base/util.h>
@@ -9,7 +11,6 @@ #include <vcpkg/input.h>
#include <vcpkg/install.h>
#include <vcpkg/packagespec.h>
-#include <vector>
using vcpkg::Dependencies::ActionPlan;
using vcpkg::Dependencies::InstallPlanAction;
diff --git a/toolsrc/src/vcpkg/commands.edit.cpp b/toolsrc/src/vcpkg/commands.edit.cpp index 1f00a929e..9d9dfee81 100644 --- a/toolsrc/src/vcpkg/commands.edit.cpp +++ b/toolsrc/src/vcpkg/commands.edit.cpp @@ -1,6 +1,7 @@ #include "pch.h" #include <limits.h> + #include <vcpkg/base/strings.h> #include <vcpkg/base/system.print.h> #include <vcpkg/base/system.process.h> diff --git a/toolsrc/src/vcpkg/commands.env.cpp b/toolsrc/src/vcpkg/commands.env.cpp index 8cf264d17..c6f0657c6 100644 --- a/toolsrc/src/vcpkg/commands.env.cpp +++ b/toolsrc/src/vcpkg/commands.env.cpp @@ -2,7 +2,6 @@ #include <vcpkg/base/strings.h> #include <vcpkg/base/system.process.h> - #include <vcpkg/build.h> #include <vcpkg/cmakevars.h> #include <vcpkg/commands.h> diff --git a/toolsrc/src/vcpkg/commands.format-manifest.cpp b/toolsrc/src/vcpkg/commands.format-manifest.cpp index 62e03dbcf..c1dd3b676 100644 --- a/toolsrc/src/vcpkg/commands.format-manifest.cpp +++ b/toolsrc/src/vcpkg/commands.format-manifest.cpp @@ -9,22 +9,15 @@ namespace vcpkg::Commands::FormatManifest { - static constexpr StringLiteral OPTION_ALL = "--all"; - const CommandSwitch FORMAT_SWITCHES[] = { - { OPTION_ALL, "Format all ports' manifest files." } - }; + const CommandSwitch FORMAT_SWITCHES[] = {{OPTION_ALL, "Format all ports' manifest files."}}; const CommandStructure COMMAND_STRUCTURE = { create_example_string(R"###(x-format-manifest --all)###"), 0, SIZE_MAX, - { - FORMAT_SWITCHES, - {}, - {} - }, + {FORMAT_SWITCHES, {}, {}}, nullptr, }; @@ -76,7 +69,10 @@ namespace vcpkg::Commands::FormatManifest } else { - System::printf(System::Color::error, "Failed to parse %s: %s\n", path.u8string(), parsed_json_opt.error()->format()); + System::printf(System::Color::error, + "Failed to parse %s: %s\n", + path.u8string(), + parsed_json_opt.error()->format()); has_error = true; } diff --git a/toolsrc/src/vcpkg/commands.owns.cpp b/toolsrc/src/vcpkg/commands.owns.cpp index 98d571df5..680ab292e 100644 --- a/toolsrc/src/vcpkg/commands.owns.cpp +++ b/toolsrc/src/vcpkg/commands.owns.cpp @@ -24,8 +24,7 @@ namespace vcpkg::Commands::Owns } } const CommandStructure COMMAND_STRUCTURE = { - Strings::format("The argument should be a pattern to search for. %s", - create_example_string("owns zlib.dll")), + Strings::format("The argument should be a pattern to search for. %s", create_example_string("owns zlib.dll")), 1, 1, {}, diff --git a/toolsrc/src/vcpkg/commands.porthistory.cpp b/toolsrc/src/vcpkg/commands.porthistory.cpp index 086c9d358..0f4d9716f 100644 --- a/toolsrc/src/vcpkg/commands.porthistory.cpp +++ b/toolsrc/src/vcpkg/commands.porthistory.cpp @@ -1,11 +1,10 @@ #include "pch.h" -#include <vcpkg/commands.h> -#include <vcpkg/help.h> - #include <vcpkg/base/system.print.h> #include <vcpkg/base/system.process.h> #include <vcpkg/base/util.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> namespace vcpkg::Commands::PortHistory { diff --git a/toolsrc/src/vcpkg/commands.portsdiff.cpp b/toolsrc/src/vcpkg/commands.portsdiff.cpp index 2ed05cb60..ed5044a60 100644 --- a/toolsrc/src/vcpkg/commands.portsdiff.cpp +++ b/toolsrc/src/vcpkg/commands.portsdiff.cpp @@ -1,14 +1,13 @@ #include "pch.h" -#include <vcpkg/commands.h> -#include <vcpkg/help.h> -#include <vcpkg/paragraphs.h> -#include <vcpkg/versiont.h> - #include <vcpkg/base/sortedvector.h> #include <vcpkg/base/system.print.h> #include <vcpkg/base/system.process.h> #include <vcpkg/base/util.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/versiont.h> namespace vcpkg::Commands::PortsDiff { diff --git a/toolsrc/src/vcpkg/commands.upgrade.cpp b/toolsrc/src/vcpkg/commands.upgrade.cpp index 32071259b..f3e0ca233 100644 --- a/toolsrc/src/vcpkg/commands.upgrade.cpp +++ b/toolsrc/src/vcpkg/commands.upgrade.cpp @@ -1,5 +1,7 @@ #include "pch.h" +#include <vcpkg/base/system.print.h> +#include <vcpkg/base/util.h> #include <vcpkg/binarycaching.h> #include <vcpkg/commands.h> #include <vcpkg/dependencies.h> @@ -11,9 +13,6 @@ #include <vcpkg/update.h> #include <vcpkg/vcpkglib.h> -#include <vcpkg/base/system.print.h> -#include <vcpkg/base/util.h> - namespace vcpkg::Commands::Upgrade { using Install::KeepGoing; diff --git a/toolsrc/src/vcpkg/export.cpp b/toolsrc/src/vcpkg/export.cpp index 3819584f9..73d83e3c8 100644 --- a/toolsrc/src/vcpkg/export.cpp +++ b/toolsrc/src/vcpkg/export.cpp @@ -1,5 +1,9 @@ #include "pch.h" +#include <vcpkg/base/stringliteral.h> +#include <vcpkg/base/system.print.h> +#include <vcpkg/base/system.process.h> +#include <vcpkg/base/util.h> #include <vcpkg/commands.h> #include <vcpkg/dependencies.h> #include <vcpkg/export.chocolatey.h> @@ -12,11 +16,6 @@ #include <vcpkg/paragraphs.h> #include <vcpkg/vcpkglib.h> -#include <vcpkg/base/stringliteral.h> -#include <vcpkg/base/system.print.h> -#include <vcpkg/base/system.process.h> -#include <vcpkg/base/util.h> - namespace vcpkg::Export { using Dependencies::ExportPlanAction; diff --git a/toolsrc/src/vcpkg/export.prefab.cpp b/toolsrc/src/vcpkg/export.prefab.cpp index 84a099edd..b88d57638 100644 --- a/toolsrc/src/vcpkg/export.prefab.cpp +++ b/toolsrc/src/vcpkg/export.prefab.cpp @@ -436,7 +436,8 @@ namespace vcpkg::Export::Prefab utils.create_directories(meta_dir, error_code); - const fs::path share_root = paths.packages / fs::u8path(Strings::format("%s_%s", name, action.spec.triplet())); + const fs::path share_root = + paths.packages / fs::u8path(Strings::format("%s_%s", name, action.spec.triplet())); utils.copy_file(share_root / "share" / name / "copyright", meta_dir / "LICENSE", @@ -518,7 +519,8 @@ namespace vcpkg::Export::Prefab for (const auto& triplet : triplets) { const fs::path listfile = - paths.vcpkg_dir_info / fs::u8path(Strings::format("%s_%s_%s", name, norm_version, triplet) + ".list"); + paths.vcpkg_dir_info / + fs::u8path(Strings::format("%s_%s_%s", name, norm_version, triplet) + ".list"); const fs::path installed_dir = paths.packages / fs::u8path(Strings::format("%s_%s", name, triplet)); Checks::check_exit(VCPKG_LINE_INFO, utils.exists(listfile), @@ -704,10 +706,9 @@ namespace vcpkg::Export::Prefab )"); } } - System::print2(System::Color::success, - Strings::format("Successfuly exported %s. Checkout %s \n", - name, - paths.prefab.generic_u8string())); + System::print2( + System::Color::success, + Strings::format("Successfuly exported %s. Checkout %s \n", name, paths.prefab.generic_u8string())); } } } diff --git a/toolsrc/src/vcpkg/help.cpp b/toolsrc/src/vcpkg/help.cpp index 46fac622b..f90185266 100644 --- a/toolsrc/src/vcpkg/help.cpp +++ b/toolsrc/src/vcpkg/help.cpp @@ -14,7 +14,7 @@ namespace vcpkg::Help { using topic_function = void (*)(const VcpkgPaths& paths); - constexpr Topic(CStringView n, topic_function fn) : name(n), print(fn) {} + constexpr Topic(CStringView n, topic_function fn) : name(n), print(fn) { } CStringView name; topic_function print; diff --git a/toolsrc/src/vcpkg/install.cpp b/toolsrc/src/vcpkg/install.cpp index 842a7a7fa..b5024e0a5 100644 --- a/toolsrc/src/vcpkg/install.cpp +++ b/toolsrc/src/vcpkg/install.cpp @@ -434,7 +434,9 @@ namespace vcpkg::Install SpecSummary* current_summary = nullptr; Chrono::ElapsedTimer build_timer = Chrono::ElapsedTimer::create_started(); - TrackedPackageInstallGuard(const size_t package_count, std::vector<SpecSummary>& results, const PackageSpec& spec) + TrackedPackageInstallGuard(const size_t package_count, + std::vector<SpecSummary>& results, + const PackageSpec& spec) { results.emplace_back(spec, nullptr); current_summary = &results.back(); diff --git a/toolsrc/src/vcpkg/metrics.cpp b/toolsrc/src/vcpkg/metrics.cpp index 7920cd7a5..d1f8f6fe8 100644 --- a/toolsrc/src/vcpkg/metrics.cpp +++ b/toolsrc/src/vcpkg/metrics.cpp @@ -1,14 +1,13 @@ #include "pch.h" -#include <vcpkg/commands.h> -#include <vcpkg/metrics.h> - #include <vcpkg/base/chrono.h> #include <vcpkg/base/files.h> #include <vcpkg/base/hash.h> #include <vcpkg/base/json.h> #include <vcpkg/base/strings.h> #include <vcpkg/base/system.process.h> +#include <vcpkg/commands.h> +#include <vcpkg/metrics.h> #if defined(_WIN32) #pragma comment(lib, "version") @@ -30,9 +29,11 @@ namespace vcpkg::Metrics return ""; } - struct append_hexits { + struct append_hexits + { constexpr static char hex[17] = "0123456789abcdef"; - void operator()(std::string& res, std::uint8_t bits) const { + void operator()(std::string& res, std::uint8_t bits) const + { res.push_back(hex[(bits >> 4) & 0x0F]); res.push_back(hex[(bits >> 0) & 0x0F]); } diff --git a/toolsrc/src/vcpkg/packagespec.cpp b/toolsrc/src/vcpkg/packagespec.cpp index f82806879..99b6a79d6 100644 --- a/toolsrc/src/vcpkg/packagespec.cpp +++ b/toolsrc/src/vcpkg/packagespec.cpp @@ -244,7 +244,8 @@ namespace vcpkg return nullopt; } platform_string.append((++loc.it).pointer_to_current(), parser.it().pointer_to_current()); - auto platform_opt = PlatformExpression::parse_platform_expression(platform_string, PlatformExpression::MultipleBinaryOperators::Allow); + auto platform_opt = PlatformExpression::parse_platform_expression( + platform_string, PlatformExpression::MultipleBinaryOperators::Allow); if (auto platform = platform_opt.get()) { ret.platform = std::move(*platform); diff --git a/toolsrc/src/vcpkg/paragraphs.cpp b/toolsrc/src/vcpkg/paragraphs.cpp index 458950eea..94a5a8442 100644 --- a/toolsrc/src/vcpkg/paragraphs.cpp +++ b/toolsrc/src/vcpkg/paragraphs.cpp @@ -133,7 +133,10 @@ namespace vcpkg::Paragraphs return fs.exists(path / fs::u8path("CONTROL")) || fs.exists(path / fs::u8path("vcpkg.json")); } - ParseExpected<SourceControlFile> try_load_manifest(const Files::Filesystem& fs, const std::string& port_name, const fs::path& path_to_manifest, std::error_code& ec) + ParseExpected<SourceControlFile> try_load_manifest(const Files::Filesystem& fs, + const std::string& port_name, + const fs::path& path_to_manifest, + std::error_code& ec) { auto error_info = std::make_unique<ParseControlErrorInfo>(); auto res = Json::parse_file(fs, path_to_manifest, ec); @@ -164,12 +167,12 @@ namespace vcpkg::Paragraphs { const auto path_to_manifest = path / fs::u8path("vcpkg.json"); const auto path_to_control = path / fs::u8path("CONTROL"); - if (fs.exists(path_to_manifest)) { - vcpkg::Checks::check_exit( - VCPKG_LINE_INFO, - !fs.exists(path_to_control), - "Found both manifest and CONTROL file in port %s; please rename one or the other", - path.u8string()); + if (fs.exists(path_to_manifest)) + { + vcpkg::Checks::check_exit(VCPKG_LINE_INFO, + !fs.exists(path_to_control), + "Found both manifest and CONTROL file in port %s; please rename one or the other", + path.u8string()); std::error_code ec; auto res = try_load_manifest(fs, path.filename().u8string(), path_to_manifest, ec); @@ -177,7 +180,8 @@ namespace vcpkg::Paragraphs { auto error_info = std::make_unique<ParseControlErrorInfo>(); error_info->name = path.filename().u8string(); - error_info->error = Strings::format("Failed to load manifest file for port: %s\n", path_to_manifest.u8string(), ec.message()); + error_info->error = Strings::format( + "Failed to load manifest file for port: %s\n", path_to_manifest.u8string(), ec.message()); } return res; diff --git a/toolsrc/src/vcpkg/platform-expression.cpp b/toolsrc/src/vcpkg/platform-expression.cpp index 9b83372e1..bbc0a253e 100644 --- a/toolsrc/src/vcpkg/platform-expression.cpp +++ b/toolsrc/src/vcpkg/platform-expression.cpp @@ -1,14 +1,14 @@ #include "pch.h" +#include <string> +#include <vector> + #include <vcpkg/base/parse.h> #include <vcpkg/base/strings.h> #include <vcpkg/base/system.print.h> #include <vcpkg/base/util.h> #include <vcpkg/platform-expression.h> -#include <string> -#include <vector> - namespace vcpkg::PlatformExpression { using vcpkg::Parse::ParseError; @@ -76,9 +76,9 @@ namespace vcpkg::PlatformExpression { } - ExprImpl(ExprKind k, std::string i) : kind(k), identifier(std::move(i)) {} + ExprImpl(ExprKind k, std::string i) : kind(k), identifier(std::move(i)) { } ExprImpl(ExprKind k, std::unique_ptr<ExprImpl> a) : kind(k) { exprs.push_back(std::move(a)); } - ExprImpl(ExprKind k, std::vector<std::unique_ptr<ExprImpl>> es) : kind(k), exprs(std::move(es)) {} + ExprImpl(ExprKind k, std::vector<std::unique_ptr<ExprImpl>> es) : kind(k), exprs(std::move(es)) { } ExprKind kind; std::string identifier; @@ -258,7 +258,7 @@ namespace vcpkg::PlatformExpression return *this; } - Expr::Expr(std::unique_ptr<ExprImpl>&& e) : underlying_(std::move(e)) {} + Expr::Expr(std::unique_ptr<ExprImpl>&& e) : underlying_(std::move(e)) { } Expr::~Expr() = default; Expr Expr::Identifier(StringView id) diff --git a/toolsrc/src/vcpkg/postbuildlint.cpp b/toolsrc/src/vcpkg/postbuildlint.cpp index a50736e9b..30b9d0224 100644 --- a/toolsrc/src/vcpkg/postbuildlint.cpp +++ b/toolsrc/src/vcpkg/postbuildlint.cpp @@ -347,13 +347,14 @@ namespace vcpkg::PostBuildLint // if there is only one candidate, provide the cmake lines needed to place it in the proper location const fs::path found_file = potential_copyright_files[0]; auto found_relative_native = found_file.native(); - found_relative_native.erase(current_buildtrees_dir.native().size() + 1); // The +1 is needed to remove the "/" + found_relative_native.erase(current_buildtrees_dir.native().size() + + 1); // The +1 is needed to remove the "/" const fs::path relative_path = found_relative_native; - System::printf( - "\n configure_file(\"${CURRENT_BUILDTREES_DIR}/%s/%s\" \"${CURRENT_PACKAGES_DIR}/share/%s/copyright\" COPYONLY)\n", - relative_path.generic_string(), - found_file.filename().generic_string(), - spec.name()); + System::printf("\n configure_file(\"${CURRENT_BUILDTREES_DIR}/%s/%s\" " + "\"${CURRENT_PACKAGES_DIR}/share/%s/copyright\" COPYONLY)\n", + relative_path.generic_string(), + found_file.filename().generic_string(), + spec.name()); } else if (potential_copyright_files.size() > 1) { diff --git a/toolsrc/src/vcpkg/remove.cpp b/toolsrc/src/vcpkg/remove.cpp index 23f9d0097..7afa81c7c 100644 --- a/toolsrc/src/vcpkg/remove.cpp +++ b/toolsrc/src/vcpkg/remove.cpp @@ -217,7 +217,9 @@ namespace vcpkg::Remove { if (paths.manifest_mode_enabled()) { - Checks::exit_with_message(VCPKG_LINE_INFO, "vcpkg remove does not support manifest mode. In order to remove dependencies, you will need to edit your manifest (vcpkg.json)."); + Checks::exit_with_message(VCPKG_LINE_INFO, + "vcpkg remove does not support manifest mode. In order to remove dependencies, " + "you will need to edit your manifest (vcpkg.json)."); } const ParsedArguments options = args.parse_arguments(COMMAND_STRUCTURE); diff --git a/toolsrc/src/vcpkg/sourceparagraph.cpp b/toolsrc/src/vcpkg/sourceparagraph.cpp index 467a1236a..f887456d8 100644 --- a/toolsrc/src/vcpkg/sourceparagraph.cpp +++ b/toolsrc/src/vcpkg/sourceparagraph.cpp @@ -1,16 +1,15 @@ #include "pch.h" -#include <vcpkg/platform-expression.h> -#include <vcpkg/packagespec.h> -#include <vcpkg/sourceparagraph.h> -#include <vcpkg/triplet.h> - #include <vcpkg/base/checks.h> #include <vcpkg/base/expected.h> #include <vcpkg/base/span.h> #include <vcpkg/base/system.debug.h> #include <vcpkg/base/system.print.h> #include <vcpkg/base/util.h> +#include <vcpkg/packagespec.h> +#include <vcpkg/platform-expression.h> +#include <vcpkg/sourceparagraph.h> +#include <vcpkg/triplet.h> namespace vcpkg { @@ -186,14 +185,8 @@ namespace vcpkg return Type{Type::UNKNOWN}; } - bool operator==(const Type& lhs, const Type& rhs) - { - return lhs.type == rhs.type; - } - bool operator!=(const Type& lhs, const Type& rhs) - { - return !(lhs == rhs); - } + bool operator==(const Type& lhs, const Type& rhs) { return lhs.type == rhs.type; } + bool operator!=(const Type& lhs, const Type& rhs) { return !(lhs == rhs); } static void trim_all(std::vector<std::string>& arr) { @@ -246,7 +239,8 @@ namespace vcpkg auto supports_expr = parser.optional_field(SourceParagraphFields::SUPPORTS); if (!supports_expr.empty()) { - auto maybe_expr = PlatformExpression::parse_platform_expression(supports_expr, PlatformExpression::MultipleBinaryOperators::Allow); + auto maybe_expr = PlatformExpression::parse_platform_expression( + supports_expr, PlatformExpression::MultipleBinaryOperators::Allow); if (auto expr = maybe_expr.get()) { spgh->supports_expression = std::move(*expr); @@ -377,7 +371,10 @@ namespace vcpkg StringView type_name() { return type_name_; } - ArrayField(StringView type_name_, AllowEmpty allow_empty, T&& t = {}) : type_name_(type_name_), underlying_visitor_(static_cast<T&&>(t)), allow_empty_(allow_empty) { } + ArrayField(StringView type_name_, AllowEmpty allow_empty, T&& t = {}) + : type_name_(type_name_), underlying_visitor_(static_cast<T&&>(t)), allow_empty_(allow_empty) + { + } Optional<type> visit_array(Json::Reader& r, StringView key, const Json::Array& arr) { @@ -634,7 +631,8 @@ namespace vcpkg Optional<PlatformExpression::Expr> visit_string(Json::Reader&, StringView, StringView sv) { - auto opt = PlatformExpression::parse_platform_expression(sv, PlatformExpression::MultipleBinaryOperators::Deny); + auto opt = + PlatformExpression::parse_platform_expression(sv, PlatformExpression::MultipleBinaryOperators::Deny); if (auto res = opt.get()) { return std::move(*res); diff --git a/toolsrc/src/vcpkg/tools.cpp b/toolsrc/src/vcpkg/tools.cpp index 0407cc60b..f27870004 100644 --- a/toolsrc/src/vcpkg/tools.cpp +++ b/toolsrc/src/vcpkg/tools.cpp @@ -1,9 +1,6 @@ #include "pch.h" #include <vcpkg/archives.h> -#include <vcpkg/tools.h> -#include <vcpkg/vcpkgpaths.h> - #include <vcpkg/base/checks.h> #include <vcpkg/base/downloads.h> #include <vcpkg/base/files.h> @@ -13,6 +10,8 @@ #include <vcpkg/base/system.print.h> #include <vcpkg/base/system.process.h> #include <vcpkg/base/util.h> +#include <vcpkg/tools.h> +#include <vcpkg/vcpkgpaths.h> namespace vcpkg { diff --git a/toolsrc/src/vcpkg/userconfig.cpp b/toolsrc/src/vcpkg/userconfig.cpp index 5d2dfa26c..1bf2b047b 100644 --- a/toolsrc/src/vcpkg/userconfig.cpp +++ b/toolsrc/src/vcpkg/userconfig.cpp @@ -2,9 +2,9 @@ #include <vcpkg/base/files.h> #include <vcpkg/base/lazy.h> +#include <vcpkg/base/system.h> #include <vcpkg/paragraphs.h> #include <vcpkg/userconfig.h> -#include <vcpkg/base/system.h> namespace vcpkg { diff --git a/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp b/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp index 934b375a3..75632541d 100644 --- a/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp +++ b/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp @@ -1,7 +1,7 @@ #include "pch.h" -#include <vcpkg/base/system.print.h> #include <vcpkg/base/system.debug.h> +#include <vcpkg/base/system.print.h> #include <vcpkg/commands.h> #include <vcpkg/globalstate.h> #include <vcpkg/metrics.h> diff --git a/toolsrc/src/vcpkg/vcpkgpaths.cpp b/toolsrc/src/vcpkg/vcpkgpaths.cpp index 30f7367bf..a957cb27c 100644 --- a/toolsrc/src/vcpkg/vcpkgpaths.cpp +++ b/toolsrc/src/vcpkg/vcpkgpaths.cpp @@ -2,10 +2,9 @@ #include <vcpkg/base/expected.h> #include <vcpkg/base/files.h> -#include <vcpkg/base/system.process.h> -#include <vcpkg/base/util.h> #include <vcpkg/base/system.debug.h> #include <vcpkg/base/system.process.h> +#include <vcpkg/base/util.h> #include <vcpkg/build.h> #include <vcpkg/commands.h> #include <vcpkg/globalstate.h> diff --git a/toolsrc/src/vcpkg/versiont.cpp b/toolsrc/src/vcpkg/versiont.cpp index 2c025fa1d..209a473c6 100644 --- a/toolsrc/src/vcpkg/versiont.cpp +++ b/toolsrc/src/vcpkg/versiont.cpp @@ -5,15 +5,15 @@ namespace vcpkg { - VersionT::VersionT() noexcept : value("0.0.0") {} - VersionT::VersionT(std::string&& value) : value(std::move(value)) {} - VersionT::VersionT(const std::string& value) : value(value) {} + VersionT::VersionT() noexcept : value("0.0.0") { } + VersionT::VersionT(std::string&& value) : value(std::move(value)) { } + VersionT::VersionT(const std::string& value) : value(value) { } const std::string& VersionT::to_string() const { return value; } bool operator==(const VersionT& left, const VersionT& right) { return left.to_string() == right.to_string(); } bool operator!=(const VersionT& left, const VersionT& right) { return left.to_string() != right.to_string(); } - VersionDiff::VersionDiff() noexcept : left(), right() {} - VersionDiff::VersionDiff(const VersionT& left, const VersionT& right) : left(left), right(right) {} + VersionDiff::VersionDiff() noexcept : left(), right() { } + VersionDiff::VersionDiff(const VersionT& left, const VersionT& right) : left(left), right(right) { } std::string VersionDiff::to_string() const { diff --git a/toolsrc/src/vcpkgmetricsuploader.cpp b/toolsrc/src/vcpkgmetricsuploader.cpp index 95195b3be..a773f1aee 100644 --- a/toolsrc/src/vcpkgmetricsuploader.cpp +++ b/toolsrc/src/vcpkgmetricsuploader.cpp @@ -1,10 +1,10 @@ -#include <vcpkg/metrics.h> +#include <vcpkg/base/system_headers.h> + +#include <shellapi.h> #include <vcpkg/base/checks.h> #include <vcpkg/base/files.h> - -#include <vcpkg/base/system_headers.h> -#include <shellapi.h> +#include <vcpkg/metrics.h> using namespace vcpkg; |
