mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-25 02:01:28 -05:00
Fix a few C++ Warnings, default a bunch of ctors/dtors (#13926)
No behavioral changes, just some modernizations like replacing empty methods with default and using _v instead of ::value for some types.
This commit is contained in:
@@ -29,9 +29,7 @@ Cursor::Cursor(const ULONG ulSize, TextBuffer& parentBuffer) noexcept :
|
||||
{
|
||||
}
|
||||
|
||||
Cursor::~Cursor()
|
||||
{
|
||||
}
|
||||
Cursor::~Cursor() = default;
|
||||
|
||||
til::point Cursor::GetPosition() const noexcept
|
||||
{
|
||||
|
||||
@@ -38,9 +38,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
||||
{
|
||||
}
|
||||
|
||||
Monarch::~Monarch()
|
||||
{
|
||||
}
|
||||
Monarch::~Monarch() = default;
|
||||
|
||||
uint64_t Monarch::GetPID()
|
||||
{
|
||||
|
||||
@@ -66,9 +66,7 @@ namespace winrt::Microsoft::TerminalApp::implementation
|
||||
_wrappedConnection = wrappedConnection;
|
||||
}
|
||||
|
||||
DebugTapConnection::~DebugTapConnection()
|
||||
{
|
||||
}
|
||||
DebugTapConnection::~DebugTapConnection() = default;
|
||||
|
||||
void DebugTapConnection::Start()
|
||||
{
|
||||
|
||||
@@ -9,9 +9,7 @@
|
||||
|
||||
namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
{
|
||||
EchoConnection::EchoConnection() noexcept
|
||||
{
|
||||
}
|
||||
EchoConnection::EchoConnection() noexcept = default;
|
||||
|
||||
void EchoConnection::Start() noexcept
|
||||
{
|
||||
|
||||
@@ -64,7 +64,7 @@ class Microsoft::Terminal::Core::Terminal final :
|
||||
|
||||
public:
|
||||
Terminal();
|
||||
~Terminal(){};
|
||||
~Terminal() = default;
|
||||
Terminal(const Terminal&) = default;
|
||||
Terminal(Terminal&&) = default;
|
||||
Terminal& operator=(const Terminal&) = default;
|
||||
|
||||
@@ -12,9 +12,7 @@ static constexpr std::wstring_view PreviewText{ L"Windows Terminal\r\nCopyright
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
{
|
||||
PreviewConnection::PreviewConnection() noexcept
|
||||
{
|
||||
}
|
||||
PreviewConnection::PreviewConnection() noexcept = default;
|
||||
|
||||
void PreviewConnection::Start() noexcept
|
||||
{
|
||||
|
||||
@@ -34,9 +34,7 @@ static constexpr std::string_view SchemeNameToken{ "${scheme.name}" };
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
{
|
||||
Command::Command()
|
||||
{
|
||||
}
|
||||
Command::Command() = default;
|
||||
|
||||
com_ptr<Command> Command::Copy() const
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model
|
||||
class IDynamicProfileGenerator
|
||||
{
|
||||
public:
|
||||
virtual ~IDynamicProfileGenerator(){};
|
||||
virtual ~IDynamicProfileGenerator() = default;
|
||||
virtual std::wstring_view GetNamespace() const noexcept = 0;
|
||||
virtual void GenerateProfiles(std::vector<winrt::com_ptr<implementation::Profile>>& profiles) const = 0;
|
||||
};
|
||||
|
||||
@@ -26,9 +26,7 @@ NonClientIslandWindow::NonClientIslandWindow(const ElementTheme& requestedTheme)
|
||||
{
|
||||
}
|
||||
|
||||
NonClientIslandWindow::~NonClientIslandWindow()
|
||||
{
|
||||
}
|
||||
NonClientIslandWindow::~NonClientIslandWindow() = default;
|
||||
|
||||
static constexpr const wchar_t* dragBarClassName{ L"DRAG_BAR_WINDOW_CLASS" };
|
||||
|
||||
|
||||
@@ -96,9 +96,7 @@ CommandLine::CommandLine() :
|
||||
{
|
||||
}
|
||||
|
||||
CommandLine::~CommandLine()
|
||||
{
|
||||
}
|
||||
CommandLine::~CommandLine() = default;
|
||||
|
||||
CommandLine& CommandLine::Instance()
|
||||
{
|
||||
|
||||
@@ -44,8 +44,9 @@ BOOL IsSystemKey(const WORD wVirtualKeyCode)
|
||||
case VK_NUMLOCK:
|
||||
case VK_SCROLL:
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ULONG GetControlKeyState(const LPARAM lParam)
|
||||
|
||||
@@ -41,9 +41,7 @@ InputBuffer::InputBuffer() :
|
||||
// Arguments:
|
||||
// - None
|
||||
// Return Value:
|
||||
InputBuffer::~InputBuffer()
|
||||
{
|
||||
}
|
||||
InputBuffer::~InputBuffer() = default;
|
||||
|
||||
// Routine Description:
|
||||
// - checks if any partial char data is available for reading operation
|
||||
|
||||
@@ -11,9 +11,7 @@ INPUT_KEY_INFO::INPUT_KEY_INFO(const WORD wVirtualKeyCode, const ULONG ulControl
|
||||
{
|
||||
}
|
||||
|
||||
INPUT_KEY_INFO::~INPUT_KEY_INFO()
|
||||
{
|
||||
}
|
||||
INPUT_KEY_INFO::~INPUT_KEY_INFO() = default;
|
||||
|
||||
// Routine Description:
|
||||
// - Gets the keyboard virtual key that was pressed.
|
||||
|
||||
@@ -36,9 +36,7 @@ DirectReadData::DirectReadData(_In_ InputBuffer* const pInputBuffer,
|
||||
// Routine Description:
|
||||
// - Destructs a read data class.
|
||||
// - Decrements count of readers waiting on the given handle.
|
||||
DirectReadData::~DirectReadData()
|
||||
{
|
||||
}
|
||||
DirectReadData::~DirectReadData() = default;
|
||||
|
||||
// Routine Description:
|
||||
// - This routine is called to complete a direct read that blocked in
|
||||
|
||||
@@ -38,9 +38,7 @@ RAW_READ_DATA::RAW_READ_DATA(_In_ InputBuffer* const pInputBuffer,
|
||||
// Routine Description:
|
||||
// - Destructs a read data class.
|
||||
// - Decrements count of readers waiting on the given handle.
|
||||
RAW_READ_DATA::~RAW_READ_DATA()
|
||||
{
|
||||
}
|
||||
RAW_READ_DATA::~RAW_READ_DATA() = default;
|
||||
|
||||
// Routine Description:
|
||||
// - This routine is called to complete a raw read that blocked in ReadInputBuffer.
|
||||
|
||||
@@ -21,9 +21,7 @@ Registry::Registry(_In_ Settings* const pSettings) :
|
||||
{
|
||||
}
|
||||
|
||||
Registry::~Registry()
|
||||
{
|
||||
}
|
||||
Registry::~Registry() = default;
|
||||
|
||||
// Routine Description:
|
||||
// - Reads extended edit keys and related registry information into the global state.
|
||||
|
||||
@@ -305,7 +305,7 @@ namespace til::spsc
|
||||
}
|
||||
|
||||
// NOTE: waitMask MUST be either 0 (consumer) or revolution_flag (producer).
|
||||
acquisition acquire(atomic_size_type& mine, atomic_size_type& theirs, size_type waitMask, size_type slots, bool blocking) noexcept
|
||||
acquisition acquire(const atomic_size_type& mine, const atomic_size_type& theirs, size_type waitMask, size_type slots, bool blocking) const noexcept
|
||||
{
|
||||
size_type myPos = mine.load(std::memory_order_relaxed);
|
||||
size_type theirPos;
|
||||
|
||||
@@ -132,9 +132,7 @@ Menu* Menu::Instance()
|
||||
return Menu::s_Instance;
|
||||
}
|
||||
|
||||
Menu::~Menu()
|
||||
{
|
||||
}
|
||||
Menu::~Menu() = default;
|
||||
|
||||
// Routine Description:
|
||||
// - this initializes the system menu when a WM_INITMENU message is read.
|
||||
|
||||
@@ -69,5 +69,5 @@ namespace Microsoft::Console::Render
|
||||
};
|
||||
|
||||
// See docs/virtual-dtors.md for an explanation of why this is weird.
|
||||
inline IRenderData::~IRenderData() {}
|
||||
inline IRenderData::~IRenderData() = default;
|
||||
}
|
||||
|
||||
@@ -50,9 +50,7 @@ namespace Microsoft::Console::Render
|
||||
using GridLineSet = til::enumset<GridLines>;
|
||||
|
||||
#pragma warning(suppress : 26432) // If you define or delete any default operation in the type '...', define or delete them all (c.21).
|
||||
virtual ~IRenderEngine()
|
||||
{
|
||||
}
|
||||
virtual ~IRenderEngine() = default;
|
||||
|
||||
[[nodiscard]] virtual HRESULT StartPaint() noexcept = 0;
|
||||
[[nodiscard]] virtual HRESULT EndPaint() noexcept = 0;
|
||||
|
||||
@@ -10,9 +10,7 @@ ConDrvDeviceComm::ConDrvDeviceComm(_In_ HANDLE Server) :
|
||||
THROW_HR_IF(E_HANDLE, Server == INVALID_HANDLE_VALUE);
|
||||
}
|
||||
|
||||
ConDrvDeviceComm::~ConDrvDeviceComm()
|
||||
{
|
||||
}
|
||||
ConDrvDeviceComm::~ConDrvDeviceComm() = default;
|
||||
|
||||
// Routine Description:
|
||||
// - Needs to be called once per server session and typically as the absolute first operation.
|
||||
|
||||
@@ -20,9 +20,7 @@ ConsoleProcessPolicy::ConsoleProcessPolicy(const bool fCanReadOutputBuffer,
|
||||
|
||||
// Routine Description:
|
||||
// - Destructs an instance of the process policy class.
|
||||
ConsoleProcessPolicy::~ConsoleProcessPolicy()
|
||||
{
|
||||
}
|
||||
ConsoleProcessPolicy::~ConsoleProcessPolicy() = default;
|
||||
|
||||
// Routine Description:
|
||||
// - Opens the process token for the given handle and resolves the application model policies
|
||||
|
||||
@@ -157,5 +157,5 @@ public:
|
||||
|
||||
virtual bool PlaySounds(const VTParameters parameters) = 0; // DECPS
|
||||
};
|
||||
inline Microsoft::Console::VirtualTerminal::ITermDispatch::~ITermDispatch() {}
|
||||
inline Microsoft::Console::VirtualTerminal::ITermDispatch::~ITermDispatch() = default;
|
||||
#pragma warning(pop)
|
||||
|
||||
@@ -355,9 +355,7 @@ public:
|
||||
_expectedScrollRegion.Bottom = (bottom > 0) ? rect->Bottom - 1 : rect->Bottom;
|
||||
}
|
||||
|
||||
~TestGetSet()
|
||||
{
|
||||
}
|
||||
~TestGetSet() = default;
|
||||
|
||||
static const WCHAR s_wchErase = (WCHAR)0x20;
|
||||
static const WCHAR s_wchDefault = L'Z';
|
||||
|
||||
@@ -54,5 +54,5 @@ namespace Microsoft::Console::VirtualTerminal
|
||||
IStateMachineEngine() = default;
|
||||
};
|
||||
|
||||
inline IStateMachineEngine::~IStateMachineEngine() {}
|
||||
inline IStateMachineEngine::~IStateMachineEngine() = default;
|
||||
}
|
||||
|
||||
@@ -215,8 +215,8 @@ namespace fuzz
|
||||
class CFuzzRangeException
|
||||
{
|
||||
public:
|
||||
CFuzzRangeException(){};
|
||||
virtual ~CFuzzRangeException(){};
|
||||
CFuzzRangeException() = default;
|
||||
virtual ~CFuzzRangeException() = default;
|
||||
};
|
||||
|
||||
// In an effort to avoid fuzzing code from scattering rand() throughout
|
||||
@@ -301,8 +301,8 @@ namespace fuzz
|
||||
}
|
||||
|
||||
private:
|
||||
CFuzzChance() {}
|
||||
virtual ~CFuzzChance() {}
|
||||
CFuzzChance() = default;
|
||||
virtual ~CFuzzChance() = default;
|
||||
static std::random_device m_rd;
|
||||
};
|
||||
|
||||
@@ -317,7 +317,7 @@ namespace fuzz
|
||||
CFuzzBase() :
|
||||
m_fFuzzed(FALSE),
|
||||
m_iPercentageTotal(100){};
|
||||
virtual ~CFuzzBase(){};
|
||||
virtual ~CFuzzBase() = default;
|
||||
|
||||
// Converts a percentage into a valid range. Note that riTotal
|
||||
// is a reference value, which allows for a running total to be
|
||||
|
||||
@@ -43,9 +43,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~CConsoleTSF()
|
||||
{
|
||||
}
|
||||
virtual ~CConsoleTSF() = default;
|
||||
[[nodiscard]] HRESULT Initialize();
|
||||
void Uninitialize();
|
||||
|
||||
|
||||
@@ -29,13 +29,9 @@ Notes:
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
CicCategoryMgr::CicCategoryMgr()
|
||||
{
|
||||
}
|
||||
CicCategoryMgr::CicCategoryMgr() = default;
|
||||
|
||||
CicCategoryMgr::~CicCategoryMgr()
|
||||
{
|
||||
}
|
||||
CicCategoryMgr::~CicCategoryMgr() = default;
|
||||
|
||||
//+---------------------------------------------------------------------------
|
||||
//
|
||||
|
||||
@@ -29,13 +29,9 @@ Notes:
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
CicDisplayAttributeMgr::CicDisplayAttributeMgr()
|
||||
{
|
||||
}
|
||||
CicDisplayAttributeMgr::CicDisplayAttributeMgr() = default;
|
||||
|
||||
CicDisplayAttributeMgr::~CicDisplayAttributeMgr()
|
||||
{
|
||||
}
|
||||
CicDisplayAttributeMgr::~CicDisplayAttributeMgr() = default;
|
||||
|
||||
//+---------------------------------------------------------------------------
|
||||
//
|
||||
|
||||
@@ -43,7 +43,7 @@ class CEditSessionObject : public ITfEditSession
|
||||
public:
|
||||
CEditSessionObject() :
|
||||
m_cRef(1) {}
|
||||
virtual ~CEditSessionObject(){};
|
||||
virtual ~CEditSessionObject() = default;
|
||||
|
||||
public:
|
||||
//
|
||||
@@ -150,7 +150,7 @@ private:
|
||||
class CEditSessionCompositionComplete : public CEditSessionObject
|
||||
{
|
||||
public:
|
||||
CEditSessionCompositionComplete() {}
|
||||
CEditSessionCompositionComplete() = default;
|
||||
|
||||
[[nodiscard]] HRESULT _DoEditSession(TfEditCookie ec)
|
||||
{
|
||||
@@ -169,7 +169,7 @@ public:
|
||||
class CEditSessionCompositionCleanup : public CEditSessionObject
|
||||
{
|
||||
public:
|
||||
CEditSessionCompositionCleanup() {}
|
||||
CEditSessionCompositionCleanup() = default;
|
||||
|
||||
[[nodiscard]] HRESULT _DoEditSession(TfEditCookie ec)
|
||||
{
|
||||
@@ -188,7 +188,7 @@ public:
|
||||
class CEditSessionUpdateCompositionString : public CEditSessionObject
|
||||
{
|
||||
public:
|
||||
CEditSessionUpdateCompositionString() {}
|
||||
CEditSessionUpdateCompositionString() = default;
|
||||
|
||||
[[nodiscard]] HRESULT _DoEditSession(TfEditCookie ec)
|
||||
{
|
||||
|
||||
@@ -17,9 +17,7 @@
|
||||
#include "precomp.h"
|
||||
#include "inc/IInputEvent.hpp"
|
||||
|
||||
FocusEvent::~FocusEvent()
|
||||
{
|
||||
}
|
||||
FocusEvent::~FocusEvent() = default;
|
||||
|
||||
INPUT_RECORD FocusEvent::ToInputRecord() const noexcept
|
||||
{
|
||||
|
||||
@@ -46,5 +46,5 @@ namespace Microsoft::Console::Types
|
||||
};
|
||||
|
||||
// See docs/virtual-dtors.md for an explanation of why this is weird.
|
||||
inline IBaseData::~IBaseData() {}
|
||||
inline IBaseData::~IBaseData() = default;
|
||||
}
|
||||
|
||||
@@ -39,5 +39,5 @@ namespace Microsoft::Console::Types
|
||||
IControlAccessibilityInfo& operator=(IControlAccessibilityInfo&&) = default;
|
||||
};
|
||||
|
||||
inline IControlAccessibilityInfo::~IControlAccessibilityInfo() {}
|
||||
inline IControlAccessibilityInfo::~IControlAccessibilityInfo() = default;
|
||||
}
|
||||
|
||||
@@ -45,5 +45,5 @@ namespace Microsoft::Console::Types
|
||||
};
|
||||
|
||||
// See docs/virtual-dtors.md for an explanation of why this is weird.
|
||||
inline IUiaData::~IUiaData() {}
|
||||
inline IUiaData::~IUiaData() = default;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace Microsoft::Console::Types
|
||||
class IUiaEventDispatcher
|
||||
{
|
||||
public:
|
||||
virtual ~IUiaEventDispatcher() = default;
|
||||
virtual void SignalSelectionChanged() = 0;
|
||||
virtual void SignalTextChanged() = 0;
|
||||
virtual void SignalCursorChanged() = 0;
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Microsoft::Console::Types
|
||||
class IUiaTraceable
|
||||
{
|
||||
public:
|
||||
const IdType GetId() const noexcept
|
||||
IdType GetId() const noexcept
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
@@ -4,13 +4,11 @@
|
||||
#include "precomp.h"
|
||||
#include "inc/IInputEvent.hpp"
|
||||
|
||||
KeyEvent::~KeyEvent()
|
||||
{
|
||||
}
|
||||
KeyEvent::~KeyEvent() = default;
|
||||
|
||||
INPUT_RECORD KeyEvent::ToInputRecord() const noexcept
|
||||
{
|
||||
INPUT_RECORD record{ 0 };
|
||||
INPUT_RECORD record{};
|
||||
record.EventType = KEY_EVENT;
|
||||
record.Event.KeyEvent.bKeyDown = !!_keyDown;
|
||||
record.Event.KeyEvent.wRepeatCount = _repeatCount;
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
#include "precomp.h"
|
||||
#include "inc/IInputEvent.hpp"
|
||||
|
||||
MenuEvent::~MenuEvent()
|
||||
{
|
||||
}
|
||||
MenuEvent::~MenuEvent() = default;
|
||||
|
||||
INPUT_RECORD MenuEvent::ToInputRecord() const noexcept
|
||||
{
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
#include "precomp.h"
|
||||
#include "inc/IInputEvent.hpp"
|
||||
|
||||
MouseEvent::~MouseEvent()
|
||||
{
|
||||
}
|
||||
MouseEvent::~MouseEvent() = default;
|
||||
|
||||
INPUT_RECORD MouseEvent::ToInputRecord() const noexcept
|
||||
{
|
||||
|
||||
@@ -135,17 +135,17 @@ IFACEMETHODIMP TermControlUiaProvider::get_FragmentRoot(_COM_Outptr_result_maybe
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
const til::size TermControlUiaProvider::GetFontSize() const noexcept
|
||||
til::size TermControlUiaProvider::GetFontSize() const noexcept
|
||||
{
|
||||
return _controlInfo->GetFontSize();
|
||||
}
|
||||
|
||||
const til::rect TermControlUiaProvider::GetPadding() const noexcept
|
||||
til::rect TermControlUiaProvider::GetPadding() const noexcept
|
||||
{
|
||||
return _controlInfo->GetPadding();
|
||||
}
|
||||
|
||||
const double TermControlUiaProvider::GetScaleFactor() const noexcept
|
||||
double TermControlUiaProvider::GetScaleFactor() const noexcept
|
||||
{
|
||||
return _controlInfo->GetScaleFactor();
|
||||
}
|
||||
|
||||
@@ -43,9 +43,9 @@ namespace Microsoft::Terminal
|
||||
IFACEMETHODIMP get_BoundingRectangle(_Out_ UiaRect* pRect) noexcept override;
|
||||
IFACEMETHODIMP get_FragmentRoot(_COM_Outptr_result_maybenull_ IRawElementProviderFragmentRoot** ppProvider) noexcept override;
|
||||
|
||||
const til::size GetFontSize() const noexcept;
|
||||
const til::rect GetPadding() const noexcept;
|
||||
const double GetScaleFactor() const noexcept;
|
||||
til::size GetFontSize() const noexcept;
|
||||
til::rect GetPadding() const noexcept;
|
||||
double GetScaleFactor() const noexcept;
|
||||
void ChangeViewport(const til::inclusive_rect& NewWindow) override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -1249,7 +1249,7 @@ try
|
||||
const auto startScreenInfoRow = _start.Y;
|
||||
const auto endScreenInfoRow = _end.Y;
|
||||
// screen buffer rows
|
||||
const til::CoordType topRow = 0;
|
||||
constexpr til::CoordType topRow = 0;
|
||||
const auto bottomRow = _pData->GetTextBuffer().TotalRowCount() - 1;
|
||||
|
||||
auto newViewport = oldViewport;
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
#include "precomp.h"
|
||||
#include "inc/IInputEvent.hpp"
|
||||
|
||||
WindowBufferSizeEvent::~WindowBufferSizeEvent()
|
||||
{
|
||||
}
|
||||
WindowBufferSizeEvent::~WindowBufferSizeEvent() = default;
|
||||
|
||||
INPUT_RECORD WindowBufferSizeEvent::ToInputRecord() const noexcept
|
||||
{
|
||||
|
||||
@@ -62,9 +62,7 @@ public:
|
||||
#endif
|
||||
};
|
||||
|
||||
inline IInputEvent::~IInputEvent()
|
||||
{
|
||||
}
|
||||
inline IInputEvent::~IInputEvent() = default;
|
||||
|
||||
#ifdef UNIT_TESTING
|
||||
std::wostream& operator<<(std::wostream& stream, const IInputEvent* pEvent);
|
||||
|
||||
@@ -329,9 +329,9 @@ void UtilsTests::TestColorFromXTermColor()
|
||||
|
||||
void UtilsTests::_VerifyXTermColorResult(const std::wstring_view wstr, DWORD colorValue)
|
||||
{
|
||||
auto color = ColorFromXTermColor(wstr);
|
||||
const auto color = ColorFromXTermColor(wstr);
|
||||
VERIFY_IS_TRUE(color.has_value());
|
||||
VERIFY_ARE_EQUAL(colorValue, (COLORREF)color.value());
|
||||
VERIFY_ARE_EQUAL(colorValue, static_cast<COLORREF>(color.value()));
|
||||
}
|
||||
|
||||
void UtilsTests::_VerifyXTermColorInvalid(const std::wstring_view wstr)
|
||||
|
||||
Reference in New Issue
Block a user