From 49a1d621be799d3da7ac02ed422a0c1f8f802542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= Date: Mon, 24 Jan 2022 09:19:42 +0100 Subject: [PATCH] Fix possible compile issue with PeerConnectionInterface::AsString. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AsString is constexpr, but RTC_CHECK_NOTREACHED is not. Using some gcc compile rules, having a constexpr make use of RTC_CHECK_NOTREACHED does not compile. See internal issue number 215785261. We could either remove constexpr or remove the RTC_CHECK_NOTREACHED. This CL does the latter. Bug: None Change-Id: I7ea84b345e9abdba60a7620e1d92c3159c0d7974 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/248167 Reviewed-by: Harald Alvestrand Commit-Queue: Henrik Boström Cr-Commit-Position: refs/heads/main@{#35768} --- api/peer_connection_interface.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/api/peer_connection_interface.h b/api/peer_connection_interface.h index 72a0765518..0b402c9db2 100644 --- a/api/peer_connection_interface.h +++ b/api/peer_connection_interface.h @@ -1625,7 +1625,8 @@ inline constexpr absl::string_view PeerConnectionInterface::AsString( case SignalingState::kClosed: return "closed"; } - RTC_CHECK_NOTREACHED(); + // This cannot happen. + // Not using "RTC_CHECK_NOTREACHED()" because AsString() is constexpr. return ""; } @@ -1640,7 +1641,8 @@ inline constexpr absl::string_view PeerConnectionInterface::AsString( case IceGatheringState::kIceGatheringComplete: return "complete"; } - RTC_CHECK_NOTREACHED(); + // This cannot happen. + // Not using "RTC_CHECK_NOTREACHED()" because AsString() is constexpr. return ""; } @@ -1661,7 +1663,8 @@ inline constexpr absl::string_view PeerConnectionInterface::AsString( case PeerConnectionState::kClosed: return "closed"; } - RTC_CHECK_NOTREACHED(); + // This cannot happen. + // Not using "RTC_CHECK_NOTREACHED()" because AsString() is constexpr. return ""; } @@ -1683,10 +1686,12 @@ inline constexpr absl::string_view PeerConnectionInterface::AsString( case kIceConnectionClosed: return "closed"; case kIceConnectionMax: - RTC_CHECK_NOTREACHED(); + // This cannot happen. + // Not using "RTC_CHECK_NOTREACHED()" because AsString() is constexpr. return ""; } - RTC_CHECK_NOTREACHED(); + // This cannot happen. + // Not using "RTC_CHECK_NOTREACHED()" because AsString() is constexpr. return ""; }