Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Unified Diff: webrtc/typedefs.h

Issue 2756483002: Use RTC_UNUSED instead of conditional compilation in BWE simulator tool. (Closed)
Patch Set: Make the inline function static. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/test/metric_recorder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/typedefs.h
diff --git a/webrtc/typedefs.h b/webrtc/typedefs.h
index 16e10c5ea14590bc78815a6a2e4486863b8f9fa5..2ed65d66143a5546a0a0e1bda121ccc966ab0bee 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,13 @@
#endif
#endif
+// Prevent compiler from warning about an unused variable.
+// int result = DoSomething();
+// assert(result == 17);
nisse-webrtc 2017/03/17 10:16:37 I think the example is misleading, we don't use as
terelius 2017/03/17 10:28:54 I based this on the example for ATTRIBUTE_UNUSED.
nisse-webrtc 2017/03/17 10:41:42 There's rarely a good reason to use RTC_UNUSED, so
terelius 2017/03/17 11:59:15 I like having an example that shows how to use the
+// RTC_UNUSED(result);
+#ifndef RTC_UNUSED
+#define RTC_UNUSED(x) RtcUnused(static_cast<const void*>(&x))
nisse-webrtc 2017/03/17 10:16:37 Please try out this simpler definition: #define
terelius 2017/03/17 10:28:54 Already tried. It does not work on Android bots.
nisse-webrtc 2017/03/17 10:41:42 Where's the failure? I see you tried #define RTC
terelius 2017/03/17 11:59:15 Sorry, I misread your comment. Yeah, that seems to
+static inline void RtcUnused(const void* dummy) {}
+#endif // RTC_UNUSED
+
#endif // WEBRTC_TYPEDEFS_H_
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/test/metric_recorder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698