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}
diff --git a/webrtc/api/BUILD.gn b/webrtc/api/BUILD.gn
index 10850d4..b063513 100644
--- a/webrtc/api/BUILD.gn
+++ b/webrtc/api/BUILD.gn
@@ -360,7 +360,6 @@
if (!is_win) {
cflags = [ "-Wno-sign-compare" ]
- cflags_cc = [ "-Wno-overloaded-virtual" ]
}
}
diff --git a/webrtc/api/peerconnection_unittest.cc b/webrtc/api/peerconnection_unittest.cc
index 422d37c..3cfffe4 100644
--- a/webrtc/api/peerconnection_unittest.cc
+++ b/webrtc/api/peerconnection_unittest.cc
@@ -188,6 +188,13 @@
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,
diff --git a/webrtc/api/peerconnectionfactory_unittest.cc b/webrtc/api/peerconnectionfactory_unittest.cc
index 2d158e1..9cd74ce 100644
--- a/webrtc/api/peerconnectionfactory_unittest.cc
+++ b/webrtc/api/peerconnectionfactory_unittest.cc
@@ -63,6 +63,13 @@
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) {}
diff --git a/webrtc/api/peerconnectioninterface_unittest.cc b/webrtc/api/peerconnectioninterface_unittest.cc
index 3f84c3d..be4dc06 100644
--- a/webrtc/api/peerconnectioninterface_unittest.cc
+++ b/webrtc/api/peerconnectioninterface_unittest.cc
@@ -435,6 +435,13 @@
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() {
}
diff --git a/webrtc/api/test/peerconnectiontestwrapper.h b/webrtc/api/test/peerconnectiontestwrapper.h
index c56035d..3cdac49 100644
--- a/webrtc/api/test/peerconnectiontestwrapper.h
+++ b/webrtc/api/test/peerconnectiontestwrapper.h
@@ -24,6 +24,13 @@
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);
diff --git a/webrtc/media/BUILD.gn b/webrtc/media/BUILD.gn
index 16fa090..db9a0d6 100644
--- a/webrtc/media/BUILD.gn
+++ b/webrtc/media/BUILD.gn
@@ -28,7 +28,6 @@
# cannot be on the target directly.
if (!is_win) {
cflags = [ "-Wno-deprecated-declarations" ]
- cflags_cc = [ "-Wno-overloaded-virtual" ]
}
}
@@ -247,7 +246,6 @@
}
if (!is_win) {
cflags = [ "-Wno-sign-compare" ]
- cflags_cc = [ "-Wno-overloaded-virtual" ]
}
}
diff --git a/webrtc/media/media.gyp b/webrtc/media/media.gyp
index 40c3bce..65412ae 100644
--- a/webrtc/media/media.gyp
+++ b/webrtc/media/media.gyp
@@ -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.