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 | |
| 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
119 files changed, 618 insertions, 497 deletions
diff --git a/scripts/azure-pipelines/windows/azure-pipelines.yml b/scripts/azure-pipelines/windows/azure-pipelines.yml index a76b6afdf..1d18c0339 100644 --- a/scripts/azure-pipelines/windows/azure-pipelines.yml +++ b/scripts/azure-pipelines/windows/azure-pipelines.yml @@ -20,6 +20,12 @@ jobs: condition: always()
inputs:
filePath: 'scripts/azure-pipelines/windows/disk-space.ps1'
+ - task: Powershell@2
+ displayName: 'Check C++ Formatting'
+ condition: eq('${{ parameters.triplet }}', 'x86-windows')
+ inputs:
+ filePath: 'scripts/azure-pipelines/windows/check-formatting.ps1'
+ arguments: '-Toolsrc ./toolsrc'
# Note: D: is the Azure machines' temporary disk.
- task: CmdLine@2
displayName: 'Build vcpkg'
diff --git a/scripts/azure-pipelines/windows/check-formatting.ps1 b/scripts/azure-pipelines/windows/check-formatting.ps1 new file mode 100644 index 000000000..e3c3d213e --- /dev/null +++ b/scripts/azure-pipelines/windows/check-formatting.ps1 @@ -0,0 +1,54 @@ +[CmdletBinding()] +Param( + [Parameter(Mandatory=$True)] + [string]$Toolsrc, + [Parameter()] + [switch]$IgnoreErrors # allows one to just format +) + +$clangFormat = 'C:\Program Files\LLVM\bin\clang-format.exe' +if (-not (Test-Path $clangFormat)) +{ + Write-Error "clang-format not found; is it installed in the CI machines?" + throw +} + +$Toolsrc = Get-Item $Toolsrc +Push-Location $Toolsrc + +try +{ + $files = Get-ChildItem -Recurse -LiteralPath "$Toolsrc/src" -Filter '*.cpp' + $files += Get-ChildItem -Recurse -LiteralPath "$Toolsrc/include/vcpkg" -Filter '*.h' + $files += Get-ChildItem -Recurse -LiteralPath "$Toolsrc/include/vcpkg-test" -Filter '*.h' + $files += Get-Item "$Toolsrc/include/pch.h" + $fileNames = $files.FullName + + & $clangFormat -style=file -i @fileNames + + $changedFiles = git status --porcelain $Toolsrc | ForEach-Object { + (-split $_)[1] + } + + if (-not $IgnoreErrors -and $null -ne $changedFiles) + { + $msg = @( + "", + "The formatting of the C++ files didn't match our expectation.", + "If your build fails here, you need to format the following files with:" + ) + $msg += " $(& $clangFormat -version)" + $msg += " $changedFiles" + $msg += "" + + $msg += "clang-format should produce the following diff:" + $msg += git diff $Toolsrc + + Write-Error ($msg -join "`n") + throw + } +} +finally +{ + Pop-Location +} diff --git a/scripts/azure-pipelines/windows/provision-image.txt b/scripts/azure-pipelines/windows/provision-image.txt index 2d2790ec7..798b96e9a 100644 --- a/scripts/azure-pipelines/windows/provision-image.txt +++ b/scripts/azure-pipelines/windows/provision-image.txt @@ -393,6 +393,30 @@ Function InstallLLVM { <#
.SYNOPSIS
+Installs LLVM.
+
+.DESCRIPTION
+InstallLLVM installs LLVM from the supplied URL.
+
+.PARAMETER Url
+The URL of the LLVM installer.
+#>
+Function InstallLLVM {
+ try {
+ Write-Host 'Downloading LLVM...'
+ [string]$installerPath = Get-TempFilePath -Extension 'exe'
+ curl.exe -L -o $installerPath -s -S $Url
+ Write-Host 'Installing LLVM...'
+ $proc = Start-Process -FilePath $installerPath -ArgumentList @('/S') -NoNewWindow -Wait -PassThru
+ PrintMsiExitCodeMessage $proc.ExitCode
+ }
+ catch {
+ Write-Error "Failed to install LLVM! $($_.Exception.Message)"
+ }
+}
+
+<#
+.SYNOPSIS
Installs MPI
.DESCRIPTION
diff --git a/toolsrc/.clang-format b/toolsrc/.clang-format index d19c4472a..4b2e83422 100644 --- a/toolsrc/.clang-format +++ b/toolsrc/.clang-format @@ -1,4 +1,3 @@ ---- BasedOnStyle: WebKit Language: Cpp Standard: Cpp11 @@ -32,6 +31,19 @@ ForEachMacros: [TEST_CASE, SECTION] PenaltyReturnTypeOnItsOwnLine: 1000 SpaceAfterTemplateKeyword: false SpaceBeforeCpp11BracedList: false +UseCRLF: false -IncludeBlocks: Preserve -SortIncludes: false +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^(<vcpkg/base/system_headers\.h>|"pch\.h")$' + Priority: -1 + - Regex: '^<catch2/catch\.hpp>$' + Priority: 1 + - Regex: '^<vcpkg/base/*\.h>$' + Priority: 2 + - Regex: '^<vcpkg/*\.h>$' + Priority: 3 + - Regex: '^<[a-z0-9_]*\.h>$' + Priority: 4 + - Regex: '^<[a-z0-9_]*>$' # C++ standard library + Priority: 5 diff --git a/toolsrc/include/pch.h b/toolsrc/include/pch.h index 46ba6fa37..f92792411 100644 --- a/toolsrc/include/pch.h +++ b/toolsrc/include/pch.h @@ -1,8 +1,9 @@ #pragma once -#include <vcpkg/base/pragmas.h> #include <vcpkg/base/system_headers.h> +#include <vcpkg/base/pragmas.h> + #if defined(_WIN32) #include <process.h> #include <shellapi.h> @@ -49,9 +50,10 @@ #include <sys/time.h> #endif +#include <time.h> + #include <system_error> #include <thread> -#include <time.h> #include <type_traits> #include <unordered_map> #include <unordered_set> diff --git a/toolsrc/include/vcpkg-test/util.h b/toolsrc/include/vcpkg-test/util.h index 9321f3fd2..f7d2f2a50 100644 --- a/toolsrc/include/vcpkg-test/util.h +++ b/toolsrc/include/vcpkg-test/util.h @@ -1,13 +1,13 @@ #include <vcpkg/base/system_headers.h> #include <catch2/catch.hpp> -#include <vcpkg/base/pragmas.h> + +#include <memory> #include <vcpkg/base/files.h> +#include <vcpkg/base/pragmas.h> #include <vcpkg/statusparagraph.h> -#include <memory> - #define CHECK_EC(ec) \ do \ { \ @@ -54,7 +54,7 @@ namespace vcpkg::Test { std::unordered_map<std::string, SourceControlFileLocation> map; Triplet triplet; - PackageSpecMap(Triplet t = Triplet::X86_WINDOWS) noexcept : triplet(t) {} + PackageSpecMap(Triplet t = Triplet::X86_WINDOWS) noexcept : triplet(t) { } PackageSpec emplace(const char* name, const char* depends = "", @@ -86,9 +86,9 @@ namespace vcpkg::Test Yes = true, } tag; - constexpr AllowSymlinks(Tag tag) noexcept : tag(tag) {} + constexpr AllowSymlinks(Tag tag) noexcept : tag(tag) { } - constexpr explicit AllowSymlinks(bool b) noexcept : tag(b ? Yes : No) {} + constexpr explicit AllowSymlinks(bool b) noexcept : tag(b ? Yes : No) { } constexpr operator bool() const noexcept { return tag == Yes; } }; diff --git a/toolsrc/include/vcpkg/base/chrono.h b/toolsrc/include/vcpkg/base/chrono.h index 118e9c382..b2865476a 100644 --- a/toolsrc/include/vcpkg/base/chrono.h +++ b/toolsrc/include/vcpkg/base/chrono.h @@ -1,11 +1,11 @@ #pragma once -#include <vcpkg/base/cstringview.h> -#include <vcpkg/base/optional.h> - #include <chrono> #include <string> +#include <vcpkg/base/cstringview.h> +#include <vcpkg/base/optional.h> + namespace vcpkg::Chrono { class ElapsedTime @@ -13,8 +13,8 @@ namespace vcpkg::Chrono using duration = std::chrono::high_resolution_clock::time_point::duration; public: - constexpr ElapsedTime() noexcept : m_duration() {} - constexpr ElapsedTime(duration d) noexcept : m_duration(d) {} + constexpr ElapsedTime() noexcept : m_duration() { } + constexpr ElapsedTime(duration d) noexcept : m_duration(d) { } template<class TimeUnit> TimeUnit as() const @@ -34,7 +34,7 @@ namespace vcpkg::Chrono public: static ElapsedTimer create_started(); - constexpr ElapsedTimer() noexcept : m_start_tick() {} + constexpr ElapsedTimer() noexcept : m_start_tick() { } ElapsedTime elapsed() const { @@ -56,8 +56,8 @@ namespace vcpkg::Chrono static Optional<CTime> get_current_date_time(); static Optional<CTime> parse(CStringView str); - constexpr CTime() noexcept : m_tm{} {} - explicit constexpr CTime(tm t) noexcept : m_tm{t} {} + constexpr CTime() noexcept : m_tm{} { } + explicit constexpr CTime(tm t) noexcept : m_tm{t} { } CTime add_hours(const int hours) const; diff --git a/toolsrc/include/vcpkg/base/cofffilereader.h b/toolsrc/include/vcpkg/base/cofffilereader.h index e0ad69b33..a135ba028 100644 --- a/toolsrc/include/vcpkg/base/cofffilereader.h +++ b/toolsrc/include/vcpkg/base/cofffilereader.h @@ -1,10 +1,10 @@ #pragma once +#include <vector> + #include <vcpkg/base/files.h> #include <vcpkg/base/machinetype.h> -#include <vector> - namespace vcpkg::CoffFileReader { struct DllInfo diff --git a/toolsrc/include/vcpkg/base/cstringview.h b/toolsrc/include/vcpkg/base/cstringview.h index d49bfc82f..7d46ecf2e 100644 --- a/toolsrc/include/vcpkg/base/cstringview.h +++ b/toolsrc/include/vcpkg/base/cstringview.h @@ -7,10 +7,10 @@ namespace vcpkg { struct CStringView { - constexpr CStringView() noexcept : cstr(nullptr) {} - constexpr CStringView(const char* cstr) : cstr(cstr) {} + constexpr CStringView() noexcept : cstr(nullptr) { } + constexpr CStringView(const char* cstr) : cstr(cstr) { } constexpr CStringView(const CStringView&) = default; - CStringView(const std::string& str) : cstr(str.c_str()) {} + CStringView(const std::string& str) : cstr(str.c_str()) { } constexpr const char* c_str() const { return cstr; } diff --git a/toolsrc/include/vcpkg/base/enums.h b/toolsrc/include/vcpkg/base/enums.h index 6eca2cfe1..77ca7194f 100644 --- a/toolsrc/include/vcpkg/base/enums.h +++ b/toolsrc/include/vcpkg/base/enums.h @@ -1,9 +1,9 @@ #pragma once -#include <vcpkg/base/lineinfo.h> - #include <string> +#include <vcpkg/base/lineinfo.h> + namespace vcpkg::Enums { std::string nullvalue_to_string(const CStringView enum_name); diff --git a/toolsrc/include/vcpkg/base/expected.h b/toolsrc/include/vcpkg/base/expected.h index 40f5af40f..6381f1e89 100644 --- a/toolsrc/include/vcpkg/base/expected.h +++ b/toolsrc/include/vcpkg/base/expected.h @@ -1,16 +1,16 @@ #pragma once +#include <system_error> + #include <vcpkg/base/checks.h> #include <vcpkg/base/stringliteral.h> -#include <system_error> - namespace vcpkg { template<class Err> struct ErrorHolder { - ErrorHolder() : m_is_error(false), m_err{} {} + ErrorHolder() : m_is_error(false), m_err{} { } template<class U> ErrorHolder(U&& err) : m_is_error(true), m_err(std::forward<U>(err)) { diff --git a/toolsrc/include/vcpkg/base/graphs.h b/toolsrc/include/vcpkg/base/graphs.h index f368a872d..957af0fba 100644 --- a/toolsrc/include/vcpkg/base/graphs.h +++ b/toolsrc/include/vcpkg/base/graphs.h @@ -34,7 +34,7 @@ namespace vcpkg::Graphs virtual int random(int max_exclusive) = 0; protected: - ~Randomizer() {} + ~Randomizer() { } }; namespace details diff --git a/toolsrc/include/vcpkg/base/hash.h b/toolsrc/include/vcpkg/base/hash.h index d62fd3921..2878807d4 100644 --- a/toolsrc/include/vcpkg/base/hash.h +++ b/toolsrc/include/vcpkg/base/hash.h @@ -1,9 +1,9 @@ #pragma once -#include <vcpkg/base/files.h> - #include <string> +#include <vcpkg/base/files.h> + namespace vcpkg::Hash { enum class Algorithm diff --git a/toolsrc/include/vcpkg/base/json.h b/toolsrc/include/vcpkg/base/json.h index ecb96cde1..97c8be91f 100644 --- a/toolsrc/include/vcpkg/base/json.h +++ b/toolsrc/include/vcpkg/base/json.h @@ -1,17 +1,18 @@ #pragma once -#include <vcpkg/base/expected.h> -#include <vcpkg/base/files.h> -#include <vcpkg/base/parse.h> -#include <vcpkg/base/stringview.h> - #include <stddef.h> #include <stdint.h> + #include <memory> #include <string> #include <utility> #include <vector> +#include <vcpkg/base/expected.h> +#include <vcpkg/base/files.h> +#include <vcpkg/base/parse.h> +#include <vcpkg/base/stringview.h> + namespace vcpkg::Json { struct JsonStyle diff --git a/toolsrc/include/vcpkg/base/lazy.h b/toolsrc/include/vcpkg/base/lazy.h index 58c11c002..d0afdaeb2 100644 --- a/toolsrc/include/vcpkg/base/lazy.h +++ b/toolsrc/include/vcpkg/base/lazy.h @@ -6,7 +6,7 @@ namespace vcpkg class Lazy { public: - Lazy() : value(T()), initialized(false) {} + Lazy() : value(T()), initialized(false) { } template<class F> T const& get_lazy(const F& f) const diff --git a/toolsrc/include/vcpkg/base/lineinfo.h b/toolsrc/include/vcpkg/base/lineinfo.h index 2f03fef16..b90b6fac3 100644 --- a/toolsrc/include/vcpkg/base/lineinfo.h +++ b/toolsrc/include/vcpkg/base/lineinfo.h @@ -6,8 +6,8 @@ namespace vcpkg { struct LineInfo { - constexpr LineInfo() noexcept : m_line_number(0), m_file_name("") {} - constexpr LineInfo(const int lineno, const char* filename) : m_line_number(lineno), m_file_name(filename) {} + constexpr LineInfo() noexcept : m_line_number(0), m_file_name("") { } + constexpr LineInfo(const int lineno, const char* filename) : m_line_number(lineno), m_file_name(filename) { } std::string to_string() const; void to_string(std::string& out) const; diff --git a/toolsrc/include/vcpkg/base/optional.h b/toolsrc/include/vcpkg/base/optional.h index 0d77f4b03..842f72f95 100644 --- a/toolsrc/include/vcpkg/base/optional.h +++ b/toolsrc/include/vcpkg/base/optional.h @@ -1,17 +1,16 @@ #pragma once -#include <vcpkg/base/pragmas.h> - -#include <vcpkg/base/lineinfo.h> - #include <type_traits> #include <utility> +#include <vcpkg/base/lineinfo.h> +#include <vcpkg/base/pragmas.h> + namespace vcpkg { struct NullOpt { - explicit constexpr NullOpt(int) {} + explicit constexpr NullOpt(int) { } }; const static constexpr NullOpt nullopt{0}; @@ -22,9 +21,9 @@ namespace vcpkg struct OptionalStorage { 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)) {} + 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)) { } ~OptionalStorage() noexcept { @@ -96,7 +95,8 @@ namespace vcpkg } bool m_is_present; - union { + union + { char m_inactive; T m_t; }; @@ -106,8 +106,8 @@ namespace vcpkg struct OptionalStorage<T, false> { 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)) {} + constexpr OptionalStorage() noexcept : m_is_present(false), m_inactive() { } + constexpr OptionalStorage(T&& t) : m_is_present(true), m_t(std::move(t)) { } ~OptionalStorage() noexcept { @@ -155,7 +155,8 @@ namespace vcpkg } bool m_is_present; - union { + union + { char m_inactive; T m_t; }; @@ -164,8 +165,8 @@ namespace vcpkg template<class T, bool B> struct OptionalStorage<T&, B> { - constexpr OptionalStorage() noexcept : m_t(nullptr) {} - constexpr OptionalStorage(T& t) : m_t(&t) {} + constexpr OptionalStorage() noexcept : m_t(nullptr) { } + constexpr OptionalStorage(T& t) : m_t(&t) { } constexpr bool has_value() const { return m_t != nullptr; } @@ -182,10 +183,10 @@ namespace vcpkg template<class T> struct Optional { - constexpr Optional() noexcept {} + constexpr Optional() noexcept { } // Constructors are intentionally implicit - constexpr Optional(NullOpt) {} + constexpr Optional(NullOpt) { } template<class U, class = std::enable_if_t<!std::is_same<std::decay_t<U>, Optional>::value>> constexpr Optional(U&& t) : m_base(std::forward<U>(t)) diff --git a/toolsrc/include/vcpkg/base/parse.h b/toolsrc/include/vcpkg/base/parse.h index c5044865e..d63cf1ced 100644 --- a/toolsrc/include/vcpkg/base/parse.h +++ b/toolsrc/include/vcpkg/base/parse.h @@ -1,14 +1,14 @@ #pragma once +#include <memory> +#include <string> + #include <vcpkg/base/cstringview.h> #include <vcpkg/base/optional.h> #include <vcpkg/base/stringview.h> #include <vcpkg/base/unicode.h> #include <vcpkg/textrowcol.h> -#include <memory> -#include <string> - namespace vcpkg::Parse { struct IParseError diff --git a/toolsrc/include/vcpkg/base/sortedvector.h b/toolsrc/include/vcpkg/base/sortedvector.h index fbb7e5a5a..33379676e 100644 --- a/toolsrc/include/vcpkg/base/sortedvector.h +++ b/toolsrc/include/vcpkg/base/sortedvector.h @@ -13,7 +13,7 @@ namespace vcpkg using size_type = typename std::vector<T>::size_type; using iterator = typename std::vector<T>::const_iterator; - SortedVector() : m_data() {} + SortedVector() : m_data() { } explicit SortedVector(std::vector<T> v) : m_data(std::move(v)) { diff --git a/toolsrc/include/vcpkg/base/span.h b/toolsrc/include/vcpkg/base/span.h index a5ba884af..482fe1b00 100644 --- a/toolsrc/include/vcpkg/base/span.h +++ b/toolsrc/include/vcpkg/base/span.h @@ -19,10 +19,10 @@ namespace vcpkg using reference = std::add_lvalue_reference_t<T>;
using iterator = pointer;
- constexpr Span() noexcept : m_ptr(nullptr), m_count(0) {}
- constexpr Span(std::nullptr_t) noexcept : m_ptr(nullptr), m_count(0) {}
- constexpr Span(pointer ptr, size_t count) noexcept : m_ptr(ptr), m_count(count) {}
- constexpr Span(pointer ptr_begin, pointer ptr_end) noexcept : m_ptr(ptr_begin), m_count(ptr_end - ptr_begin) {}
+ constexpr Span() noexcept : m_ptr(nullptr), m_count(0) { }
+ constexpr Span(std::nullptr_t) noexcept : m_ptr(nullptr), m_count(0) { }
+ constexpr Span(pointer ptr, size_t count) noexcept : m_ptr(ptr), m_count(count) { }
+ constexpr Span(pointer ptr_begin, pointer ptr_end) noexcept : m_ptr(ptr_begin), m_count(ptr_end - ptr_begin) { }
template<size_t N>
constexpr Span(T (&arr)[N]) noexcept : m_ptr(arr), m_count(N)
diff --git a/toolsrc/include/vcpkg/base/stringliteral.h b/toolsrc/include/vcpkg/base/stringliteral.h index 602e0bfd2..d0d5dc124 100644 --- a/toolsrc/include/vcpkg/base/stringliteral.h +++ b/toolsrc/include/vcpkg/base/stringliteral.h @@ -1,6 +1,7 @@ #pragma once #include <string> + #include <vcpkg/base/zstringview.h> namespace vcpkg diff --git a/toolsrc/include/vcpkg/base/strings.h b/toolsrc/include/vcpkg/base/strings.h index e88d1074f..229bedb65 100644 --- a/toolsrc/include/vcpkg/base/strings.h +++ b/toolsrc/include/vcpkg/base/strings.h @@ -1,19 +1,18 @@ #pragma once -#include <vcpkg/base/pragmas.h> +#include <errno.h> +#include <inttypes.h> +#include <limits.h> + +#include <vector> #include <vcpkg/base/cstringview.h> #include <vcpkg/base/optional.h> +#include <vcpkg/base/pragmas.h> #include <vcpkg/base/stringliteral.h> #include <vcpkg/base/stringview.h> #include <vcpkg/base/view.h> -#include <errno.h> -#include <inttypes.h> -#include <limits.h> - -#include <vector> - namespace vcpkg::Strings::details { template<class T> diff --git a/toolsrc/include/vcpkg/base/stringview.h b/toolsrc/include/vcpkg/base/stringview.h index 6a5503e1c..a442964f8 100644 --- a/toolsrc/include/vcpkg/base/stringview.h +++ b/toolsrc/include/vcpkg/base/stringview.h @@ -1,11 +1,11 @@ #pragma once -#include <vcpkg/base/optional.h> - #include <limits> #include <string> #include <vector> +#include <vcpkg/base/optional.h> + namespace vcpkg { struct StringView diff --git a/toolsrc/include/vcpkg/base/system.debug.h b/toolsrc/include/vcpkg/base/system.debug.h index d9c50ac8e..c1f98a9e1 100644 --- a/toolsrc/include/vcpkg/base/system.debug.h +++ b/toolsrc/include/vcpkg/base/system.debug.h @@ -1,10 +1,10 @@ #pragma once +#include <atomic> + #include <vcpkg/base/chrono.h> #include <vcpkg/base/system.print.h> -#include <atomic> - namespace vcpkg::Debug { extern std::atomic<bool> g_debugging; diff --git a/toolsrc/include/vcpkg/base/system.process.h b/toolsrc/include/vcpkg/base/system.process.h index 91faa5985..9dbb5d069 100644 --- a/toolsrc/include/vcpkg/base/system.process.h +++ b/toolsrc/include/vcpkg/base/system.process.h @@ -1,13 +1,13 @@ #pragma once -#include <vcpkg/base/files.h> -#include <vcpkg/base/zstringview.h> - #include <functional> #include <string> #include <unordered_map> #include <vector> +#include <vcpkg/base/files.h> +#include <vcpkg/base/zstringview.h> + namespace vcpkg::System { struct CMakeVariable diff --git a/toolsrc/include/vcpkg/base/system_headers.h b/toolsrc/include/vcpkg/base/system_headers.h index 9af5bfd92..858cf58cc 100644 --- a/toolsrc/include/vcpkg/base/system_headers.h +++ b/toolsrc/include/vcpkg/base/system_headers.h @@ -17,7 +17,8 @@ // ctermid is not behind an `extern "C"` barrier, so it's linked incorrectly. // This has been reported; remove it after 2023-05-19 #if __APPLE__ -extern "C" { +extern "C" +{ #endif #include <unistd.h> @@ -32,4 +33,3 @@ extern "C" { // glibc defines major and minor in sys/types.h, and should not #undef major #undef minor - diff --git a/toolsrc/include/vcpkg/base/uint128.h b/toolsrc/include/vcpkg/base/uint128.h index 6b7816760..feac68bb7 100644 --- a/toolsrc/include/vcpkg/base/uint128.h +++ b/toolsrc/include/vcpkg/base/uint128.h @@ -2,25 +2,23 @@ #include <stdint.h> -namespace vcpkg { +namespace vcpkg +{ + struct UInt128 + { + UInt128() = default; + UInt128(uint64_t value) : bottom(value), top(0) { } -struct UInt128 { - UInt128() = default; - UInt128(uint64_t value) : bottom(value), top(0) {} + UInt128& operator<<=(int by) noexcept; + UInt128& operator>>=(int by) noexcept; + UInt128& operator+=(uint64_t lhs) noexcept; - UInt128& operator<<=(int by) noexcept; - UInt128& operator>>=(int by) noexcept; - UInt128& operator+=(uint64_t lhs) noexcept; + uint64_t bottom_64_bits() const noexcept { return bottom; } + uint64_t top_64_bits() const noexcept { return top; } - uint64_t bottom_64_bits() const noexcept { - return bottom; - } - uint64_t top_64_bits() const noexcept { - return top; - } -private: - uint64_t bottom; - uint64_t top; -}; + private: + uint64_t bottom; + uint64_t top; + }; } diff --git a/toolsrc/include/vcpkg/base/util.h b/toolsrc/include/vcpkg/base/util.h index a5b56028b..a6d8781b0 100644 --- a/toolsrc/include/vcpkg/base/util.h +++ b/toolsrc/include/vcpkg/base/util.h @@ -218,7 +218,7 @@ namespace vcpkg::Util T* get() { return &m_ptr; } - LockGuardPtr(LockGuarded<T>& sync) : m_lock(sync.m_mutex), m_ptr(sync.m_t) {} + LockGuardPtr(LockGuarded<T>& sync) : m_lock(sync.m_mutex), m_ptr(sync.m_t) { } private: std::unique_lock<std::mutex> m_lock; diff --git a/toolsrc/include/vcpkg/base/work_queue.h b/toolsrc/include/vcpkg/base/work_queue.h index a60613a3c..ba622361a 100644 --- a/toolsrc/include/vcpkg/base/work_queue.h +++ b/toolsrc/include/vcpkg/base/work_queue.h @@ -1,17 +1,17 @@ #pragma once -#include <vcpkg/base/checks.h> - #include <condition_variable> #include <memory> #include <vector> +#include <vcpkg/base/checks.h> + namespace vcpkg { template<class Action> struct WorkQueue { - WorkQueue(LineInfo li) : m_line_info(li) {} + WorkQueue(LineInfo li) : m_line_info(li) { } WorkQueue(const WorkQueue&) = delete; ~WorkQueue() diff --git a/toolsrc/include/vcpkg/base/zstringview.h b/toolsrc/include/vcpkg/base/zstringview.h index 7f80bf726..8aa0dbdaf 100644 --- a/toolsrc/include/vcpkg/base/zstringview.h +++ b/toolsrc/include/vcpkg/base/zstringview.h @@ -14,7 +14,7 @@ namespace vcpkg { using value_type = char; - constexpr ZStringView() : m_size(0), m_cstr("") {} + constexpr ZStringView() : m_size(0), m_cstr("") { } template<int N> constexpr ZStringView(const char (&str)[N]) @@ -22,8 +22,8 @@ namespace vcpkg { } - ZStringView(const std::string& s) : m_size(s.size()), m_cstr(s.c_str()) {} - constexpr ZStringView(const char* str, size_t sz) : m_size(sz), m_cstr(str) {} + ZStringView(const std::string& s) : m_size(s.size()), m_cstr(s.c_str()) { } + constexpr ZStringView(const char* str, size_t sz) : m_size(sz), m_cstr(str) { } constexpr const char* data() const { return m_cstr; } constexpr size_t size() const { return m_size; } diff --git a/toolsrc/include/vcpkg/binarycaching.private.h b/toolsrc/include/vcpkg/binarycaching.private.h index f20a0db12..6f2fda9c0 100644 --- a/toolsrc/include/vcpkg/binarycaching.private.h +++ b/toolsrc/include/vcpkg/binarycaching.private.h @@ -1,6 +1,7 @@ #pragma once
#include <string>
+
#include <vcpkg/dependencies.h>
#include <vcpkg/packagespec.h>
#include <vcpkg/vcpkgpaths.h>
diff --git a/toolsrc/include/vcpkg/build.h b/toolsrc/include/vcpkg/build.h index ea9f86fef..9d4e17eae 100644 --- a/toolsrc/include/vcpkg/build.h +++ b/toolsrc/include/vcpkg/build.h @@ -1,5 +1,14 @@ #pragma once +#include <array> +#include <map> +#include <set> +#include <vector> + +#include <vcpkg/base/cstringview.h> +#include <vcpkg/base/files.h> +#include <vcpkg/base/optional.h> +#include <vcpkg/base/system.process.h> #include <vcpkg/cmakevars.h> #include <vcpkg/packagespec.h> #include <vcpkg/statusparagraphs.h> @@ -7,16 +16,6 @@ #include <vcpkg/vcpkgcmdarguments.h> #include <vcpkg/vcpkgpaths.h> -#include <vcpkg/base/cstringview.h> -#include <vcpkg/base/files.h> -#include <vcpkg/base/optional.h> -#include <vcpkg/base/system.process.h> - -#include <array> -#include <map> -#include <set> -#include <vector> - namespace vcpkg { struct IBinaryProvider; diff --git a/toolsrc/include/vcpkg/buildenvironment.h b/toolsrc/include/vcpkg/buildenvironment.h index 4505f4972..fe5bbeaf7 100644 --- a/toolsrc/include/vcpkg/buildenvironment.h +++ b/toolsrc/include/vcpkg/buildenvironment.h @@ -1,9 +1,9 @@ -#include <vcpkg/base/system.process.h>
-#include <vcpkg/vcpkgpaths.h>
-
#include <string>
#include <vector>
+#include <vcpkg/base/system.process.h>
+#include <vcpkg/vcpkgpaths.h>
+
namespace vcpkg
{
std::string make_cmake_cmd(const VcpkgPaths& paths,
diff --git a/toolsrc/include/vcpkg/cmakevars.h b/toolsrc/include/vcpkg/cmakevars.h index 1c02376b9..e2f1df522 100644 --- a/toolsrc/include/vcpkg/cmakevars.h +++ b/toolsrc/include/vcpkg/cmakevars.h @@ -1,7 +1,6 @@ #pragma once #include <vcpkg/base/optional.h> - #include <vcpkg/portfileprovider.h> #include <vcpkg/vcpkgpaths.h> diff --git a/toolsrc/include/vcpkg/commands.h b/toolsrc/include/vcpkg/commands.h index cec9237f5..2a8d88320 100644 --- a/toolsrc/include/vcpkg/commands.h +++ b/toolsrc/include/vcpkg/commands.h @@ -1,15 +1,15 @@ #pragma once +#include <array> +#include <map> +#include <vector> + #include <vcpkg/build.h> #include <vcpkg/dependencies.h> #include <vcpkg/statusparagraphs.h> #include <vcpkg/vcpkgcmdarguments.h> #include <vcpkg/vcpkgpaths.h> -#include <array> -#include <map> -#include <vector> - namespace vcpkg::Commands { using CommandTypeA = void (*)(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet); diff --git a/toolsrc/include/vcpkg/dependencies.h b/toolsrc/include/vcpkg/dependencies.h index 5e1c9f657..9e11d1c41 100644 --- a/toolsrc/include/vcpkg/dependencies.h +++ b/toolsrc/include/vcpkg/dependencies.h @@ -1,5 +1,9 @@ #pragma once +#include <functional> +#include <map> +#include <vector> + #include <vcpkg/base/optional.h> #include <vcpkg/base/util.h> #include <vcpkg/build.h> @@ -9,10 +13,6 @@ #include <vcpkg/statusparagraphs.h> #include <vcpkg/vcpkgpaths.h> -#include <functional> -#include <map> -#include <vector> - namespace vcpkg::Graphs { struct Randomizer; diff --git a/toolsrc/include/vcpkg/export.chocolatey.h b/toolsrc/include/vcpkg/export.chocolatey.h index 7804108fd..a6dde36db 100644 --- a/toolsrc/include/vcpkg/export.chocolatey.h +++ b/toolsrc/include/vcpkg/export.chocolatey.h @@ -1,10 +1,10 @@ #pragma once
+#include <vector>
+
#include <vcpkg/dependencies.h>
#include <vcpkg/vcpkgpaths.h>
-#include <vector>
-
namespace vcpkg::Export::Chocolatey
{
struct Options
diff --git a/toolsrc/include/vcpkg/export.ifw.h b/toolsrc/include/vcpkg/export.ifw.h index b1573924e..ec01511aa 100644 --- a/toolsrc/include/vcpkg/export.ifw.h +++ b/toolsrc/include/vcpkg/export.ifw.h @@ -1,11 +1,11 @@ #pragma once -#include <vcpkg/dependencies.h> -#include <vcpkg/vcpkgpaths.h> - #include <string> #include <vector> +#include <vcpkg/dependencies.h> +#include <vcpkg/vcpkgpaths.h> + namespace vcpkg::Export::IFW { struct Options diff --git a/toolsrc/include/vcpkg/export.prefab.h b/toolsrc/include/vcpkg/export.prefab.h index cf9f940f9..cfd99bec7 100644 --- a/toolsrc/include/vcpkg/export.prefab.h +++ b/toolsrc/include/vcpkg/export.prefab.h @@ -1,12 +1,11 @@ #pragma once +#include <vector> + #include <vcpkg/base/system.h> #include <vcpkg/dependencies.h> #include <vcpkg/vcpkgpaths.h> - -#include <vector> - namespace vcpkg::Export::Prefab { constexpr int kFragmentSize = 3; @@ -23,17 +22,14 @@ namespace vcpkg::Export::Prefab }; struct NdkVersion { - NdkVersion(int _major, int _minor, int _patch) : m_major{_major}, - m_minor{_minor}, - m_patch{_patch}{ - } - int major() { return this->m_major; } - int minor() { return this->m_minor; } - int patch() { return this->m_patch; } + NdkVersion(int _major, int _minor, int _patch) : m_major{_major}, m_minor{_minor}, m_patch{_patch} { } + int major() { return this->m_major; } + int minor() { return this->m_minor; } + int patch() { return this->m_patch; } std::string to_string(); void to_string(std::string& out); - private: + private: int m_major; int m_minor; int m_patch; @@ -72,11 +68,10 @@ namespace vcpkg::Export::Prefab std::string to_json(); }; - - void do_export(const std::vector<Dependencies::ExportPlanAction>& export_plan, const VcpkgPaths& paths, - const Options& prefab_options, const Triplet& triplet); - Optional<std::string> find_ndk_version(const std::string &content); - Optional<NdkVersion> to_version(const std::string &version); + const Options& prefab_options, + const Triplet& triplet); + Optional<std::string> find_ndk_version(const std::string& content); + Optional<NdkVersion> to_version(const std::string& version); } diff --git a/toolsrc/include/vcpkg/globalstate.h b/toolsrc/include/vcpkg/globalstate.h index 35ca71dbb..a5bc46ec5 100644 --- a/toolsrc/include/vcpkg/globalstate.h +++ b/toolsrc/include/vcpkg/globalstate.h @@ -1,11 +1,11 @@ #pragma once -#include <vcpkg/base/chrono.h> -#include <vcpkg/base/util.h> - #include <atomic> #include <string> +#include <vcpkg/base/chrono.h> +#include <vcpkg/base/util.h> + namespace vcpkg { struct GlobalState diff --git a/toolsrc/include/vcpkg/help.h b/toolsrc/include/vcpkg/help.h index 97bc11864..bebf91c64 100644 --- a/toolsrc/include/vcpkg/help.h +++ b/toolsrc/include/vcpkg/help.h @@ -1,10 +1,10 @@ #pragma once +#include <string> + #include <vcpkg/vcpkgcmdarguments.h> #include <vcpkg/vcpkgpaths.h> -#include <string> - namespace vcpkg::Help { extern const CommandStructure COMMAND_STRUCTURE; diff --git a/toolsrc/include/vcpkg/install.h b/toolsrc/include/vcpkg/install.h index 2700ac3a8..81beb8a15 100644 --- a/toolsrc/include/vcpkg/install.h +++ b/toolsrc/include/vcpkg/install.h @@ -1,13 +1,13 @@ #pragma once +#include <vector> + #include <vcpkg/base/chrono.h> #include <vcpkg/build.h> #include <vcpkg/dependencies.h> #include <vcpkg/vcpkgcmdarguments.h> #include <vcpkg/vcpkgpaths.h> -#include <vector> - namespace vcpkg::Install { enum class KeepGoing diff --git a/toolsrc/include/vcpkg/metrics.h b/toolsrc/include/vcpkg/metrics.h index 89fb8a92f..67fbfc00f 100644 --- a/toolsrc/include/vcpkg/metrics.h +++ b/toolsrc/include/vcpkg/metrics.h @@ -1,10 +1,10 @@ #pragma once -#include <vcpkg/base/util.h> -#include <vcpkg/base/files.h> - #include <string> +#include <vcpkg/base/files.h> +#include <vcpkg/base/util.h> + namespace vcpkg::Metrics { struct Metrics : Util::ResourceBase diff --git a/toolsrc/include/vcpkg/packagespec.h b/toolsrc/include/vcpkg/packagespec.h index ae771f20c..014c1318d 100644 --- a/toolsrc/include/vcpkg/packagespec.h +++ b/toolsrc/include/vcpkg/packagespec.h @@ -21,7 +21,7 @@ namespace vcpkg struct PackageSpec { PackageSpec() = default; - PackageSpec(std::string name, Triplet triplet) : m_name(std::move(name)), m_triplet(triplet) {} + PackageSpec(std::string name, Triplet triplet) : m_name(std::move(name)), m_triplet(triplet) { } static std::vector<PackageSpec> to_package_specs(const std::vector<std::string>& ports, Triplet triplet); @@ -54,7 +54,7 @@ namespace vcpkg /// struct FeatureSpec { - FeatureSpec(const PackageSpec& spec, const std::string& feature) : m_spec(spec), m_feature(feature) {} + FeatureSpec(const PackageSpec& spec, const std::string& feature) : m_spec(spec), m_feature(feature) { } const std::string& name() const { return m_spec.name(); } const std::string& feature() const { return m_feature; } diff --git a/toolsrc/include/vcpkg/paragraphparser.h b/toolsrc/include/vcpkg/paragraphparser.h index 71d11ddd0..1f48a720f 100644 --- a/toolsrc/include/vcpkg/paragraphparser.h +++ b/toolsrc/include/vcpkg/paragraphparser.h @@ -1,15 +1,15 @@ #pragma once -#include <vcpkg/base/expected.h> -#include <vcpkg/packagespec.h> -#include <vcpkg/textrowcol.h> - #include <map> #include <memory> #include <string> #include <unordered_map> #include <vector> +#include <vcpkg/base/expected.h> +#include <vcpkg/packagespec.h> +#include <vcpkg/textrowcol.h> + namespace vcpkg::Parse { struct ParseControlErrorInfo diff --git a/toolsrc/include/vcpkg/paragraphs.h b/toolsrc/include/vcpkg/paragraphs.h index 8f1c09c5b..67077f6c2 100644 --- a/toolsrc/include/vcpkg/paragraphs.h +++ b/toolsrc/include/vcpkg/paragraphs.h @@ -1,11 +1,10 @@ #pragma once +#include <vcpkg/base/expected.h> #include <vcpkg/binaryparagraph.h> #include <vcpkg/paragraphparser.h> #include <vcpkg/vcpkgpaths.h> -#include <vcpkg/base/expected.h> - namespace vcpkg::Paragraphs { using Paragraph = Parse::Paragraph; @@ -17,7 +16,10 @@ namespace vcpkg::Paragraphs bool is_port_directory(const Files::Filesystem& fs, const fs::path& path); - Parse::ParseExpected<SourceControlFile> try_load_manifest(const Files::Filesystem& fs, const std::string& port_name, const fs::path& path_to_manifest, std::error_code& ec); + Parse::ParseExpected<SourceControlFile> try_load_manifest(const Files::Filesystem& fs, + const std::string& port_name, + const fs::path& path_to_manifest, + std::error_code& ec); Parse::ParseExpected<SourceControlFile> try_load_port(const Files::Filesystem& fs, const fs::path& path); diff --git a/toolsrc/include/vcpkg/platform-expression.h b/toolsrc/include/vcpkg/platform-expression.h index d857d75dc..8beb5d1d9 100644 --- a/toolsrc/include/vcpkg/platform-expression.h +++ b/toolsrc/include/vcpkg/platform-expression.h @@ -2,6 +2,7 @@ #include <string>
#include <unordered_map>
+
#include <vcpkg/base/expected.h>
#include <vcpkg/base/stringview.h>
diff --git a/toolsrc/include/vcpkg/postbuildlint.buildtype.h b/toolsrc/include/vcpkg/postbuildlint.buildtype.h index 0b469d9a0..c99fe6084 100644 --- a/toolsrc/include/vcpkg/postbuildlint.buildtype.h +++ b/toolsrc/include/vcpkg/postbuildlint.buildtype.h @@ -1,11 +1,11 @@ #pragma once -#include <vcpkg/base/cstringview.h> -#include <vcpkg/build.h> - #include <array> #include <regex> +#include <vcpkg/base/cstringview.h> +#include <vcpkg/build.h> + namespace vcpkg::PostBuildLint { struct BuildType diff --git a/toolsrc/include/vcpkg/sourceparagraph.h b/toolsrc/include/vcpkg/sourceparagraph.h index 4212258ab..00b847e64 100644 --- a/toolsrc/include/vcpkg/sourceparagraph.h +++ b/toolsrc/include/vcpkg/sourceparagraph.h @@ -5,9 +5,9 @@ #include <vcpkg/base/span.h> #include <vcpkg/base/system.h> #include <vcpkg/base/system.print.h> -#include <vcpkg/platform-expression.h> #include <vcpkg/packagespec.h> #include <vcpkg/paragraphparser.h> +#include <vcpkg/platform-expression.h> namespace vcpkg { diff --git a/toolsrc/include/vcpkg/statusparagraph.h b/toolsrc/include/vcpkg/statusparagraph.h index fdcb5337d..5228e2964 100644 --- a/toolsrc/include/vcpkg/statusparagraph.h +++ b/toolsrc/include/vcpkg/statusparagraph.h @@ -1,9 +1,9 @@ #pragma once -#include <vcpkg/binaryparagraph.h> - #include <map> +#include <vcpkg/binaryparagraph.h> + namespace vcpkg { enum class InstallState @@ -47,7 +47,7 @@ namespace vcpkg struct InstalledPackageView { - InstalledPackageView() noexcept : core(nullptr) {} + InstalledPackageView() noexcept : core(nullptr) { } InstalledPackageView(const StatusParagraph* c, std::vector<const StatusParagraph*>&& fs) : core(c), features(std::move(fs)) diff --git a/toolsrc/include/vcpkg/statusparagraphs.h b/toolsrc/include/vcpkg/statusparagraphs.h index 8fd85b4e0..bebb4a3e0 100644 --- a/toolsrc/include/vcpkg/statusparagraphs.h +++ b/toolsrc/include/vcpkg/statusparagraphs.h @@ -1,9 +1,9 @@ #pragma once -#include <vcpkg/statusparagraph.h> - #include <iterator> #include <memory> +#include <vcpkg/statusparagraph.h> + namespace vcpkg { /// <summary>Status paragraphs</summary> diff --git a/toolsrc/include/vcpkg/tools.h b/toolsrc/include/vcpkg/tools.h index 6a096c321..7c5ad0480 100644 --- a/toolsrc/include/vcpkg/tools.h +++ b/toolsrc/include/vcpkg/tools.h @@ -1,17 +1,17 @@ #pragma once -#include <vcpkg/base/files.h> - #include <string> #include <utility> +#include <vcpkg/base/files.h> + namespace vcpkg { struct VcpkgPaths; struct ToolCache { - virtual ~ToolCache() {} + virtual ~ToolCache() { } virtual const fs::path& get_tool_path(const VcpkgPaths& paths, const std::string& tool) const = 0; virtual const std::string& get_tool_version(const VcpkgPaths& paths, const std::string& tool) const = 0; diff --git a/toolsrc/include/vcpkg/triplet.h b/toolsrc/include/vcpkg/triplet.h index 4a88f5708..d23887b47 100644 --- a/toolsrc/include/vcpkg/triplet.h +++ b/toolsrc/include/vcpkg/triplet.h @@ -1,9 +1,9 @@ #pragma once #include <string> -#include <vcpkg/base/system.h> -#include <vcpkg/base/optional.h> +#include <vcpkg/base/optional.h> +#include <vcpkg/base/system.h> #include <vcpkg/vcpkgcmdarguments.h> namespace vcpkg diff --git a/toolsrc/include/vcpkg/userconfig.h b/toolsrc/include/vcpkg/userconfig.h index d044f43ef..4a93472e2 100644 --- a/toolsrc/include/vcpkg/userconfig.h +++ b/toolsrc/include/vcpkg/userconfig.h @@ -1,6 +1,7 @@ #pragma once #include <string> + #include <vcpkg/base/files.h> namespace vcpkg diff --git a/toolsrc/include/vcpkg/vcpkgcmdarguments.h b/toolsrc/include/vcpkg/vcpkgcmdarguments.h index d8dc94a37..0ab5917b5 100644 --- a/toolsrc/include/vcpkg/vcpkgcmdarguments.h +++ b/toolsrc/include/vcpkg/vcpkgcmdarguments.h @@ -1,15 +1,15 @@ #pragma once -#include <vcpkg/base/optional.h> -#include <vcpkg/base/span.h> -#include <vcpkg/base/stringliteral.h> -#include <vcpkg/base/files.h> - #include <memory> #include <unordered_map> #include <unordered_set> #include <vector> +#include <vcpkg/base/files.h> +#include <vcpkg/base/optional.h> +#include <vcpkg/base/span.h> +#include <vcpkg/base/stringliteral.h> + namespace vcpkg { struct ParsedArguments diff --git a/toolsrc/include/vcpkg/vcpkgpaths.h b/toolsrc/include/vcpkg/vcpkgpaths.h index 296b6a314..ba7b01e0e 100644 --- a/toolsrc/include/vcpkg/vcpkgpaths.h +++ b/toolsrc/include/vcpkg/vcpkgpaths.h @@ -1,15 +1,14 @@ #pragma once -#include <vcpkg/binaryparagraph.h> -#include <vcpkg/packagespec.h> -#include <vcpkg/tools.h> -#include <vcpkg/vcpkgcmdarguments.h> - #include <vcpkg/base/cache.h> #include <vcpkg/base/files.h> #include <vcpkg/base/lazy.h> #include <vcpkg/base/optional.h> #include <vcpkg/base/util.h> +#include <vcpkg/binaryparagraph.h> +#include <vcpkg/packagespec.h> +#include <vcpkg/tools.h> +#include <vcpkg/vcpkgcmdarguments.h> namespace vcpkg { 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; |
