Chromium Code Reviews| 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_ |