From 3fe372dbee7d3c9ba7a58fd87c8df2e85decd73a Mon Sep 17 00:00:00 2001 From: Henrik Kjellander Date: Thu, 12 May 2016 08:10:52 +0200 Subject: [PATCH] Fix all -Wnon-virtual-dtor warnings. This is needed to get the GN build going for several parts of the code tree. BUG=webrtc:3307 NOTRY=True R=henrika@webrtc.org, nisse@webrtc.org Review URL: https://codereview.webrtc.org/1928653005 . Cr-Commit-Position: refs/heads/master@{#12693} --- webrtc/api/api.gyp | 2 -- webrtc/api/api_tests.gyp | 1 - webrtc/api/peerconnectionfactory_unittest.cc | 1 + webrtc/api/peerconnectioninterface_unittest.cc | 2 +- webrtc/api/webrtcsession_unittest.cc | 2 ++ webrtc/base/BUILD.gn | 7 ------- webrtc/base/base.gyp | 6 ------ webrtc/libjingle/xmpp/xmpp.gyp | 6 ------ webrtc/media/base/codec.h | 7 ++++--- webrtc/media/base/mediachannel.h | 1 + webrtc/media/engine/webrtcvideoengine2.h | 4 +++- webrtc/media/media.gyp | 7 ------- webrtc/p2p/base/turnserver.h | 1 + webrtc/p2p/p2p.gyp | 12 ------------ webrtc/pc/pc.gyp | 10 ---------- 15 files changed, 13 insertions(+), 56 deletions(-) diff --git a/webrtc/api/api.gyp b/webrtc/api/api.gyp index e705831b0a..377ef8f70b 100644 --- a/webrtc/api/api.gyp +++ b/webrtc/api/api.gyp @@ -66,7 +66,6 @@ '-Wextra', ], 'cflags_cc!': [ - '-Wnon-virtual-dtor', '-Woverloaded-virtual', ], 'msvs_disabled_warnings': [ @@ -207,7 +206,6 @@ '-Wno-sign-compare', ], 'cflags_cc!': [ - '-Wnon-virtual-dtor', '-Woverloaded-virtual', ], 'conditions': [ diff --git a/webrtc/api/api_tests.gyp b/webrtc/api/api_tests.gyp index 44344201c6..65bb461474 100644 --- a/webrtc/api/api_tests.gyp +++ b/webrtc/api/api_tests.gyp @@ -72,7 +72,6 @@ '-Wextra', ], 'cflags_cc!': [ - '-Wnon-virtual-dtor', '-Woverloaded-virtual', ], 'msvs_disabled_warnings': [ diff --git a/webrtc/api/peerconnectionfactory_unittest.cc b/webrtc/api/peerconnectionfactory_unittest.cc index e7859d0081..833242a240 100644 --- a/webrtc/api/peerconnectionfactory_unittest.cc +++ b/webrtc/api/peerconnectionfactory_unittest.cc @@ -64,6 +64,7 @@ static const char kTurnIceServerWithIPv6Address[] = class NullPeerConnectionObserver : public PeerConnectionObserver { public: + virtual ~NullPeerConnectionObserver() = default; virtual void OnMessage(const std::string& msg) {} virtual void OnSignalingMessage(const std::string& msg) {} virtual void OnSignalingChange( diff --git a/webrtc/api/peerconnectioninterface_unittest.cc b/webrtc/api/peerconnectioninterface_unittest.cc index 2594b6c106..1386e8c210 100644 --- a/webrtc/api/peerconnectioninterface_unittest.cc +++ b/webrtc/api/peerconnectioninterface_unittest.cc @@ -416,7 +416,7 @@ class MockTrackObserver : public ObserverInterface { class MockPeerConnectionObserver : public PeerConnectionObserver { public: MockPeerConnectionObserver() : remote_streams_(StreamCollection::Create()) {} - ~MockPeerConnectionObserver() { + virtual ~MockPeerConnectionObserver() { } void SetPeerConnectionInterface(PeerConnectionInterface* pc) { pc_ = pc; diff --git a/webrtc/api/webrtcsession_unittest.cc b/webrtc/api/webrtcsession_unittest.cc index 87481a8795..45ffc36c2e 100644 --- a/webrtc/api/webrtcsession_unittest.cc +++ b/webrtc/api/webrtcsession_unittest.cc @@ -158,6 +158,8 @@ class MockIceObserver : public webrtc::IceObserver { ice_gathering_state_(PeerConnectionInterface::kIceGatheringNew) { } + virtual ~MockIceObserver() = default; + void OnIceConnectionChange( PeerConnectionInterface::IceConnectionState new_state) override { ice_connection_state_ = new_state; diff --git a/webrtc/base/BUILD.gn b/webrtc/base/BUILD.gn index 63c2da533e..cd7e5b51e5 100644 --- a/webrtc/base/BUILD.gn +++ b/webrtc/base/BUILD.gn @@ -28,12 +28,6 @@ config("rtc_base_config") { "FEATURE_ENABLE_SSL", "LOGGING=1", ] - - if (is_posix) { - # TODO(henrike): issue 3307, make rtc_base build without disabling - # these flags. - cflags_cc = [ "-Wno-non-virtual-dtor" ] - } } config("rtc_base_chromium_config") { @@ -470,7 +464,6 @@ static_library("rtc_base") { configs += [ "//build/config/compiler:no_chromium_code" ] if (!is_win) { cflags += [ "-Wno-uninitialized" ] - cflags_cc += [ "-Wno-non-virtual-dtor" ] } if (rtc_build_ssl) { diff --git a/webrtc/base/base.gyp b/webrtc/base/base.gyp index 74b029c1f7..9cf936a57b 100644 --- a/webrtc/base/base.gyp +++ b/webrtc/base/base.gyp @@ -288,13 +288,7 @@ '-Wextra', '-Wall', ], - 'cflags_cc!': [ - '-Wnon-virtual-dtor', - ], 'direct_dependent_settings': { - 'cflags_cc!': [ - '-Wnon-virtual-dtor', - ], 'defines': [ 'FEATURE_ENABLE_SSL', 'SSL_USE_OPENSSL', diff --git a/webrtc/libjingle/xmpp/xmpp.gyp b/webrtc/libjingle/xmpp/xmpp.gyp index 4dc75f7b52..37b75122b4 100644 --- a/webrtc/libjingle/xmpp/xmpp.gyp +++ b/webrtc/libjingle/xmpp/xmpp.gyp @@ -19,9 +19,6 @@ 'defines': [ 'FEATURE_ENABLE_SSL', ], - 'cflags_cc!': [ - '-Wnon-virtual-dtor', - ], 'sources': [ 'asyncsocket.h', 'chatroommodule.h', @@ -98,9 +95,6 @@ 'xmppthread.h', ], 'direct_dependent_settings': { - 'cflags_cc!': [ - '-Wnon-virtual-dtor', - ], 'defines': [ 'FEATURE_ENABLE_SSL', 'FEATURE_ENABLE_VOICEMAIL', diff --git a/webrtc/media/base/codec.h b/webrtc/media/base/codec.h index c16158ffb2..76a623a0de 100644 --- a/webrtc/media/base/codec.h +++ b/webrtc/media/base/codec.h @@ -73,7 +73,7 @@ struct Codec { // Creates an empty codec. Codec(); Codec(const Codec& c); - ~Codec(); + virtual ~Codec(); // Indicates if this codec is compatible with the specified codec. bool Matches(const Codec& codec) const; @@ -120,7 +120,7 @@ struct AudioCodec : public Codec { // Creates an empty codec. AudioCodec(); AudioCodec(const AudioCodec& c); - ~AudioCodec() = default; + virtual ~AudioCodec() = default; // Indicates if this codec is compatible with the specified codec. bool Matches(const AudioCodec& codec) const; @@ -153,7 +153,7 @@ struct VideoCodec : public Codec { // Creates an empty codec. VideoCodec(); VideoCodec(const VideoCodec& c); - ~VideoCodec() = default; + virtual ~VideoCodec() = default; std::string ToString() const; @@ -186,6 +186,7 @@ struct DataCodec : public Codec { DataCodec(int id, const std::string& name); DataCodec(); DataCodec(const DataCodec& c); + virtual ~DataCodec() = default; DataCodec& operator=(const DataCodec& c); diff --git a/webrtc/media/base/mediachannel.h b/webrtc/media/base/mediachannel.h index 7c054b6f3a..2472dd10cc 100644 --- a/webrtc/media/base/mediachannel.h +++ b/webrtc/media/base/mediachannel.h @@ -841,6 +841,7 @@ struct RtpParameters { std::vector extensions; // TODO(pthatcher): Add streams. RtcpParameters rtcp; + virtual ~RtpParameters() = default; }; // TODO(deadbeef): Rename to RtpSenderParameters, since they're intended to diff --git a/webrtc/media/engine/webrtcvideoengine2.h b/webrtc/media/engine/webrtcvideoengine2.h index 5c84a79b53..e9b96f951e 100644 --- a/webrtc/media/engine/webrtcvideoengine2.h +++ b/webrtc/media/engine/webrtcvideoengine2.h @@ -74,6 +74,7 @@ class UnsignalledSsrcHandler { }; virtual Action OnUnsignalledSsrc(WebRtcVideoChannel2* channel, uint32_t ssrc) = 0; + virtual ~UnsignalledSsrcHandler() = default; }; // TODO(pbos): Remove, use external handlers only. @@ -86,6 +87,7 @@ class DefaultUnsignalledSsrcHandler : public UnsignalledSsrcHandler { rtc::VideoSinkInterface* GetDefaultSink() const; void SetDefaultSink(VideoMediaChannel* channel, rtc::VideoSinkInterface* sink); + virtual ~DefaultUnsignalledSsrcHandler() = default; private: uint32_t default_recv_ssrc_; @@ -96,7 +98,7 @@ class DefaultUnsignalledSsrcHandler : public UnsignalledSsrcHandler { class WebRtcVideoEngine2 { public: WebRtcVideoEngine2(); - ~WebRtcVideoEngine2(); + virtual ~WebRtcVideoEngine2(); // Basic video engine implementation. void Init(); diff --git a/webrtc/media/media.gyp b/webrtc/media/media.gyp index 230d33ab38..deb730a85a 100644 --- a/webrtc/media/media.gyp +++ b/webrtc/media/media.gyp @@ -107,7 +107,6 @@ '-Wextra', ], 'cflags_cc!': [ - '-Wnon-virtual-dtor', '-Woverloaded-virtual', ], 'msvs_disabled_warnings': [ @@ -248,11 +247,6 @@ 'engine/fakewebrtcvideoengine.h', 'engine/fakewebrtcvoiceengine.h', ], - # TODO(kjellander): Make the code compile without disabling these flags. - # See https://bugs.chromium.org/p/webrtc/issues/detail?id=3307 - 'cflags_cc!': [ - '-Wnon-virtual-dtor', - ], }, # target rtc_unittest_main { 'target_name': 'rtc_media_unittests', @@ -291,7 +285,6 @@ '-Wno-sign-compare', ], 'cflags_cc!': [ - '-Wnon-virtual-dtor', '-Woverloaded-virtual', ], 'msvs_disabled_warnings': [ diff --git a/webrtc/p2p/base/turnserver.h b/webrtc/p2p/base/turnserver.h index c9eb803d65..2bc3650f09 100644 --- a/webrtc/p2p/base/turnserver.h +++ b/webrtc/p2p/base/turnserver.h @@ -144,6 +144,7 @@ class TurnAuthInterface { // Return true if the given username and realm are valid, or false if not. virtual bool GetKey(const std::string& username, const std::string& realm, std::string* key) = 0; + virtual ~TurnAuthInterface() = default; }; // An interface enables Turn Server to control redirection behavior. diff --git a/webrtc/p2p/p2p.gyp b/webrtc/p2p/p2p.gyp index 50941c8682..a15fa52bb5 100644 --- a/webrtc/p2p/p2p.gyp +++ b/webrtc/p2p/p2p.gyp @@ -16,9 +16,6 @@ '<(webrtc_root)/base/base.gyp:rtc_base', '<(webrtc_root)/common.gyp:webrtc_common', ], - 'cflags_cc!': [ - '-Wnon-virtual-dtor', - ], 'sources': [ 'base/asyncstuntcpsocket.cc', 'base/asyncstuntcpsocket.h', @@ -84,9 +81,6 @@ 'client/socketmonitor.h', ], 'direct_dependent_settings': { - 'cflags_cc!': [ - '-Wnon-virtual-dtor', - ], 'defines': [ 'FEATURE_ENABLE_VOICEMAIL', ], @@ -127,9 +121,6 @@ '<(webrtc_root)/base/base.gyp:rtc_base', '<(webrtc_root)/common.gyp:webrtc_common', ], - 'cflags_cc!': [ - '-Wnon-virtual-dtor', - ], 'sources': [ 'stunprober/stunprober.cc', ], @@ -141,9 +132,6 @@ 'libstunprober', 'rtc_p2p' ], - 'cflags_cc!': [ - '-Wnon-virtual-dtor', - ], 'sources': [ 'stunprober/main.cc', ], diff --git a/webrtc/pc/pc.gyp b/webrtc/pc/pc.gyp index b07f7b7263..25ebc5de78 100755 --- a/webrtc/pc/pc.gyp +++ b/webrtc/pc/pc.gyp @@ -33,11 +33,6 @@ 'defines': [ '<@(rtc_pc_defines)', ], - # TODO(kjellander): Make the code compile without disabling these flags. - # See https://bugs.chromium.org/p/webrtc/issues/detail?id=3307 - 'cflags_cc!': [ - '-Wnon-virtual-dtor', - ], 'include_dirs': [ '<(DEPTH)/testing/gtest/include', ], @@ -97,11 +92,6 @@ 'rtcpmuxfilter_unittest.cc', 'srtpfilter_unittest.cc', ], - # TODO(kjellander): Make the code compile without disabling these flags. - # See https://bugs.chromium.org/p/webrtc/issues/detail?id=3307 - 'cflags_cc!': [ - '-Wnon-virtual-dtor', - ], 'conditions': [ ['clang==0', { 'cflags': [