WebRTC: Fix and enable -Woverloaded-virtual warnings.

Essentially applying the same change as in
https://codereview.webrtc.org/2023413002 in more locations.

There's only one change affecting production code: enabling the warning
for webrtc/media:rtc_media. The rest are test changes.

With these changes, the only place the warning is disabled is in the Windows
implementation of webrtc/modules/video_capture:video_capture_internal_impl,
which is harder to fix, since it relies on sample code from the Windows SDK.

BUG=webrtc:6653
NOTRY=True

Review-Url: https://codereview.webrtc.org/2468093004
Cr-Commit-Position: refs/heads/master@{#14938}
This commit is contained in:
kjellander 2016-11-07 01:18:08 -08:00 committed by Commit bot
parent 554becd7bf
commit 71a1b61c4f
7 changed files with 28 additions and 6 deletions

View File

@ -360,7 +360,6 @@ if (rtc_include_tests) {
if (!is_win) {
cflags = [ "-Wno-sign-compare" ]
cflags_cc = [ "-Wno-overloaded-virtual" ]
}
}

View File

@ -188,6 +188,13 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver,
public ObserverInterface,
public rtc::MessageHandler {
public:
// We need these using declarations because there are two versions of each of
// the below methods and we only override one of them.
// TODO(deadbeef): Remove once there's only one version of the methods.
using PeerConnectionObserver::OnAddStream;
using PeerConnectionObserver::OnRemoveStream;
using PeerConnectionObserver::OnDataChannel;
// If |config| is not provided, uses a default constructed RTCConfiguration.
static PeerConnectionTestClient* CreateClientWithDtlsIdentityStore(
const std::string& id,

View File

@ -63,6 +63,13 @@ static const char kTurnIceServerWithIPv6Address[] =
class NullPeerConnectionObserver : public PeerConnectionObserver {
public:
// We need these using declarations because there are two versions of each of
// the below methods and we only override one of them.
// TODO(deadbeef): Remove once there's only one version of the methods.
using PeerConnectionObserver::OnAddStream;
using PeerConnectionObserver::OnRemoveStream;
using PeerConnectionObserver::OnDataChannel;
virtual ~NullPeerConnectionObserver() = default;
virtual void OnMessage(const std::string& msg) {}
virtual void OnSignalingMessage(const std::string& msg) {}

View File

@ -435,6 +435,13 @@ class MockTrackObserver : public ObserverInterface {
class MockPeerConnectionObserver : public PeerConnectionObserver {
public:
// We need these using declarations because there are two versions of each of
// the below methods and we only override one of them.
// TODO(deadbeef): Remove once there's only one version of the methods.
using PeerConnectionObserver::OnAddStream;
using PeerConnectionObserver::OnRemoveStream;
using PeerConnectionObserver::OnDataChannel;
MockPeerConnectionObserver() : remote_streams_(StreamCollection::Create()) {}
virtual ~MockPeerConnectionObserver() {
}

View File

@ -24,6 +24,13 @@ class PeerConnectionTestWrapper
public webrtc::CreateSessionDescriptionObserver,
public sigslot::has_slots<> {
public:
// We need these using declarations because there are two versions of each of
// the below methods and we only override one of them.
// TODO(deadbeef): Remove once there's only one version of the methods.
using PeerConnectionObserver::OnAddStream;
using PeerConnectionObserver::OnRemoveStream;
using PeerConnectionObserver::OnDataChannel;
static void Connect(PeerConnectionTestWrapper* caller,
PeerConnectionTestWrapper* callee);

View File

@ -28,7 +28,6 @@ config("rtc_media_warnings_config") {
# cannot be on the target directly.
if (!is_win) {
cflags = [ "-Wno-deprecated-declarations" ]
cflags_cc = [ "-Wno-overloaded-virtual" ]
}
}
@ -247,7 +246,6 @@ if (rtc_include_tests) {
}
if (!is_win) {
cflags = [ "-Wno-sign-compare" ]
cflags_cc = [ "-Wno-overloaded-virtual" ]
}
}

View File

@ -94,9 +94,6 @@
'cflags!': [
'-Wextra',
],
'cflags_cc!': [
'-Woverloaded-virtual',
],
'msvs_disabled_warnings': [
4245, # conversion from 'int' to 'size_t', signed/unsigned mismatch.
4267, # conversion from 'size_t' to 'int', possible loss of data.