Use RTC_UNUSED instead of conditional compilation in BWE simulator tool.
Mark ATTRIBUTE_UNUSED as deprecated since it only works with GCC and clang. I am not removing it now since typedefs.h is (perhaps incorrectly?) considered a public interface.
BUG=webrtc:7228
Review-Url: https://codereview.webrtc.org/2756483002
Cr-Commit-Position: refs/heads/master@{#17291}
diff --git a/webrtc/typedefs.h b/webrtc/typedefs.h
index 16e10c5..bc48c08 100644
--- a/webrtc/typedefs.h
+++ b/webrtc/typedefs.h
@@ -80,6 +80,8 @@
// Put after a variable that might not be used, to prevent compiler warnings:
// int result ATTRIBUTE_UNUSED = DoSomething();
// assert(result == 17);
+// Deprecated since it only works with GCC & clang. See RTC_UNUSED below.
+// TODO(terelius): Remove.
#ifndef ATTRIBUTE_UNUSED
#if defined(__GNUC__) || defined(__clang__)
#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
@@ -109,4 +111,14 @@
#endif
#endif
+// Prevent the compiler from warning about an unused variable. For example:
+// int result = DoSomething();
+// assert(result == 17);
+// RTC_UNUSED(result);
+// Note: In most cases it is better to remove the unused variable rather than
+// suppressing the compiler warning.
+#ifndef RTC_UNUSED
+#define RTC_UNUSED(x) static_cast<void>(x)
+#endif // RTC_UNUSED
+
#endif // WEBRTC_TYPEDEFS_H_