Fix "control reaches end of non-void function" warnings
"warning: control reaches end of non-void function [-Wreturn-type]"
Reported by gcc (8.3)
In all the reported cases, the end of function is never actually
reached. Add RTC_CHECK(false) to ensure the compiler is aware that
this path is a dead-end.
Bug: webrtc:12008
Change-Id: I7f816fde3d1897ed2774057c7e05da66e1895e60
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/189784
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Fabien VALLÉE <fabien.vallee@netgem.com>
Cr-Commit-Position: refs/heads/master@{#32503}
diff --git a/AUTHORS b/AUTHORS
index c37a03a..74b1fae 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -122,6 +122,7 @@
Microsoft Corporation <*@microsoft.com>
MIPS Technologies <*@mips.com>
Mozilla Foundation <*@mozilla.com>
+Netgem S.A. <*@netgem.com>
NVIDIA Corporation <*@nvidia.com>
Opera Software ASA <*@opera.com>
Optical Tone Ltd <*@opticaltone.com>
diff --git a/api/adaptation/BUILD.gn b/api/adaptation/BUILD.gn
index dc4c737..2cba5f4 100644
--- a/api/adaptation/BUILD.gn
+++ b/api/adaptation/BUILD.gn
@@ -16,6 +16,7 @@
]
deps = [
"../../api:scoped_refptr",
+ "../../rtc_base:checks",
"../../rtc_base:refcount",
"../../rtc_base:rtc_base_approved",
"../../rtc_base/system:rtc_export",
diff --git a/api/adaptation/resource.cc b/api/adaptation/resource.cc
index 0a9c83a..c6a7e32 100644
--- a/api/adaptation/resource.cc
+++ b/api/adaptation/resource.cc
@@ -10,6 +10,8 @@
#include "api/adaptation/resource.h"
+#include "rtc_base/checks.h"
+
namespace webrtc {
const char* ResourceUsageStateToString(ResourceUsageState usage_state) {
@@ -19,6 +21,7 @@
case ResourceUsageState::kUnderuse:
return "kUnderuse";
}
+ RTC_CHECK(false);
}
ResourceListener::~ResourceListener() {}
diff --git a/api/rtp_parameters.cc b/api/rtp_parameters.cc
index 57aa784..f22ed67 100644
--- a/api/rtp_parameters.cc
+++ b/api/rtp_parameters.cc
@@ -30,6 +30,7 @@
case DegradationPreference::BALANCED:
return "balanced";
}
+ RTC_CHECK(false);
}
const double kDefaultBitratePriority = 1.0;
diff --git a/api/video_codecs/video_codec.cc b/api/video_codecs/video_codec.cc
index 490eced..ecc5699 100644
--- a/api/video_codecs/video_codec.cc
+++ b/api/video_codecs/video_codec.cc
@@ -120,6 +120,7 @@
case kVideoCodecGeneric:
return kPayloadNameGeneric;
}
+ RTC_CHECK(false);
}
VideoCodecType PayloadStringToCodecType(const std::string& name) {
diff --git a/api/video_codecs/video_encoder_software_fallback_wrapper.cc b/api/video_codecs/video_encoder_software_fallback_wrapper.cc
index 54f4731..bb97d30 100644
--- a/api/video_codecs/video_encoder_software_fallback_wrapper.cc
+++ b/api/video_codecs/video_encoder_software_fallback_wrapper.cc
@@ -162,6 +162,7 @@
case EncoderState::kForcedFallback:
return fallback_encoder_.get();
}
+ RTC_CHECK(false);
}
// Updates encoder with last observed parameters, such as callbacks, rates,
@@ -345,7 +346,9 @@
case EncoderState::kForcedFallback:
return fallback_encoder_->Encode(frame, frame_types);
}
+ RTC_CHECK(false);
}
+
int32_t VideoEncoderSoftwareFallbackWrapper::EncodeWithMainEncoder(
const VideoFrame& frame,
const std::vector<VideoFrameType>* frame_types) {
diff --git a/call/adaptation/video_stream_adapter.cc b/call/adaptation/video_stream_adapter.cc
index 272fb6d..b79d217 100644
--- a/call/adaptation/video_stream_adapter.cc
+++ b/call/adaptation/video_stream_adapter.cc
@@ -162,6 +162,7 @@
case Status::kRejectedByConstraint:
return "kRejectedByConstraint";
}
+ RTC_CHECK(false);
}
Adaptation::Adaptation(int validation_id,
@@ -381,6 +382,7 @@
case DegradationPreference::DISABLED:
return Adaptation::Status::kAdaptationDisabled;
}
+ RTC_CHECK(false);
}
Adaptation VideoStreamAdapter::GetAdaptationDown() {
@@ -460,6 +462,7 @@
case DegradationPreference::DISABLED:
return Adaptation::Status::kAdaptationDisabled;
}
+ RTC_CHECK(false);
}
VideoStreamAdapter::RestrictionsOrState VideoStreamAdapter::DecreaseResolution(
@@ -597,9 +600,8 @@
return RestrictionsOrStateToAdaptation(
GetAdaptDownResolutionStepForBalanced(input_state), input_state);
}
- default:
- RTC_NOTREACHED();
}
+ RTC_CHECK(false);
}
VideoStreamAdapter::RestrictionsOrState
diff --git a/call/simulated_network.cc b/call/simulated_network.cc
index 2ed9140..86e2712 100644
--- a/call/simulated_network.cc
+++ b/call/simulated_network.cc
@@ -77,6 +77,7 @@
}
return false;
}
+ RTC_CHECK(false);
}
SimulatedNetwork::SimulatedNetwork(Config config, uint64_t random_seed)
diff --git a/call/video_send_stream.cc b/call/video_send_stream.cc
index a4b6744..d3e3694 100644
--- a/call/video_send_stream.cc
+++ b/call/video_send_stream.cc
@@ -28,6 +28,7 @@
case VideoSendStream::StreamStats::StreamType::kFlexfec:
return "flexfec";
}
+ RTC_CHECK(false);
}
} // namespace
diff --git a/media/base/rtp_utils.cc b/media/base/rtp_utils.cc
index 4a2b326..0d18c1e 100644
--- a/media/base/rtp_utils.cc
+++ b/media/base/rtp_utils.cc
@@ -323,6 +323,7 @@
case RtpPacketType::kUnknown:
return "Unknown";
}
+ RTC_CHECK(false);
}
RtpPacketType InferRtpPacketType(rtc::ArrayView<const char> packet) {
diff --git a/modules/audio_processing/agc2/adaptive_mode_level_estimator.cc b/modules/audio_processing/agc2/adaptive_mode_level_estimator.cc
index f09f63b..2d9c3e1 100644
--- a/modules/audio_processing/agc2/adaptive_mode_level_estimator.cc
+++ b/modules/audio_processing/agc2/adaptive_mode_level_estimator.cc
@@ -42,6 +42,7 @@
return vad_level.peak_dbfs;
break;
}
+ RTC_CHECK(false);
}
} // namespace
diff --git a/modules/audio_processing/audio_processing_impl.cc b/modules/audio_processing/audio_processing_impl.cc
index 849a0feb..33f2188 100644
--- a/modules/audio_processing/audio_processing_impl.cc
+++ b/modules/audio_processing/audio_processing_impl.cc
@@ -114,6 +114,7 @@
case Agc1Config::kFixedDigital:
return GainControl::kFixedDigital;
}
+ RTC_CHECK(false);
}
// Maximum lengths that frame of samples being passed from the render side to
@@ -1825,9 +1826,8 @@
return NsConfig::SuppressionLevel::k18dB;
case NoiseSuppresionConfig::kVeryHigh:
return NsConfig::SuppressionLevel::k21dB;
- default:
- RTC_NOTREACHED();
}
+ RTC_CHECK(false);
};
NsConfig cfg;
diff --git a/modules/audio_processing/include/audio_processing.cc b/modules/audio_processing/include/audio_processing.cc
index 3e5f6ed..1053642 100644
--- a/modules/audio_processing/include/audio_processing.cc
+++ b/modules/audio_processing/include/audio_processing.cc
@@ -31,6 +31,7 @@
case AudioProcessing::Config::NoiseSuppression::Level::kVeryHigh:
return "VeryHigh";
}
+ RTC_CHECK(false);
}
std::string GainController1ModeToString(const Agc1Config::Mode& mode) {
@@ -42,6 +43,7 @@
case Agc1Config::Mode::kFixedDigital:
return "FixedDigital";
}
+ RTC_CHECK(false);
}
std::string GainController2LevelEstimatorToString(
@@ -52,6 +54,7 @@
case Agc2Config::LevelEstimator::kPeak:
return "Peak";
}
+ RTC_CHECK(false);
}
int GetDefaultMaxInternalRate() {
diff --git a/modules/pacing/pacing_controller.cc b/modules/pacing/pacing_controller.cc
index 133c97f..bef0d2f 100644
--- a/modules/pacing/pacing_controller.cc
+++ b/modules/pacing/pacing_controller.cc
@@ -84,6 +84,7 @@
// BWE high.
return kFirstPriority + 4;
}
+ RTC_CHECK(false);
}
} // namespace
diff --git a/modules/rtp_rtcp/source/create_video_rtp_depacketizer.cc b/modules/rtp_rtcp/source/create_video_rtp_depacketizer.cc
index 724ad8c..b44322b 100644
--- a/modules/rtp_rtcp/source/create_video_rtp_depacketizer.cc
+++ b/modules/rtp_rtcp/source/create_video_rtp_depacketizer.cc
@@ -37,6 +37,7 @@
case kVideoCodecMultiplex:
return std::make_unique<VideoRtpDepacketizerGeneric>();
}
+ RTC_CHECK(false);
}
} // namespace webrtc
diff --git a/modules/rtp_rtcp/source/rtp_sender.cc b/modules/rtp_rtcp/source/rtp_sender.cc
index b72110e..3d1b381 100644
--- a/modules/rtp_rtcp/source/rtp_sender.cc
+++ b/modules/rtp_rtcp/source/rtp_sender.cc
@@ -128,6 +128,7 @@
RTC_NOTREACHED();
return false;
}
+ RTC_CHECK(false);
}
bool HasBweExtension(const RtpHeaderExtensionMap& extensions_map) {
diff --git a/modules/rtp_rtcp/source/rtp_sender_audio.cc b/modules/rtp_rtcp/source/rtp_sender_audio.cc
index 2ff1df6..16a1130 100644
--- a/modules/rtp_rtcp/source/rtp_sender_audio.cc
+++ b/modules/rtp_rtcp/source/rtp_sender_audio.cc
@@ -46,6 +46,7 @@
case AudioFrameType::kAudioFrameCN:
return "audio_cn";
}
+ RTC_CHECK(false);
}
#endif
diff --git a/modules/video_coding/codecs/vp8/temporal_layers_checker.cc b/modules/video_coding/codecs/vp8/temporal_layers_checker.cc
index 53a68bd..540cfa3 100644
--- a/modules/video_coding/codecs/vp8/temporal_layers_checker.cc
+++ b/modules/video_coding/codecs/vp8/temporal_layers_checker.cc
@@ -29,6 +29,7 @@
// Conference mode temporal layering for screen content in base stream.
return std::make_unique<TemporalLayersChecker>(num_temporal_layers);
}
+ RTC_CHECK(false);
}
TemporalLayersChecker::TemporalLayersChecker(int num_temporal_layers)
diff --git a/pc/dtls_transport.cc b/pc/dtls_transport.cc
index f0882de..844063d 100644
--- a/pc/dtls_transport.cc
+++ b/pc/dtls_transport.cc
@@ -31,6 +31,7 @@
case cricket::DTLS_TRANSPORT_FAILED:
return DtlsTransportState::kFailed;
}
+ RTC_CHECK(false);
}
} // namespace
diff --git a/pc/media_session.cc b/pc/media_session.cc
index 558cf32..6e9a7c1 100644
--- a/pc/media_session.cc
+++ b/pc/media_session.cc
@@ -1818,6 +1818,7 @@
case RtpTransceiverDirection::kRecvOnly:
return audio_recv_codecs_;
}
+ RTC_CHECK(false);
}
const AudioCodecs& MediaSessionDescriptionFactory::GetAudioCodecsForAnswer(
@@ -1836,6 +1837,7 @@
case RtpTransceiverDirection::kRecvOnly:
return audio_recv_codecs_;
}
+ RTC_CHECK(false);
}
const VideoCodecs& MediaSessionDescriptionFactory::GetVideoCodecsForOffer(
@@ -1851,6 +1853,7 @@
case RtpTransceiverDirection::kRecvOnly:
return video_recv_codecs_;
}
+ RTC_CHECK(false);
}
const VideoCodecs& MediaSessionDescriptionFactory::GetVideoCodecsForAnswer(
@@ -1869,6 +1872,7 @@
case RtpTransceiverDirection::kRecvOnly:
return video_recv_codecs_;
}
+ RTC_CHECK(false);
}
void MergeCodecsFromDescription(
diff --git a/pc/rtc_stats_collector.cc b/pc/rtc_stats_collector.cc
index 159ae7f..6f14e1e 100644
--- a/pc/rtc_stats_collector.cc
+++ b/pc/rtc_stats_collector.cc
@@ -216,6 +216,7 @@
case QualityLimitationReason::kOther:
return RTCQualityLimitationReason::kOther;
}
+ RTC_CHECK(false);
}
double DoubleAudioLevelFromIntAudioLevel(int audio_level) {
diff --git a/rtc_base/network_monitor.cc b/rtc_base/network_monitor.cc
index b22618a..ba6b1b4 100644
--- a/rtc_base/network_monitor.cc
+++ b/rtc_base/network_monitor.cc
@@ -10,6 +10,8 @@
#include "rtc_base/network_monitor.h"
+#include "rtc_base/checks.h"
+
namespace rtc {
const char* NetworkPreferenceToString(NetworkPreference preference) {
@@ -19,6 +21,7 @@
case NetworkPreference::NOT_PREFERRED:
return "NOT_PREFERRED";
}
+ RTC_CHECK(false);
}
NetworkMonitorInterface::NetworkMonitorInterface() {}
diff --git a/video/adaptation/video_stream_encoder_resource_manager.cc b/video/adaptation/video_stream_encoder_resource_manager.cc
index b0b6488..f7cf155 100644
--- a/video/adaptation/video_stream_encoder_resource_manager.cc
+++ b/video/adaptation/video_stream_encoder_resource_manager.cc
@@ -55,6 +55,7 @@
case VideoAdaptationReason::kCpu:
return "cpu";
}
+ RTC_CHECK(false);
}
} // namespace