Removing warning suppression flags from pc/.
Bug: webrtc:9251
Change-Id: Ic12126fc03309448fe71a17e6b65343949496f4f
Reviewed-on: https://webrtc-review.googlesource.com/86820
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23838}
diff --git a/pc/BUILD.gn b/pc/BUILD.gn
index 084b240..a3ca3ce 100644
--- a/pc/BUILD.gn
+++ b/pc/BUILD.gn
@@ -112,15 +112,6 @@
]
}
-config("libjingle_peerconnection_warnings_config") {
- # GN orders flags on a target before flags from configs. The default config
- # adds these flags so to cancel them out they need to come from a config and
- # cannot be on the target directly.
- if (!is_win && !is_clang) {
- cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
- }
-}
-
rtc_static_library("peerconnection") {
visibility = [ "*" ]
cflags = []
@@ -182,8 +173,6 @@
"webrtcsessiondescriptionfactory.h",
]
- configs += [ ":libjingle_peerconnection_warnings_config" ]
-
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
@@ -249,8 +238,6 @@
"../rtc_base:rtc_base_approved",
]
- configs += [ ":libjingle_peerconnection_warnings_config" ]
-
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
@@ -271,15 +258,6 @@
}
if (rtc_include_tests) {
- config("rtc_pc_unittests_config") {
- # GN orders flags on a target before flags from configs. The default config
- # adds -Wall, and this flag have to be after -Wall -- so they need to
- # come from a config and can't be on the target directly.
- if (!is_win && !is_clang) {
- cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
- }
- }
-
rtc_test("rtc_pc_unittests") {
testonly = true
@@ -301,8 +279,6 @@
include_dirs = [ "//third_party/libsrtp/srtp" ]
- configs += [ ":rtc_pc_unittests_config" ]
-
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
@@ -440,25 +416,6 @@
}
}
- config("peerconnection_unittests_config") {
- # The warnings below are enabled by default. Since GN orders compiler flags
- # for a target before flags from configs, the only way to disable such
- # warnings is by having them in a separate config, loaded from the target.
- # TODO(kjellander): Make the code compile without disabling these flags.
- # See https://bugs.webrtc.org/3307.
- if (is_clang && is_win) {
- cflags = [
- # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6267
- # for -Wno-sign-compare
- "-Wno-sign-compare",
- ]
- }
-
- if (!is_win) {
- cflags = [ "-Wno-sign-compare" ]
- }
- }
-
rtc_test("peerconnection_unittests") {
testonly = true
sources = [
@@ -505,8 +462,6 @@
defines = [ "HAVE_SCTP" ]
}
- configs += [ ":peerconnection_unittests_config" ]
-
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
@@ -562,6 +517,7 @@
"../rtc_base:rtc_base_tests_main",
"../rtc_base:rtc_base_tests_utils",
"../rtc_base:rtc_task_queue",
+ "../rtc_base:safe_conversions",
"../system_wrappers:metrics_default",
"../system_wrappers:runtime_enabled_features_default",
"../test:audio_codec_mocks",
diff --git a/pc/datachannel_unittest.cc b/pc/datachannel_unittest.cc
index 4c044cf..eb5deb9 100644
--- a/pc/datachannel_unittest.cc
+++ b/pc/datachannel_unittest.cc
@@ -15,6 +15,7 @@
#include "pc/sctputils.h"
#include "pc/test/fakedatachannelprovider.h"
#include "rtc_base/gunit.h"
+#include "rtc_base/numerics/safe_conversions.h"
using webrtc::DataChannel;
using webrtc::SctpSidAllocator;
@@ -172,7 +173,8 @@
}
EXPECT_EQ(buffer.data.size() * number_of_packets,
webrtc_data_channel_->buffered_amount());
- EXPECT_EQ(number_of_packets, observer_->on_buffered_amount_change_count());
+ EXPECT_EQ(rtc::checked_cast<size_t>(number_of_packets),
+ observer_->on_buffered_amount_change_count());
}
// Tests that the queued data are sent when the channel transitions from blocked
diff --git a/pc/peerconnection_integrationtest.cc b/pc/peerconnection_integrationtest.cc
index dc0f06f..0bd9066 100644
--- a/pc/peerconnection_integrationtest.cc
+++ b/pc/peerconnection_integrationtest.cc
@@ -60,6 +60,7 @@
#include "rtc_base/fakenetwork.h"
#include "rtc_base/firewallsocketserver.h"
#include "rtc_base/gunit.h"
+#include "rtc_base/numerics/safe_conversions.h"
#include "rtc_base/testcertificateverifier.h"
#include "rtc_base/virtualsocketserver.h"
#include "test/gmock.h"
@@ -1595,8 +1596,8 @@
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
// Should be one receiver each for audio/video.
- EXPECT_EQ(2, caller()->rtp_receiver_observers().size());
- EXPECT_EQ(2, callee()->rtp_receiver_observers().size());
+ EXPECT_EQ(2U, caller()->rtp_receiver_observers().size());
+ EXPECT_EQ(2U, callee()->rtp_receiver_observers().size());
// Wait for all "first packet received" callbacks to be fired.
EXPECT_TRUE_WAIT(
std::all_of(caller()->rtp_receiver_observers().begin(),
@@ -1616,8 +1617,8 @@
// callback should still be invoked.
caller()->ResetRtpReceiverObservers();
callee()->ResetRtpReceiverObservers();
- EXPECT_EQ(2, caller()->rtp_receiver_observers().size());
- EXPECT_EQ(2, callee()->rtp_receiver_observers().size());
+ EXPECT_EQ(2U, caller()->rtp_receiver_observers().size());
+ EXPECT_EQ(2U, callee()->rtp_receiver_observers().size());
EXPECT_TRUE(
std::all_of(caller()->rtp_receiver_observers().begin(),
caller()->rtp_receiver_observers().end(),
@@ -1903,7 +1904,7 @@
// The caller creates a new transceiver to receive video on when receiving
// the offer, but by default it is send only.
auto transceivers = caller()->pc()->GetTransceivers();
- ASSERT_EQ(3, transceivers.size());
+ ASSERT_EQ(3U, transceivers.size());
ASSERT_EQ(cricket::MEDIA_TYPE_VIDEO,
transceivers[2]->receiver()->media_type());
transceivers[2]->sender()->SetTrack(caller()->CreateLocalVideoTrack());
@@ -2590,7 +2591,7 @@
//
// Also, we use "EXPECT_TRUE_WAIT" because the stats collector may decide to
// return cached stats if not enough time has passed since the last update.
- EXPECT_TRUE_WAIT(callee()->OldGetStats()->BytesReceived() > 0U,
+ EXPECT_TRUE_WAIT(callee()->OldGetStats()->BytesReceived() > 0,
kDefaultTimeout);
}
@@ -3209,10 +3210,10 @@
}
// Wait for all messages to be received.
- EXPECT_EQ_WAIT(kNumMessages,
+ EXPECT_EQ_WAIT(rtc::checked_cast<size_t>(kNumMessages),
caller()->data_observer()->received_message_count(),
kDefaultTimeout);
- EXPECT_EQ_WAIT(kNumMessages,
+ EXPECT_EQ_WAIT(rtc::checked_cast<size_t>(kNumMessages),
callee()->data_observer()->received_message_count(),
kDefaultTimeout);
@@ -3517,17 +3518,17 @@
if (TestIPv6()) {
// When IPv6 is enabled, we should prefer an IPv6 connection over an IPv4
// connection.
- EXPECT_EQ(0u, num_best_ipv4);
- EXPECT_EQ(1u, num_best_ipv6);
+ EXPECT_EQ(0, num_best_ipv4);
+ EXPECT_EQ(1, num_best_ipv6);
} else {
- EXPECT_EQ(1u, num_best_ipv4);
- EXPECT_EQ(0u, num_best_ipv6);
+ EXPECT_EQ(1, num_best_ipv4);
+ EXPECT_EQ(0, num_best_ipv6);
}
- EXPECT_EQ(0u, metrics_observer->GetEnumCounter(
+ EXPECT_EQ(0, metrics_observer->GetEnumCounter(
webrtc::kEnumCounterIceCandidatePairTypeUdp,
webrtc::kIceCandidatePairHostHost));
- EXPECT_EQ(1u, metrics_observer->GetEnumCounter(
+ EXPECT_EQ(1, metrics_observer->GetEnumCounter(
webrtc::kEnumCounterIceCandidatePairTypeUdp,
webrtc::kIceCandidatePairHostPublicHostPublic));
}
@@ -3829,7 +3830,7 @@
caller()->AddVideoTrack();
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kMaxWaitForActivationMs);
- ASSERT_EQ(1, callee()->remote_streams()->count());
+ ASSERT_EQ(1U, callee()->remote_streams()->count());
// Echo the stream back, and do a new offer/anwer (initiated by callee this
// time).
diff --git a/pc/peerconnectionendtoend_unittest.cc b/pc/peerconnectionendtoend_unittest.cc
index 6d03110..f9b3dc3 100644
--- a/pc/peerconnectionendtoend_unittest.cc
+++ b/pc/peerconnectionendtoend_unittest.cc
@@ -459,8 +459,8 @@
// the same ID because they were passed to the same PeerConnectionFactory,
// and the second pair got the same ID---but these two IDs are not equal,
// because each PeerConnectionFactory has its own ID.
- EXPECT_EQ(1, encoder_id1.size());
- EXPECT_EQ(1, encoder_id2.size());
+ EXPECT_EQ(1U, encoder_id1.size());
+ EXPECT_EQ(1U, encoder_id2.size());
EXPECT_EQ(encoder_id1, decoder_id1);
EXPECT_EQ(encoder_id2, decoder_id2);
EXPECT_NE(encoder_id1, encoder_id2);
@@ -540,16 +540,16 @@
Negotiate();
WaitForConnection();
- EXPECT_EQ(1U, caller_dc_1->id() % 2);
- EXPECT_EQ(0U, callee_dc_1->id() % 2);
+ EXPECT_EQ(1, caller_dc_1->id() % 2);
+ EXPECT_EQ(0, callee_dc_1->id() % 2);
rtc::scoped_refptr<DataChannelInterface> caller_dc_2(
caller_->CreateDataChannel("data", init));
rtc::scoped_refptr<DataChannelInterface> callee_dc_2(
callee_->CreateDataChannel("data", init));
- EXPECT_EQ(1U, caller_dc_2->id() % 2);
- EXPECT_EQ(0U, callee_dc_2->id() % 2);
+ EXPECT_EQ(1, caller_dc_2->id() % 2);
+ EXPECT_EQ(0, callee_dc_2->id() % 2);
}
// Verifies that the message is received by the right remote DataChannel when
diff --git a/pc/peerconnectioninterface_unittest.cc b/pc/peerconnectioninterface_unittest.cc
index a974316..9b4a9e7 100644
--- a/pc/peerconnectioninterface_unittest.cc
+++ b/pc/peerconnectioninterface_unittest.cc
@@ -3408,13 +3408,13 @@
// Grab the ufrags.
std::vector<std::string> initial_ufrags = GetUfrags(pc_->local_description());
- ASSERT_EQ(2, initial_ufrags.size());
+ ASSERT_EQ(2U, initial_ufrags.size());
// Create offer and grab the new ufrags.
CreateOfferAsLocalDescription();
std::vector<std::string> subsequent_ufrags =
GetUfrags(pc_->local_description());
- ASSERT_EQ(2, subsequent_ufrags.size());
+ ASSERT_EQ(2U, subsequent_ufrags.size());
// Ensure that only the ufrag for the second m= section changed.
EXPECT_EQ(initial_ufrags[0], subsequent_ufrags[0]);
diff --git a/pc/rtcstats_integrationtest.cc b/pc/rtcstats_integrationtest.cc
index f0c1831..355d1f7a8 100644
--- a/pc/rtcstats_integrationtest.cc
+++ b/pc/rtcstats_integrationtest.cc
@@ -343,7 +343,7 @@
bool verify_successful = true;
std::vector<const RTCTransportStats*> transport_stats =
report_->GetStatsOfType<RTCTransportStats>();
- EXPECT_EQ(transport_stats.size(), 1);
+ EXPECT_EQ(transport_stats.size(), 1U);
std::string selected_candidate_pair_id =
*transport_stats[0]->selected_candidate_pair_id;
for (const RTCStats& stats : *report_) {
diff --git a/pc/rtcstatscollector_unittest.cc b/pc/rtcstatscollector_unittest.cc
index 0c4bc03..ea99c8d 100644
--- a/pc/rtcstatscollector_unittest.cc
+++ b/pc/rtcstatscollector_unittest.cc
@@ -110,7 +110,7 @@
std::string IdForType(const RTCStatsReport* report) {
auto stats_of_my_type = report->RTCStatsReport::GetStatsOfType<T>();
// We cannot use ASSERT here, since we're within a function.
- EXPECT_EQ(1, stats_of_my_type.size())
+ EXPECT_EQ(1U, stats_of_my_type.size())
<< "Unexpected number of stats of this type";
if (stats_of_my_type.size() == 1) {
return stats_of_my_type[0]->id();
@@ -1470,9 +1470,9 @@
rtc::scoped_refptr<const RTCStatsReport> report = stats_->GetStatsReport();
auto stats_of_my_type = report->GetStatsOfType<RTCMediaStreamStats>();
- ASSERT_EQ(1, stats_of_my_type.size()) << "No stream in " << report->ToJson();
+ ASSERT_EQ(1U, stats_of_my_type.size()) << "No stream in " << report->ToJson();
auto stats_of_track_type = report->GetStatsOfType<RTCMediaStreamTrackStats>();
- ASSERT_EQ(1, stats_of_track_type.size())
+ ASSERT_EQ(1U, stats_of_track_type.size())
<< "Wrong number of tracks in " << report->ToJson();
RTCMediaStreamStats expected_local_stream(stats_of_my_type[0]->id(),
@@ -1533,9 +1533,9 @@
rtc::scoped_refptr<const RTCStatsReport> report = stats_->GetStatsReport();
auto stats_of_my_type = report->GetStatsOfType<RTCMediaStreamStats>();
- ASSERT_EQ(1, stats_of_my_type.size()) << "No stream in " << report->ToJson();
+ ASSERT_EQ(1U, stats_of_my_type.size()) << "No stream in " << report->ToJson();
auto stats_of_track_type = report->GetStatsOfType<RTCMediaStreamTrackStats>();
- ASSERT_EQ(1, stats_of_track_type.size())
+ ASSERT_EQ(1U, stats_of_track_type.size())
<< "Wrong number of tracks in " << report->ToJson();
ASSERT_TRUE(*(stats_of_track_type[0]->remote_source));
@@ -1598,7 +1598,7 @@
rtc::scoped_refptr<const RTCStatsReport> report = stats_->GetStatsReport();
auto stats_of_track_type = report->GetStatsOfType<RTCMediaStreamTrackStats>();
- ASSERT_EQ(1, stats_of_track_type.size());
+ ASSERT_EQ(1U, stats_of_track_type.size());
RTCInboundRTPStreamStats expected_audio("RTCInboundRTPAudioStream_1",
report->timestamp_us());
@@ -1775,9 +1775,9 @@
rtc::scoped_refptr<const RTCStatsReport> report = stats_->GetStatsReport();
auto stats_of_my_type = report->GetStatsOfType<RTCOutboundRTPStreamStats>();
- ASSERT_EQ(1, stats_of_my_type.size());
+ ASSERT_EQ(1U, stats_of_my_type.size());
auto stats_of_track_type = report->GetStatsOfType<RTCMediaStreamTrackStats>();
- ASSERT_EQ(1, stats_of_track_type.size());
+ ASSERT_EQ(1U, stats_of_track_type.size());
RTCOutboundRTPStreamStats expected_video(stats_of_my_type[0]->id(),
report->timestamp_us());
@@ -2086,11 +2086,11 @@
std::vector<const RTCMediaStreamTrackStats*> track_stats =
report->GetStatsOfType<RTCMediaStreamTrackStats>();
- EXPECT_EQ(1, track_stats.size());
+ EXPECT_EQ(1U, track_stats.size());
std::vector<const RTCRTPStreamStats*> rtp_stream_stats =
report->GetStatsOfType<RTCRTPStreamStats>();
- EXPECT_EQ(0, rtp_stream_stats.size());
+ EXPECT_EQ(0U, rtp_stream_stats.size());
}
TEST_F(RTCStatsCollectorTest, DoNotCrashOnSsrcChange) {
@@ -2106,7 +2106,7 @@
std::vector<const RTCMediaStreamTrackStats*> track_stats =
report->GetStatsOfType<RTCMediaStreamTrackStats>();
- EXPECT_EQ(1, track_stats.size());
+ EXPECT_EQ(1U, track_stats.size());
}
// Used for test below, to test calling GetStatsReport during a callback.
diff --git a/pc/rtpsenderreceiver_unittest.cc b/pc/rtpsenderreceiver_unittest.cc
index 5795ba7..2adc5be 100644
--- a/pc/rtpsenderreceiver_unittest.cc
+++ b/pc/rtpsenderreceiver_unittest.cc
@@ -651,7 +651,7 @@
CreateAudioRtpSender();
RtpParameters params = audio_rtp_sender_->GetParameters();
- EXPECT_NE(params.transaction_id.size(), 0);
+ EXPECT_NE(params.transaction_id.size(), 0U);
auto saved_transaction_id = params.transaction_id;
params = audio_rtp_sender_->GetParameters();
EXPECT_NE(saved_transaction_id, params.transaction_id);
@@ -751,19 +751,19 @@
EXPECT_EQ(-1, voice_media_channel_->max_bps());
webrtc::RtpParameters params = audio_rtp_sender_->GetParameters();
- EXPECT_EQ(1, params.encodings.size());
+ EXPECT_EQ(1U, params.encodings.size());
EXPECT_FALSE(params.encodings[0].max_bitrate_bps);
params.encodings[0].max_bitrate_bps = 1000;
EXPECT_TRUE(audio_rtp_sender_->SetParameters(params).ok());
// Read back the parameters and verify they have been changed.
params = audio_rtp_sender_->GetParameters();
- EXPECT_EQ(1, params.encodings.size());
+ EXPECT_EQ(1U, params.encodings.size());
EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps);
// Verify that the audio channel received the new parameters.
params = voice_media_channel_->GetRtpSendParameters(kAudioSsrc);
- EXPECT_EQ(1, params.encodings.size());
+ EXPECT_EQ(1U, params.encodings.size());
EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps);
// Verify that the global bitrate limit has not been changed.
@@ -776,7 +776,7 @@
CreateAudioRtpSender();
webrtc::RtpParameters params = audio_rtp_sender_->GetParameters();
- EXPECT_EQ(1, params.encodings.size());
+ EXPECT_EQ(1U, params.encodings.size());
EXPECT_EQ(webrtc::kDefaultBitratePriority,
params.encodings[0].bitrate_priority);
double new_bitrate_priority = 2.0;
@@ -784,11 +784,11 @@
EXPECT_TRUE(audio_rtp_sender_->SetParameters(params).ok());
params = audio_rtp_sender_->GetParameters();
- EXPECT_EQ(1, params.encodings.size());
+ EXPECT_EQ(1U, params.encodings.size());
EXPECT_EQ(new_bitrate_priority, params.encodings[0].bitrate_priority);
params = voice_media_channel_->GetRtpSendParameters(kAudioSsrc);
- EXPECT_EQ(1, params.encodings.size());
+ EXPECT_EQ(1U, params.encodings.size());
EXPECT_EQ(new_bitrate_priority, params.encodings[0].bitrate_priority);
DestroyAudioRtpSender();
@@ -843,7 +843,7 @@
CreateVideoRtpSender();
RtpParameters params = video_rtp_sender_->GetParameters();
- EXPECT_NE(params.transaction_id.size(), 0);
+ EXPECT_NE(params.transaction_id.size(), 0U);
auto saved_transaction_id = params.transaction_id;
params = video_rtp_sender_->GetParameters();
EXPECT_NE(saved_transaction_id, params.transaction_id);
@@ -968,7 +968,7 @@
EXPECT_EQ(-1, video_media_channel_->max_bps());
webrtc::RtpParameters params = video_rtp_sender_->GetParameters();
- EXPECT_EQ(1, params.encodings.size());
+ EXPECT_EQ(1U, params.encodings.size());
EXPECT_FALSE(params.encodings[0].min_bitrate_bps);
EXPECT_FALSE(params.encodings[0].max_bitrate_bps);
params.encodings[0].min_bitrate_bps = 100;
@@ -977,13 +977,13 @@
// Read back the parameters and verify they have been changed.
params = video_rtp_sender_->GetParameters();
- EXPECT_EQ(1, params.encodings.size());
+ EXPECT_EQ(1U, params.encodings.size());
EXPECT_EQ(100, params.encodings[0].min_bitrate_bps);
EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps);
// Verify that the video channel received the new parameters.
params = video_media_channel_->GetRtpSendParameters(kVideoSsrc);
- EXPECT_EQ(1, params.encodings.size());
+ EXPECT_EQ(1U, params.encodings.size());
EXPECT_EQ(100, params.encodings[0].min_bitrate_bps);
EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps);
@@ -1025,7 +1025,7 @@
CreateVideoRtpSender();
webrtc::RtpParameters params = video_rtp_sender_->GetParameters();
- EXPECT_EQ(1, params.encodings.size());
+ EXPECT_EQ(1U, params.encodings.size());
EXPECT_EQ(webrtc::kDefaultBitratePriority,
params.encodings[0].bitrate_priority);
double new_bitrate_priority = 2.0;
@@ -1033,11 +1033,11 @@
EXPECT_TRUE(video_rtp_sender_->SetParameters(params).ok());
params = video_rtp_sender_->GetParameters();
- EXPECT_EQ(1, params.encodings.size());
+ EXPECT_EQ(1U, params.encodings.size());
EXPECT_EQ(new_bitrate_priority, params.encodings[0].bitrate_priority);
params = video_media_channel_->GetRtpSendParameters(kVideoSsrc);
- EXPECT_EQ(1, params.encodings.size());
+ EXPECT_EQ(1U, params.encodings.size());
EXPECT_EQ(new_bitrate_priority, params.encodings[0].bitrate_priority);
DestroyVideoRtpSender();
diff --git a/pc/webrtcsdp_unittest.cc b/pc/webrtcsdp_unittest.cc
index e7471af..6800553 100644
--- a/pc/webrtcsdp_unittest.cc
+++ b/pc/webrtcsdp_unittest.cc
@@ -3544,7 +3544,7 @@
SdpDeserialize(kSdpWithIceCredentialsInCandidateString, &jdesc_output));
const IceCandidateCollection* candidates = jdesc_output.candidates(0);
ASSERT_NE(nullptr, candidates);
- ASSERT_EQ(1, candidates->count());
+ ASSERT_EQ(1U, candidates->count());
cricket::Candidate c = candidates->at(0)->candidate();
EXPECT_EQ("ufrag_voice", c.username());
EXPECT_EQ("pwd_voice", c.password());