Skip to content

Commit

Permalink
Fix a few C++ Warnings, default a bunch of ctors/dtors (#13926)
Browse files Browse the repository at this point in the history
No behavioral changes, just some modernizations like replacing empty methods with default and using _v instead of ::value for some types.
  • Loading branch information
AZero13 authored Oct 12, 2022
1 parent 6033ae6 commit eebea51
Show file tree
Hide file tree
Showing 45 changed files with 61 additions and 117 deletions.
4 changes: 1 addition & 3 deletions src/buffer/out/cursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ Cursor::Cursor(const ULONG ulSize, TextBuffer& parentBuffer) noexcept :
{
}

Cursor::~Cursor()
{
}
Cursor::~Cursor() = default;

til::point Cursor::GetPosition() const noexcept
{
Expand Down
4 changes: 1 addition & 3 deletions src/cascadia/Remoting/Monarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
{
}

Monarch::~Monarch()
{
}
Monarch::~Monarch() = default;

uint64_t Monarch::GetPID()
{
Expand Down
4 changes: 1 addition & 3 deletions src/cascadia/TerminalApp/DebugTapConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ namespace winrt::Microsoft::TerminalApp::implementation
_wrappedConnection = wrappedConnection;
}

DebugTapConnection::~DebugTapConnection()
{
}
DebugTapConnection::~DebugTapConnection() = default;

void DebugTapConnection::Start()
{
Expand Down
4 changes: 1 addition & 3 deletions src/cascadia/TerminalConnection/EchoConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@

namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
{
EchoConnection::EchoConnection() noexcept
{
}
EchoConnection::EchoConnection() noexcept = default;

void EchoConnection::Start() noexcept
{
Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalCore/Terminal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions src/cascadia/TerminalSettingsEditor/PreviewConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 1 addition & 3 deletions src/cascadia/TerminalSettingsModel/Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
4 changes: 1 addition & 3 deletions src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" };

Expand Down
4 changes: 1 addition & 3 deletions src/host/cmdline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ CommandLine::CommandLine() :
{
}

CommandLine::~CommandLine()
{
}
CommandLine::~CommandLine() = default;

CommandLine& CommandLine::Instance()
{
Expand Down
3 changes: 2 additions & 1 deletion src/host/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions src/host/inputBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions src/host/inputKeyInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 1 addition & 3 deletions src/host/readDataDirect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions src/host/readDataRaw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 1 addition & 3 deletions src/host/registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/inc/til/spsc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions src/interactivity/win32/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/inc/IRenderData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
4 changes: 1 addition & 3 deletions src/renderer/inc/IRenderEngine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions src/server/ConDrvDeviceComm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 1 addition & 3 deletions src/server/ProcessPolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/terminal/adapter/ITermDispatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,5 +157,5 @@ class Microsoft::Console::VirtualTerminal::ITermDispatch

virtual bool PlaySounds(const VTParameters parameters) = 0; // DECPS
};
inline Microsoft::Console::VirtualTerminal::ITermDispatch::~ITermDispatch() {}
inline Microsoft::Console::VirtualTerminal::ITermDispatch::~ITermDispatch() = default;
#pragma warning(pop)
4 changes: 1 addition & 3 deletions src/terminal/adapter/ut_adapter/adapterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,7 @@ class TestGetSet final : public ITerminalApi
_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';
Expand Down
2 changes: 1 addition & 1 deletion src/terminal/parser/IStateMachineEngine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ namespace Microsoft::Console::VirtualTerminal
IStateMachineEngine() = default;
};

inline IStateMachineEngine::~IStateMachineEngine() {}
inline IStateMachineEngine::~IStateMachineEngine() = default;
}
10 changes: 5 additions & 5 deletions src/terminal/parser/ft_fuzzer/fuzzing_directed.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -301,8 +301,8 @@ namespace fuzz
}

private:
CFuzzChance() {}
virtual ~CFuzzChance() {}
CFuzzChance() = default;
virtual ~CFuzzChance() = default;
static std::random_device m_rd;
};

Expand All @@ -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
Expand Down
4 changes: 1 addition & 3 deletions src/tsf/ConsoleTSF.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ class CConsoleTSF final :
{
}

virtual ~CConsoleTSF()
{
}
virtual ~CConsoleTSF() = default;
[[nodiscard]] HRESULT Initialize();
void Uninitialize();

Expand Down
8 changes: 2 additions & 6 deletions src/tsf/TfCatUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,9 @@ Revision History:
//
//----------------------------------------------------------------------------

CicCategoryMgr::CicCategoryMgr()
{
}
CicCategoryMgr::CicCategoryMgr() = default;

CicCategoryMgr::~CicCategoryMgr()
{
}
CicCategoryMgr::~CicCategoryMgr() = default;

//+---------------------------------------------------------------------------
//
Expand Down
8 changes: 2 additions & 6 deletions src/tsf/TfDispAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,9 @@ Revision History:
//
//----------------------------------------------------------------------------

CicDisplayAttributeMgr::CicDisplayAttributeMgr()
{
}
CicDisplayAttributeMgr::CicDisplayAttributeMgr() = default;

CicDisplayAttributeMgr::~CicDisplayAttributeMgr()
{
}
CicDisplayAttributeMgr::~CicDisplayAttributeMgr() = default;

//+---------------------------------------------------------------------------
//
Expand Down
8 changes: 4 additions & 4 deletions src/tsf/TfEditSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class CEditSessionObject : public ITfEditSession
public:
CEditSessionObject() :
m_cRef(1) {}
virtual ~CEditSessionObject(){};
virtual ~CEditSessionObject() = default;

public:
//
Expand Down Expand Up @@ -150,7 +150,7 @@ class CEditSessionObject : public ITfEditSession
class CEditSessionCompositionComplete : public CEditSessionObject
{
public:
CEditSessionCompositionComplete() {}
CEditSessionCompositionComplete() = default;

[[nodiscard]] HRESULT _DoEditSession(TfEditCookie ec)
{
Expand All @@ -169,7 +169,7 @@ class CEditSessionCompositionComplete : public CEditSessionObject
class CEditSessionCompositionCleanup : public CEditSessionObject
{
public:
CEditSessionCompositionCleanup() {}
CEditSessionCompositionCleanup() = default;

[[nodiscard]] HRESULT _DoEditSession(TfEditCookie ec)
{
Expand All @@ -188,7 +188,7 @@ class CEditSessionCompositionCleanup : public CEditSessionObject
class CEditSessionUpdateCompositionString : public CEditSessionObject
{
public:
CEditSessionUpdateCompositionString() {}
CEditSessionUpdateCompositionString() = default;

[[nodiscard]] HRESULT _DoEditSession(TfEditCookie ec)
{
Expand Down
4 changes: 1 addition & 3 deletions src/types/FocusEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
#include "precomp.h"
#include "inc/IInputEvent.hpp"

FocusEvent::~FocusEvent()
{
}
FocusEvent::~FocusEvent() = default;

INPUT_RECORD FocusEvent::ToInputRecord() const noexcept
{
Expand Down
2 changes: 1 addition & 1 deletion src/types/IBaseData.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion src/types/IControlAccessibilityInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ namespace Microsoft::Console::Types
IControlAccessibilityInfo& operator=(IControlAccessibilityInfo&&) = default;
};

inline IControlAccessibilityInfo::~IControlAccessibilityInfo() {}
inline IControlAccessibilityInfo::~IControlAccessibilityInfo() = default;
}
2 changes: 1 addition & 1 deletion src/types/IUiaData.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Loading

0 comments on commit eebea51

Please sign in to comment.