mirror of
https://github.com/microsoft/WSL.git
synced 2025-12-10 00:44:55 -06:00
build: fix minor compiler errors when building with VS2026 (#13744)
* build: fix minor compiler errors when building with VS2026 * s * use VS2022 for clang format and cross compiling --------- Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
This commit is contained in:
parent
7226b05100
commit
b73897e88a
@ -266,15 +266,16 @@ else()
|
||||
endif()
|
||||
|
||||
# Determine the Visual Studio installation directory which contains LLVM tools
|
||||
# N.B. The version is set to VS2022 to ensure local runs match pipeline behavior
|
||||
execute_process(
|
||||
COMMAND "${VSWHERE_SOURCE_DIR}/vswhere.exe" -latest -products * -property installationPath
|
||||
COMMAND "${VSWHERE_SOURCE_DIR}/vswhere.exe" -version "[17.0,18.0)" -products * -property installationPath
|
||||
OUTPUT_VARIABLE VS_INSTALL_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
)
|
||||
|
||||
if (NOT VS_INSTALL_DIR)
|
||||
message(FATAL_ERROR "Could not determine Visual Studio installation directory.")
|
||||
message(FATAL_ERROR "Could not determine Visual Studio 2022 installation directory.")
|
||||
endif()
|
||||
|
||||
if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "AMD64")
|
||||
|
||||
@ -791,7 +791,7 @@ private:
|
||||
} Data;
|
||||
} Reparse{};
|
||||
|
||||
constexpr ULONG ReparseBufferSize = REPARSE_DATA_BUFFER_HEADER_SIZE + sizeof(ULONG);
|
||||
const ULONG ReparseBufferSize = REPARSE_DATA_BUFFER_HEADER_SIZE + sizeof(ULONG);
|
||||
|
||||
//
|
||||
// The data length is the buffer size excluding the header.
|
||||
|
||||
@ -2797,7 +2797,7 @@ Error code: Wsl/InstallDistro/WSL_E_DISTRO_NOT_FOUND
|
||||
|
||||
VERIFY_ARE_EQUAL(LxsstuLaunchWsl(std::format(L"--import {} . \"{}\" --version 2", name, g_testDistroPath)), 0L);
|
||||
|
||||
auto cleanupName = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, []() {
|
||||
auto cleanupName = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, [name]() {
|
||||
LxsstuLaunchWsl(std::format(L"--unregister {}", name));
|
||||
std::filesystem::remove_all(testFolder);
|
||||
});
|
||||
@ -2873,9 +2873,9 @@ Error code: Wsl/InstallDistro/WSL_E_DISTRO_NOT_FOUND
|
||||
WslShutdown();
|
||||
|
||||
auto cleanupName =
|
||||
wil::scope_exit_log(WI_DIAGNOSTICS_INFO, []() { LxsstuLaunchWsl(std::format(L"--unregister {}", name)); });
|
||||
wil::scope_exit_log(WI_DIAGNOSTICS_INFO, [name]() { LxsstuLaunchWsl(std::format(L"--unregister {}", name)); });
|
||||
|
||||
auto validateDistro = [](LPCWSTR size, LPCWSTR expectedSize, LPCWSTR expectedError = nullptr) {
|
||||
auto validateDistro = [name](LPCWSTR size, LPCWSTR expectedSize, LPCWSTR expectedError = nullptr) {
|
||||
auto [out, _] = LxsstuLaunchWslAndCaptureOutput(std::format(L"--manage {} --resize {}", name, size), expectedError ? -1 : 0);
|
||||
if (expectedError)
|
||||
{
|
||||
@ -3578,8 +3578,8 @@ localhostForwarding=true
|
||||
|
||||
constexpr auto TestUser = L"testuser";
|
||||
|
||||
auto cleanup =
|
||||
wil::scope_exit_log(WI_DIAGNOSTICS_INFO, []() { LxsstuLaunchWsl(std::format(L"-u root userdel -f {}", TestUser)); });
|
||||
auto cleanup = wil::scope_exit_log(
|
||||
WI_DIAGNOSTICS_INFO, [TestUser]() { LxsstuLaunchWsl(std::format(L"-u root userdel -f {}", TestUser)); });
|
||||
|
||||
ULONG Uid{};
|
||||
ULONG Gid{};
|
||||
@ -3719,7 +3719,7 @@ localhostForwarding=true
|
||||
constexpr auto testTar = L"exported-distro.tar";
|
||||
constexpr auto tmpDistroName = L"tmpdistro";
|
||||
|
||||
auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, []() {
|
||||
auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, [tmpDistroName]() {
|
||||
DeleteFile(testTar);
|
||||
LxsstuLaunchWsl(std::format(L"--unregister {}", tmpDistroName));
|
||||
});
|
||||
@ -3950,7 +3950,7 @@ VERSION_ID="Invalid|Format"
|
||||
constexpr auto testDistroName = L"test-oobe-import";
|
||||
|
||||
std::filesystem::create_directory(testDir);
|
||||
auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, [this]() {
|
||||
auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, [this, testDistroName]() {
|
||||
LxsstuLaunchWsl(std::format(L"--unregister {}", testDistroName));
|
||||
std::error_code error;
|
||||
std::filesystem::remove_all(testDir, error);
|
||||
@ -4511,7 +4511,7 @@ Error code: Wsl/Service/RegisterDistro/E_INVALIDARG\r\n";
|
||||
constexpr auto distroName = L"custom-terminal-profile";
|
||||
constexpr auto tarName = L"custom-terminal-profile.tar";
|
||||
|
||||
auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, []() {
|
||||
auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, [distroName]() {
|
||||
DeleteFile(tarName);
|
||||
LxsstuLaunchWsl(std::format(L"--unregister {}", distroName));
|
||||
});
|
||||
@ -4553,7 +4553,7 @@ Error code: Wsl/Service/RegisterDistro/E_INVALIDARG\r\n";
|
||||
constexpr auto distroName = L"custom-terminal-profile-bad-json";
|
||||
constexpr auto tarName = L"custom-terminal-profile-bad-json.tar";
|
||||
|
||||
auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, []() {
|
||||
auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, [distroName]() {
|
||||
DeleteFile(tarName);
|
||||
LxsstuLaunchWsl(std::format(L"--unregister {}", distroName));
|
||||
});
|
||||
@ -4581,7 +4581,7 @@ Error code: Wsl/Service/RegisterDistro/E_INVALIDARG\r\n";
|
||||
constexpr auto distroName = L"custom-terminal-profile-hide";
|
||||
constexpr auto tarName = L"custom-terminal-profile-hide.tar";
|
||||
|
||||
auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, []() {
|
||||
auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, [distroName]() {
|
||||
DeleteFile(tarName);
|
||||
LxsstuLaunchWsl(std::format(L"--unregister {}", distroName));
|
||||
});
|
||||
@ -4625,7 +4625,7 @@ Error code: Wsl/Service/RegisterDistro/E_INVALIDARG\r\n";
|
||||
constexpr auto distroName = L"no-terminal-profile";
|
||||
constexpr auto tarName = L"no-terminal-profile.tar";
|
||||
|
||||
auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, []() {
|
||||
auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, [distroName]() {
|
||||
DeleteFile(tarName);
|
||||
LxsstuLaunchWsl(std::format(L"--unregister {}", distroName));
|
||||
});
|
||||
@ -4647,7 +4647,7 @@ Error code: Wsl/Service/RegisterDistro/E_INVALIDARG\r\n";
|
||||
constexpr auto distroName = L"no-shortcut";
|
||||
constexpr auto tarName = L"no-shortcut.tar";
|
||||
|
||||
auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, []() {
|
||||
auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, [distroName]() {
|
||||
DeleteFile(tarName);
|
||||
LxsstuLaunchWsl(std::format(L"--unregister {}", distroName));
|
||||
});
|
||||
@ -6146,8 +6146,8 @@ Error code: Wsl/InstallDistro/WSL_E_INVALID_JSON\r\n",
|
||||
TEST_METHOD(ImportExportStdout)
|
||||
{
|
||||
constexpr auto test_distro = L"import-test-distro";
|
||||
auto cleanup =
|
||||
wil::scope_exit_log(WI_DIAGNOSTICS_INFO, []() { LxsstuLaunchWsl(std::format(L"--unregister {}", test_distro)); });
|
||||
auto cleanup = wil::scope_exit_log(
|
||||
WI_DIAGNOSTICS_INFO, [test_distro]() { LxsstuLaunchWsl(std::format(L"--unregister {}", test_distro)); });
|
||||
|
||||
// The below logline makes it easier to find the bsdtar output when debugging this test case.
|
||||
fprintf(stderr, "Starting ImportExportStdout test case\n");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user