Fix building with v143 toolchain (#10727)
Visual Studio 2022 Preview recently released the v143 toolchain. C4189 is now flagging several unused variables, which breaks our build. ## PR Checklist * [x] I work here * [x] Tests added/passed ## Validation Steps Performed * CascadiaPackage builds ✔️ * All tests build ✔️
This commit is contained in:
parent
9c1331ab2e
commit
79115e2058
|
@ -418,7 +418,6 @@ bool TextBuffer::InsertCharacter(const std::wstring_view chars,
|
|||
|
||||
// Store character and double byte data
|
||||
CharRow& charRow = Row.GetCharRow();
|
||||
short const cBufferWidth = GetSize().Width();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -1650,13 +1649,14 @@ const TextBuffer::TextAndColor TextBuffer::GetText(const bool includeCRLF,
|
|||
|
||||
if (!cell.DbcsAttr().IsTrailing())
|
||||
{
|
||||
selectionText.append(cell.Chars());
|
||||
const auto chars = cell.Chars();
|
||||
selectionText.append(chars);
|
||||
|
||||
if (copyTextColor)
|
||||
{
|
||||
const auto cellData = cell.TextAttr();
|
||||
const auto [CellFgAttr, CellBkAttr] = GetAttributeColors(cellData);
|
||||
for (const wchar_t wch : cell.Chars())
|
||||
for (size_t j = 0; j < chars.size(); ++j)
|
||||
{
|
||||
selectionFgAttr.push_back(CellFgAttr);
|
||||
selectionBkAttr.push_back(CellBkAttr);
|
||||
|
|
|
@ -911,7 +911,6 @@ winrt::fire_and_forget Pane::_CloseChildRoutine(const bool closeFirst)
|
|||
auto removedChild = closeFirst ? _firstChild : _secondChild;
|
||||
auto remainingChild = closeFirst ? _secondChild : _firstChild;
|
||||
const bool splitWidth = _splitState == SplitState::Vertical;
|
||||
const auto totalSize = splitWidth ? _root.ActualWidth() : _root.ActualHeight();
|
||||
|
||||
Size removedOriginalSize{
|
||||
::base::saturated_cast<float>(removedChild->_root.ActualWidth()),
|
||||
|
|
|
@ -230,16 +230,10 @@ void Terminal::UpdateAppearance(const ICoreAppearance& appearance)
|
|||
}
|
||||
|
||||
const auto dx = ::base::ClampSub(viewportSize.X, oldDimensions.X);
|
||||
|
||||
const auto oldTop = _mutableViewport.Top();
|
||||
|
||||
const short newBufferHeight = ::base::ClampAdd(viewportSize.Y, _scrollbackLines);
|
||||
|
||||
COORD bufferSize{ viewportSize.X, newBufferHeight };
|
||||
|
||||
// Save cursor's relative height versus the viewport
|
||||
const short sCursorHeightInViewportBefore = ::base::ClampSub(_buffer->GetCursor().GetPosition().Y, _mutableViewport.Top());
|
||||
|
||||
// This will be used to determine where the viewport should be in the new buffer.
|
||||
const short oldViewportTop = _mutableViewport.Top();
|
||||
short newViewportTop = oldViewportTop;
|
||||
|
|
|
@ -1656,7 +1656,7 @@ namespace RemotingUnitTests
|
|||
|
||||
auto m0 = make_private<Remoting::implementation::Monarch>(monarch0PID);
|
||||
auto p1 = make_private<Remoting::implementation::Peasant>(peasant1PID);
|
||||
auto p2 = make_private<Remoting::implementation::Peasant>(peasant1PID);
|
||||
auto p2 = make_private<Remoting::implementation::Peasant>(peasant2PID);
|
||||
|
||||
p1->WindowName(L"one");
|
||||
p2->WindowName(L"two");
|
||||
|
|
|
@ -1077,7 +1077,6 @@ void ConptyRoundtripTests::PassthroughClearAll()
|
|||
}
|
||||
|
||||
auto verifyBuffer = [&](const TextBuffer& tb, const til::rectangle viewport, const bool afterClear = false) {
|
||||
const auto firstRow = viewport.top<short>();
|
||||
const auto width = viewport.width<short>();
|
||||
|
||||
// "~" rows
|
||||
|
@ -1781,7 +1780,6 @@ void ConptyRoundtripTests::ClearHostTrickeryTest()
|
|||
END_TEST_METHOD_PROPERTIES();
|
||||
constexpr int PaintEveryNewline = 0;
|
||||
constexpr int PaintAfterAllNewlines = 1;
|
||||
constexpr int DontPaintAfterNewlines = 2;
|
||||
|
||||
INIT_TEST_PROPERTY(int, paintEachNewline, L"Any of: manually PaintFrame after each newline is emitted, once at the end of all newlines, or not at all");
|
||||
INIT_TEST_PROPERTY(bool, cursorOnNextLine, L"Either leave the cursor on the first line, or place it on the second line of the buffer");
|
||||
|
@ -2562,7 +2560,6 @@ void ConptyRoundtripTests::ResizeRepaintVimExeBuffer()
|
|||
sm.ProcessString(L"BBB");
|
||||
sm.ProcessString(L"\r\n");
|
||||
|
||||
const auto end = 2 * hostView.Height();
|
||||
for (auto i = 2; i < hostView.BottomInclusive(); i++)
|
||||
{
|
||||
// IMPORTANT! The way vim writes these blank lines is as '~' followed by
|
||||
|
@ -2581,10 +2578,6 @@ void ConptyRoundtripTests::ResizeRepaintVimExeBuffer()
|
|||
|
||||
drawVim();
|
||||
|
||||
const auto firstTextLength = TerminalViewWidth - 2;
|
||||
const auto spacesLength = 3;
|
||||
const auto secondTextLength = 1;
|
||||
|
||||
auto verifyBuffer = [&](const TextBuffer& tb, const til::rectangle viewport) {
|
||||
const auto firstRow = viewport.top<short>();
|
||||
const auto width = viewport.width<short>();
|
||||
|
@ -2696,7 +2689,6 @@ void ConptyRoundtripTests::ClsAndClearHostClearsScrollbackTest()
|
|||
}
|
||||
|
||||
auto verifyBuffer = [&](const TextBuffer& tb, const til::rectangle viewport, const bool afterClear = false) {
|
||||
const auto firstRow = viewport.top<short>();
|
||||
const auto width = viewport.width<short>();
|
||||
|
||||
// "~" rows
|
||||
|
@ -2910,8 +2902,6 @@ void ConptyRoundtripTests::ResizeInitializeBufferWithDefaultAttrs()
|
|||
// { static_cast<BYTE>(XTERM_GREEN_ATTR) });
|
||||
terminalGreenAttrs.SetIndexedBackground(XTERM_GREEN_ATTR);
|
||||
|
||||
const size_t width = static_cast<size_t>(TerminalViewWidth);
|
||||
|
||||
// Use an initial ^[[m to start printing with default-on-default
|
||||
sm.ProcessString(L"\x1b[m");
|
||||
|
||||
|
@ -3043,8 +3033,6 @@ void ConptyRoundtripTests::NewLinesAtBottomWithBackground()
|
|||
terminalBlueAttrs.SetIndexedForeground(XTERM_GREEN_ATTR);
|
||||
terminalBlueAttrs.SetIndexedBackground(XTERM_BLUE_ATTR);
|
||||
|
||||
const size_t width = static_cast<size_t>(TerminalViewWidth);
|
||||
|
||||
// We're going to print 4 more rows than the entire height of the viewport,
|
||||
// causing the buffer to circle 4 times. This is 2 extra iterations of the
|
||||
// two lines we're printing per iteration.
|
||||
|
@ -3162,7 +3150,6 @@ void ConptyRoundtripTests::WrapNewLineAtBottom()
|
|||
// timings for the frame affect the results. In this test we'll be printing
|
||||
// a bunch of paired lines. These values control when the PaintFrame calls
|
||||
// will occur:
|
||||
constexpr int DontPaint = 0; // Only paint at the end of all the output
|
||||
constexpr int PaintAfterBothLines = 1; // Paint after each pair of lines is output
|
||||
constexpr int PaintEveryLine = 2; // Paint after each and every line is output.
|
||||
|
||||
|
@ -3343,7 +3330,6 @@ void ConptyRoundtripTests::WrapNewLineAtBottomLikeMSYS()
|
|||
// timings for the frame affect the results. In this test we'll be printing
|
||||
// a bunch of paired lines. These values control when the PaintFrame calls
|
||||
// will occur:
|
||||
constexpr int DontPaint = 0; // Only paint at the end of all the output
|
||||
constexpr int PaintAfterBothLines = 1; // Paint after each pair of lines is output
|
||||
constexpr int PaintEveryLine = 2; // Paint after each and every line is output.
|
||||
|
||||
|
|
|
@ -287,8 +287,6 @@ LRESULT IslandWindow::_OnMoving(const WPARAM /*wParam*/, const LPARAM lParam)
|
|||
|
||||
void IslandWindow::Initialize()
|
||||
{
|
||||
const bool initialized = (_interopWindowHandle != nullptr);
|
||||
|
||||
_source = DesktopWindowXamlSource{};
|
||||
|
||||
auto interop = _source.as<IDesktopWindowXamlSourceNative>();
|
||||
|
|
|
@ -707,8 +707,6 @@ size_t RetrieveNumberOfSpaces(_In_ SHORT sOriginalCursorPositionX,
|
|||
return STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
const size_t OutputBufferSize = buffer.size_bytes();
|
||||
|
||||
if (readHandleState.IsInputPending())
|
||||
{
|
||||
return _ReadPendingInput(inputBuffer,
|
||||
|
|
|
@ -181,7 +181,6 @@ std::deque<std::unique_ptr<KeyEvent>> Microsoft::Console::Interactivity::Synthes
|
|||
UNICODE_NULL,
|
||||
LEFT_ALT_PRESSED));
|
||||
|
||||
const int radix = 10;
|
||||
std::wstring wstr{ wch };
|
||||
const auto convertedChars = ConvertToA(codepage, wstr);
|
||||
if (convertedChars.size() == 1)
|
||||
|
|
|
@ -181,7 +181,6 @@ using namespace Microsoft::Console::Types;
|
|||
|
||||
// First retrieve the new DPI and the current DPI.
|
||||
DWORD const dpiProposed = (WORD)wParam;
|
||||
DWORD const dpiCurrent = g.dpi;
|
||||
|
||||
// Now we need to get what the font size *would be* if we had this new DPI. We need to ask the renderer about that.
|
||||
const FontInfo& fiCurrent = ScreenInfo.GetCurrentFont();
|
||||
|
|
|
@ -163,8 +163,6 @@ VtEngine::VtEngine(_In_ wil::unique_hfile pipe,
|
|||
// - S_OK or suitable HRESULT error from writing pipe.
|
||||
[[nodiscard]] HRESULT VtEngine::_WriteTerminalAscii(const std::wstring_view wstr) noexcept
|
||||
{
|
||||
const size_t cchActual = wstr.length();
|
||||
|
||||
std::string needed;
|
||||
needed.reserve(wstr.size());
|
||||
|
||||
|
|
|
@ -44,10 +44,7 @@ class MathTests
|
|||
|
||||
_RunCases(til::math::truncating, cases);
|
||||
|
||||
const auto fn = []() {
|
||||
const auto v = til::math::details::truncating_t::cast<ptrdiff_t>(NAN);
|
||||
};
|
||||
VERIFY_THROWS_SPECIFIC(fn(), wil::ResultException, [](wil::ResultException& e) { return e.GetErrorCode() == E_ABORT; });
|
||||
VERIFY_THROWS_SPECIFIC(til::math::details::truncating_t::cast<ptrdiff_t>(NAN), wil::ResultException, [](wil::ResultException& e) { return e.GetErrorCode() == E_ABORT; });
|
||||
}
|
||||
|
||||
TEST_METHOD(Ceiling)
|
||||
|
@ -65,10 +62,7 @@ class MathTests
|
|||
|
||||
_RunCases(til::math::ceiling, cases);
|
||||
|
||||
const auto fn = []() {
|
||||
const auto v = til::math::details::ceiling_t::cast<ptrdiff_t>(NAN);
|
||||
};
|
||||
VERIFY_THROWS_SPECIFIC(fn(), wil::ResultException, [](wil::ResultException& e) { return e.GetErrorCode() == E_ABORT; });
|
||||
VERIFY_THROWS_SPECIFIC(til::math::details::ceiling_t::cast<ptrdiff_t>(NAN), wil::ResultException, [](wil::ResultException& e) { return e.GetErrorCode() == E_ABORT; });
|
||||
}
|
||||
|
||||
TEST_METHOD(Flooring)
|
||||
|
@ -86,10 +80,7 @@ class MathTests
|
|||
|
||||
_RunCases(til::math::flooring, cases);
|
||||
|
||||
const auto fn = []() {
|
||||
const auto v = til::math::details::flooring_t::cast<ptrdiff_t>(NAN);
|
||||
};
|
||||
VERIFY_THROWS_SPECIFIC(fn(), wil::ResultException, [](wil::ResultException& e) { return e.GetErrorCode() == E_ABORT; });
|
||||
VERIFY_THROWS_SPECIFIC(til::math::details::flooring_t::cast<ptrdiff_t>(NAN), wil::ResultException, [](wil::ResultException& e) { return e.GetErrorCode() == E_ABORT; });
|
||||
}
|
||||
|
||||
TEST_METHOD(Rounding)
|
||||
|
@ -107,10 +98,7 @@ class MathTests
|
|||
|
||||
_RunCases(til::math::rounding, cases);
|
||||
|
||||
const auto fn = []() {
|
||||
const auto v = til::math::details::rounding_t::cast<ptrdiff_t>(NAN);
|
||||
};
|
||||
VERIFY_THROWS_SPECIFIC(fn(), wil::ResultException, [](wil::ResultException& e) { return e.GetErrorCode() == E_ABORT; });
|
||||
VERIFY_THROWS_SPECIFIC(til::math::details::rounding_t::cast<ptrdiff_t>(NAN), wil::ResultException, [](wil::ResultException& e) { return e.GetErrorCode() == E_ABORT; });
|
||||
}
|
||||
|
||||
TEST_METHOD(NormalIntegers)
|
||||
|
|
|
@ -765,7 +765,6 @@ class PointTests
|
|||
|
||||
Log::Comment(L"4.) Division by zero");
|
||||
{
|
||||
constexpr ptrdiff_t bigSize = std::numeric_limits<ptrdiff_t>().max();
|
||||
const til::point pt{ 1, 1 };
|
||||
const int scale = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue