Remove our stream << overloads from non-test build targets.
Most are removed entirely, but RtcErrorType, RtpTransceiverDirection, IPAddress and
SocketAddress are kept behind gtest's #ifdef UNIT_TEST.
Bug: webrtc:8982
Change-Id: I36db19891e7d25aeacb08b9a08aa2b4004765e70
Reviewed-on: https://webrtc-review.googlesource.com/64143
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Benjamin Wright <benwright@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22916}
diff --git a/api/rtcerror.h b/api/rtcerror.h
index d7dec29..c87ce91 100644
--- a/api/rtcerror.h
+++ b/api/rtcerror.h
@@ -11,7 +11,9 @@
#ifndef API_RTCERROR_H_
#define API_RTCERROR_H_
+#ifdef UNIT_TEST
#include <ostream>
+#endif // UNIT_TEST
#include <string>
#include <utility> // For std::move.
@@ -143,10 +145,16 @@
// error type.
//
// Only intended to be used for logging/disagnostics.
-std::ostream& operator<<(std::ostream& stream, RTCErrorType error);
-
std::string ToString(RTCErrorType error);
+#ifdef UNIT_TEST
+inline std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
+ std::ostream& stream, // no-presubmit-check TODO(webrtc:8982)
+ RTCErrorType error) {
+ return stream << ToString(error);
+}
+#endif // UNIT_TEST
+
// Helper macro that can be used by implementations to create an error with a
// message and log it. |message| should be a string literal or movable
// std::string.