Fix warnings in MessagePage.cpp

/retroshare-gui/src/gui/settings/MessagePage.cpp:62:19: warning:
deleting object of polymorphic class type 'Rs::Msgs::MsgTagType' which
has non-virtual destructor might cause undefined behavior [-Wdelete-non-
virtual-dtor]
/retroshare-gui/src/gui/settings/MessagePage.cpp:62: warning: delete
called on non-final 'Rs::Msgs::MsgTagType' that has virtual functions
but non-virtual destructor
/retroshare-gui/src/gui/settings/MessagePage.cpp:86: warning: use of
old-style cast
/retroshare-gui/src/gui/settings/MessagePage.cpp:172: warning: zero as
null pointer constant
/retroshare-gui/src/gui/settings/MessagePage.cpp:176: warning: implicit
conversion changes signedness: 'int' to 'uint32_t' (aka 'unsigned int')
/retroshare-gui/src/gui/settings/MessagePage.cpp:203: warning: zero as
null pointer constant
/retroshare-gui/src/gui/settings/MessagePage.cpp:207: warning: implicit
conversion changes signedness: 'int' to 'uint32_t' (aka 'unsigned int')
/retroshare-gui/src/gui/settings/MessagePage.cpp:261: warning: implicit
conversion changes signedness: 'int' to 'uint32_t' (aka 'unsigned int')

/libretroshare/src/retroshare/rsmsgs.h:168: warning:
'Rs::Msgs::MessageInfo' has virtual functions but non-virtual destructor
/libretroshare/src/retroshare/rsmsgs.h:168: warning: 'MessageInfo' has
no out-of-line virtual method definitions; its vtable will be emitted in
every translation unit
/libretroshare/src/retroshare/rsmsgs.h:234: warning:
'Rs::Msgs::MsgInfoSummary' has virtual functions but non-virtual
destructor
/libretroshare/src/retroshare/rsmsgs.h:234: warning: 'MsgInfoSummary'
has no out-of-line virtual method definitions; its vtable will be
emitted in every translation unit
/libretroshare/src/retroshare/rsmsgs.h:261: warning:
'Rs::Msgs::MsgTagInfo' has virtual functions but non-virtual destructor
/libretroshare/src/retroshare/rsmsgs.h:328: warning: 'ChatId' has
virtual functions but non-virtual destructor
/libretroshare/src/retroshare/rsmsgs.h:400: warning: 'ChatLobbyInvite'
has virtual functions but non-virtual destructor
/libretroshare/src/retroshare/rsmsgs.h:420: warning:
'VisibleChatLobbyRecord' has virtual functions but non-virtual
destructor
/libretroshare/src/retroshare/rsmsgs.h:420: warning:
'VisibleChatLobbyRecord' has no out-of-line virtual method definitions;
its vtable will be emitted in every translation unit
/libretroshare/src/retroshare/rsmsgs.h:449: warning: 'ChatLobbyInfo' has
virtual functions but non-virtual destructor
/libretroshare/src/retroshare/rsmsgs.h:486: warning: 'RsMsgs' has no
out-of-line virtual method definitions; its vtable will be emitted in
every translation unit

About vtable:
https://stackoverflow.com/questions/23746941/what-is-the-meaning-of-
clangs-wweak-vtables
https://stackoverflow.com/questions/50463374/avoid-weak-vtable-warnings-
for-classes-only-defined-in-a-source-file
This commit is contained in:
Phenom 2018-10-13 15:50:14 +02:00
parent a30e2c3400
commit 358f27be06
2 changed files with 25 additions and 15 deletions

View file

@ -167,8 +167,10 @@ class MessageInfo_v2
struct MessageInfo : RsSerializable
{
MessageInfo(): msgflags(0), size(0), count(0), ts(0) {}
std::string msgId;
MessageInfo(): msgflags(0), size(0), count(0), ts(0) {}
virtual ~MessageInfo() = default;
std::string msgId;
RsPeerId rspeerid_srcId;
RsGxsId rsgxsid_srcId;
@ -230,10 +232,10 @@ struct MessageInfo : RsSerializable
}
};
struct MsgInfoSummary : RsSerializable
{
MsgInfoSummary() : msgflags(0), count(0), ts(0) {}
virtual ~MsgInfoSummary() = default;
std::string msgId;
RsPeerId srcId;
@ -260,6 +262,8 @@ struct MsgInfoSummary : RsSerializable
struct MsgTagInfo : RsSerializable
{
virtual ~MsgTagInfo() = default;
std::string msgId;
std::list<uint32_t> tagIds;
@ -272,6 +276,7 @@ struct MsgTagInfo : RsSerializable
struct MsgTagType : RsSerializable
{
virtual ~MsgTagType() = default;
/* map containing tagId -> pair (text, rgb color) */
std::map<uint32_t, std::pair<std::string, uint32_t> > types;
@ -326,7 +331,9 @@ struct DistantChatPeerInfo
class ChatId : RsSerializable
{
public:
ChatId();
ChatId();
virtual ~ChatId() = default;
explicit ChatId(RsPeerId id);
explicit ChatId(ChatLobbyId id);
explicit ChatId(DistantChatPeerId id);
@ -398,6 +405,8 @@ public:
class ChatLobbyInvite : RsSerializable
{
public:
virtual ~ChatLobbyInvite() = default;
ChatLobbyId lobby_id ;
RsPeerId peer_id ;
std::string lobby_name ;
@ -418,7 +427,8 @@ public:
class VisibleChatLobbyRecord : RsSerializable
{
public:
VisibleChatLobbyRecord(): lobby_id(0), total_number_of_peers(0), last_report_time(0){}
VisibleChatLobbyRecord(): lobby_id(0), total_number_of_peers(0), last_report_time(0){}
virtual ~VisibleChatLobbyRecord() = default;
ChatLobbyId lobby_id ; // unique id of the lobby
std::string lobby_name ; // name to use for this lobby
@ -443,10 +453,11 @@ public:
}
};
class ChatLobbyInfo : RsSerializable
{
public:
virtual ~ChatLobbyInfo() = default;
ChatLobbyId lobby_id ; // unique id of the lobby
std::string lobby_name ; // name to use for this lobby
std::string lobby_topic ; // topic to use for this lobby
@ -486,7 +497,7 @@ class RsMsgs
public:
RsMsgs() {}
virtual ~RsMsgs() {}
virtual ~RsMsgs() = default;
/****************************************/
/* Message Items */
@ -896,6 +907,5 @@ virtual bool closeDistantChatConnexion(const DistantChatPeerId& pid)=0;
};
#endif