Skip to content

Commit

Permalink
tidy: Replace default special member functions with the =default keyw…
Browse files Browse the repository at this point in the history
…ord.

Clang-tidy pointed out a number of places where a structure
constructors, destructors, and copy functions were identical to what
the compiler would generate.  Marking these function as "=default"
allows the compiler more optimization chances.  Changes made by
clang-tidy.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-equals-default.html
  • Loading branch information
linuxdude42 committed Dec 18, 2019
1 parent 7a41a97 commit 3f5eb36
Show file tree
Hide file tree
Showing 45 changed files with 77 additions and 191 deletions.
4 changes: 2 additions & 2 deletions mythplugins/mythmusic/mythmusic/cddb.h
Expand Up @@ -21,7 +21,7 @@ struct Cddb
QString artist;
QString title;

Match() {}
Match() = default;
Match(const char *g, discid_t d, const char *a, const char *t) :
discGenre(g), discID(d), artist(a), title(t)
{}
Expand All @@ -41,7 +41,7 @@ struct Cddb
using match_t = QVector< Match >;
match_t matches;

Matches() {}
Matches() = default;
};

struct Msf
Expand Down
15 changes: 2 additions & 13 deletions mythplugins/mythweather/mythweather/weatherUtils.h
Expand Up @@ -26,8 +26,7 @@ class TypeListInfo
{
public:

TypeListInfo(const TypeListInfo& info)
: m_name(info.m_name), m_location(info.m_location), m_src(info.m_src) {}
TypeListInfo(const TypeListInfo& info) = default;
explicit TypeListInfo(const QString &_name)
: m_name(_name) {}
TypeListInfo(const QString &_name, const QString &_location)
Expand All @@ -47,17 +46,7 @@ class ScreenListInfo
{
public:
ScreenListInfo() = default;
ScreenListInfo(const ScreenListInfo& info) :
m_name(info.m_name),
m_title(info.m_title),
m_types(info.m_types),
m_dataTypes(info.m_dataTypes),
m_helptxt(info.m_helptxt),
m_sources(info.m_sources),
m_units(info.m_units),
m_hasUnits(info.m_hasUnits),
m_multiLoc(info.m_multiLoc),
m_updating(info.m_updating) {}
ScreenListInfo(const ScreenListInfo& info) = default;

TypeListInfo GetCurrentTypeList(void) const;

Expand Down
6 changes: 2 additions & 4 deletions mythtv/external/libmythsoundtouch/FIFOSamplePipe.h
Expand Up @@ -109,7 +109,7 @@ class FIFOSamplePipe
virtual void clear() = 0;

/// Destructor to shut gcc 4 up
virtual ~FIFOSamplePipe() {}
virtual ~FIFOSamplePipe() = default;
};


Expand Down Expand Up @@ -154,9 +154,7 @@ class FIFOProcessor :public FIFOSamplePipe


/// Destructor.
virtual ~FIFOProcessor()
{
}
virtual ~FIFOProcessor() = default;


/// Returns a pointer to the beginning of the output samples.
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/mythdbparams.h
Expand Up @@ -9,7 +9,7 @@
class MBASE_PUBLIC DatabaseParams
{
public:
DatabaseParams() {}
DatabaseParams() = default;

void LoadDefaults(void);
bool IsValid(const QString &source = QString("Unknown")) const;
Expand Down
14 changes: 7 additions & 7 deletions mythtv/libs/libmythfreemheg/BaseClasses.h
Expand Up @@ -171,7 +171,7 @@ class MHObjectRef
class MHContentRef
{
public:
MHContentRef() {}
MHContentRef() = default;

MHContentRef& operator=(const MHContentRef&) = default;

Expand Down Expand Up @@ -221,7 +221,7 @@ class MHGenericInteger: public MHGenericBase
class MHGenericOctetString: public MHGenericBase
{
public:
MHGenericOctetString() {}
MHGenericOctetString() = default;
void Initialise(MHParseNode *p, MHEngine *engine);
void PrintMe(FILE *fd, int nTabs) const;
void GetValue(MHOctetString &str, MHEngine *engine) const; // Return the value, looking up any indirect ref.
Expand All @@ -232,7 +232,7 @@ class MHGenericOctetString: public MHGenericBase
class MHGenericObjectRef: public MHGenericBase
{
public:
MHGenericObjectRef() {}
MHGenericObjectRef() = default;
void Initialise(MHParseNode *p, MHEngine *engine);
void PrintMe(FILE *fd, int nTabs) const;
void GetValue(MHObjectRef &ref, MHEngine *engine) const; // Return the value, looking up any indirect ref.
Expand All @@ -243,7 +243,7 @@ class MHGenericObjectRef: public MHGenericBase
class MHGenericContentRef: public MHGenericBase
{
public:
MHGenericContentRef() {}
MHGenericContentRef() = default;
void Initialise(MHParseNode *p, MHEngine *engine);
void PrintMe(FILE *fd, int nTabs) const;
void GetValue(MHContentRef &ref, MHEngine *engine) const; // Return the value, looking up any indirect ref.
Expand All @@ -255,7 +255,7 @@ class MHGenericContentRef: public MHGenericBase
class MHParameter
{
public:
MHParameter() {}
MHParameter() = default;
void Initialise(MHParseNode *p, MHEngine *engine);
void PrintMe(FILE *fd, int nTabs) const;
MHObjectRef *GetReference(); // Get an indirect reference.
Expand Down Expand Up @@ -306,7 +306,7 @@ class MHUnion
class MHFontBody {
// A font body can either be a string or an object reference
public:
MHFontBody() {}
MHFontBody() = default;
void Initialise(MHParseNode *p, MHEngine *engine);
void PrintMe(FILE *fd, int nTabs) const;
bool IsSet() const { return m_DirFont.Size() != 0 || m_IndirFont.IsSet(); }
Expand All @@ -319,7 +319,7 @@ class MHFontBody {
// This is used only in DynamicLineArt
class MHPointArg {
public:
MHPointArg() {}
MHPointArg() = default;
void Initialise(MHParseNode *p, MHEngine *engine);
void PrintMe(FILE *fd, int nTabs) const;
MHGenericInteger m_x, m_y;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythfreemheg/Engine.h
Expand Up @@ -53,7 +53,7 @@ class MHAsynchEvent {
// the code so for the moment we do.
class MHPSEntry {
public:
MHPSEntry() {}
MHPSEntry() = default;
MHOctetString m_FileName;
MHOwnPtrSequence <MHUnion> m_Data;
};
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythfreemheg/ParseBinary.h
Expand Up @@ -33,7 +33,7 @@ class MHParseBinary: public MHParseBase
public:
MHParseBinary(QByteArray &program)
: m_data(program) {}
virtual ~MHParseBinary() {}
virtual ~MHParseBinary() = default;

// Parse the binary and return a pointer to the parse tree
MHParseNode *Parse() override // MHParseBase
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythfreemheg/Presentable.h
Expand Up @@ -35,7 +35,7 @@ class MHPresentable : public MHIngredient
{
public:
MHPresentable() = default;
MHPresentable(const MHPresentable &ref): MHIngredient(ref) {}
MHPresentable(const MHPresentable &ref) = default;
// No new components.

// Actions.
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythfreemheg/Root.h
Expand Up @@ -43,9 +43,9 @@ enum EventType { EventIsAvailable = 1, EventContentAvailable, EventIsDeleted, Ev
class MHRoot
{
public:
MHRoot() {}
MHRoot() = default;
MHRoot(const MHRoot &/*ref*/) {}
virtual ~MHRoot() {}
virtual ~MHRoot() = default;
// Initialise - set up the item from the parse tree.
virtual void Initialise(MHParseNode *p, MHEngine *engine); // Set this up from the parse tree.
// Print this item.
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythfreemheg/TokenGroup.h
Expand Up @@ -39,7 +39,7 @@ class MHEngine;
class MHTokenGroupItem
{
public:
MHTokenGroupItem() {}
MHTokenGroupItem() = default;
void Initialise(MHParseNode *p, MHEngine *engine);
void PrintMe(FILE *fd, int nTabs) const;
MHObjectRef m_Object;
Expand Down
10 changes: 5 additions & 5 deletions mythtv/libs/libmythfreemheg/Variables.h
Expand Up @@ -31,8 +31,8 @@
class MHVariable : public MHIngredient
{
public:
MHVariable() {}
virtual ~MHVariable() {}
MHVariable() = default;
virtual ~MHVariable() = default;

// Internal behaviours.
void Activation(MHEngine *engine) override; // MHRoot
Expand Down Expand Up @@ -86,7 +86,7 @@ class MHIntegerVar : public MHVariable
class MHOctetStrVar : public MHVariable
{
public:
MHOctetStrVar() {}
MHOctetStrVar() = default;
const char *ClassName() override // MHRoot
{ return "OctetStringVariable"; }
void Initialise(MHParseNode *p, MHEngine *engine) override; // MHIngredient
Expand All @@ -107,7 +107,7 @@ class MHOctetStrVar : public MHVariable
class MHObjectRefVar : public MHVariable
{
public:
MHObjectRefVar() {}
MHObjectRefVar() = default;
const char *ClassName() override // MHRoot
{ return "ObjectRefVariable"; }
void Initialise(MHParseNode *p, MHEngine *engine) override; // MHIngredient
Expand All @@ -128,7 +128,7 @@ class MHObjectRefVar : public MHVariable
class MHContentRefVar : public MHVariable
{
public:
MHContentRefVar() {}
MHContentRefVar() = default;
const char *ClassName() override // MHRoot
{ return "ContentRefVariable"; }
void Initialise(MHParseNode *p, MHEngine *engine) override; // MHIngredient
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythfreemheg/Visible.h
Expand Up @@ -121,8 +121,8 @@ class MHLineArt : public MHVisible
class MHRectangle : public MHLineArt
{
public:
MHRectangle() {}
MHRectangle(const MHRectangle &ref): MHLineArt(ref) {}
MHRectangle() = default;
MHRectangle(const MHRectangle &ref) = default;
const char *ClassName() override // MHLineArt
{ return "Rectangle"; }
void PrintMe(FILE *fd, int nTabs) const override; // MHLineArt
Expand Down
10 changes: 5 additions & 5 deletions mythtv/libs/libmythfreemheg/freemheg.h
Expand Up @@ -48,7 +48,7 @@ extern void MHSetLogging(FILE *logStream, unsigned int logLevel);
class MHEG
{
public:
virtual ~MHEG() {}
virtual ~MHEG() = default;
virtual void SetBooting() = 0;
virtual void DrawDisplay(QRegion toDraw) = 0;
// Run synchronous actions and process any asynchronous events until the queues are empty.
Expand Down Expand Up @@ -92,7 +92,7 @@ class MHRgba
class MHContext
{
public:
virtual ~MHContext() {} // Declared to avoid warnings
virtual ~MHContext() = default; // Declared to avoid warnings
// Interface to MHEG engine.

// Test for an object in the carousel. Returns true if the object is present and
Expand Down Expand Up @@ -168,7 +168,7 @@ class MHContext
class MHDLADisplay
{
public:
virtual ~MHDLADisplay() {}
virtual ~MHDLADisplay() = default;
// Draw the completed drawing onto the display.
virtual void Draw(int x, int y) = 0;
// Set the box size. Also clears the drawing.
Expand All @@ -188,7 +188,7 @@ class MHDLADisplay

class MHTextDisplay {
public:
virtual ~MHTextDisplay() {}
virtual ~MHTextDisplay() = default;
// Draw the completed drawing onto the display. x and y give the position of the image
// relative to the screen. rect gives the bounding box for the image, again relative to
// the screen.
Expand All @@ -205,7 +205,7 @@ class MHTextDisplay {
class MHBitmapDisplay
{
public:
virtual ~MHBitmapDisplay() {}
virtual ~MHBitmapDisplay() = default;
// Draw the completed drawing onto the display. x and y give the position of the image
// relative to the screen. rect gives the bounding box for the image, again relative to
// the screen.
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/avformatwriter.h
Expand Up @@ -16,7 +16,7 @@ extern "C" {
class MTV_PUBLIC AVFormatWriter : public FileWriterBase
{
public:
AVFormatWriter() {};
AVFormatWriter() = default;;
~AVFormatWriter();

bool Init(void) override; // FileWriterBase
Expand Down
3 changes: 1 addition & 2 deletions mythtv/libs/libmythtv/cc608reader.h
Expand Up @@ -17,8 +17,7 @@ class CC608Text
public:
CC608Text(const QString &T, int X, int Y) :
m_text(T), m_x(X), m_y(Y) {}
CC608Text(const CC608Text &other) :
m_text(other.m_text), m_x(other.m_x), m_y(other.m_y) {}
CC608Text(const CC608Text &other) = default;
QString m_text;
int m_x;
int m_y;
Expand Down
3 changes: 1 addition & 2 deletions mythtv/libs/libmythtv/channelgroup.h
Expand Up @@ -15,8 +15,7 @@ using namespace std;
class MTV_PUBLIC ChannelGroupItem
{
public:
ChannelGroupItem(const ChannelGroupItem &other) :
m_grpId(other.m_grpId), m_name(other.m_name) {}
ChannelGroupItem(const ChannelGroupItem &other) = default;
ChannelGroupItem(const uint grpid, const QString &name) :
m_grpId(grpid), m_name(name) {}

Expand Down
30 changes: 3 additions & 27 deletions mythtv/libs/libmythtv/inputinfo.h
Expand Up @@ -23,41 +23,17 @@ class MTV_PUBLIC InputInfo
m_chanId(_chanid),
m_liveTvOrder(_livetvorder) {}

InputInfo(const InputInfo &other) :
m_name(other.m_name),
m_sourceId(other.m_sourceId),
m_inputId(other.m_inputId),
m_mplexId(other.m_mplexId),
m_chanId(other.m_chanId),
m_displayName(other.m_displayName),
m_recPriority(other.m_recPriority),
m_scheduleOrder(other.m_scheduleOrder),
m_liveTvOrder(other.m_liveTvOrder),
m_quickTune(other.m_quickTune) {}
virtual ~InputInfo() = default;

InputInfo &operator=(const InputInfo &other)
{
m_name = other.m_name;
m_sourceId = other.m_sourceId;
m_inputId = other.m_inputId;
m_mplexId = other.m_mplexId;
m_chanId = other.m_chanId;
m_displayName = other.m_displayName;
m_recPriority = other.m_recPriority;
m_scheduleOrder = other.m_scheduleOrder;
m_liveTvOrder = other.m_liveTvOrder;
m_quickTune = other.m_quickTune;
return *this;
}
InputInfo(const InputInfo &other) = default;
InputInfo &operator=(const InputInfo &other) = default;

bool operator == (uint inputid) const
{ return m_inputId == inputid; }

bool operator == (const QString &name) const
{ return m_name == name; }

virtual ~InputInfo() = default;

virtual bool FromStringList(QStringList::const_iterator &it,
const QStringList::const_iterator& end);
virtual void ToStringList(QStringList &list) const;
Expand Down
15 changes: 2 additions & 13 deletions mythtv/libs/libmythtv/mheg/dsmcccache.h
Expand Up @@ -31,24 +31,13 @@ class DSMCCCacheReference
{
public:
DSMCCCacheReference() = default;

DSMCCCacheReference(unsigned long car, unsigned short m,
unsigned short s, const DSMCCCacheKey &k) :
m_nCarouselId(car), m_nModuleId(m),
m_nStreamTag(s), m_key(k) {}

DSMCCCacheReference(const DSMCCCacheReference &r) :
m_nCarouselId(r.m_nCarouselId), m_nModuleId(r.m_nModuleId),
m_nStreamTag(r.m_nStreamTag), m_key(r.m_key) {}

DSMCCCacheReference& operator=(const DSMCCCacheReference &rhs)
{
m_nCarouselId = rhs.m_nCarouselId;
m_nModuleId = rhs.m_nModuleId;
m_nStreamTag = rhs.m_nStreamTag;
m_key = rhs.m_key;
return *this;
}
DSMCCCacheReference(const DSMCCCacheReference &r) = default;
DSMCCCacheReference& operator=(const DSMCCCacheReference &rhs) = default;

bool Equal(const DSMCCCacheReference &r) const;
bool Equal(const DSMCCCacheReference *p) const;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/mpeg/mpegstreamdata.h
Expand Up @@ -63,7 +63,7 @@ enum CryptStatus
class MTV_PUBLIC CryptInfo
{
public:
CryptInfo() { }
CryptInfo() = default;
CryptInfo(uint e, uint d) : m_encryptedMin(e), m_decryptedMin(d) { }

public:
Expand Down

0 comments on commit 3f5eb36

Please sign in to comment.