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

Side by Side Diff: webrtc/typedefs.h

Issue 2756483002: Use RTC_UNUSED instead of conditional compilation in BWE simulator tool. (Closed)
Patch Set: Attempt static_cast<void>(x) 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 #if defined(__GNUC__) || defined(__clang__) 73 #if defined(__GNUC__) || defined(__clang__)
74 #define WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__)) 74 #define WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
75 #else 75 #else
76 #define WARN_UNUSED_RESULT 76 #define WARN_UNUSED_RESULT
77 #endif 77 #endif
78 #endif // WARN_UNUSED_RESULT 78 #endif // WARN_UNUSED_RESULT
79 79
80 // Put after a variable that might not be used, to prevent compiler warnings: 80 // Put after a variable that might not be used, to prevent compiler warnings:
81 // int result ATTRIBUTE_UNUSED = DoSomething(); 81 // int result ATTRIBUTE_UNUSED = DoSomething();
82 // assert(result == 17); 82 // assert(result == 17);
83 // Deprecated since it only works with GCC & clang. See RTC_UNUSED below.
84 // TODO(terelius): Remove.
83 #ifndef ATTRIBUTE_UNUSED 85 #ifndef ATTRIBUTE_UNUSED
84 #if defined(__GNUC__) || defined(__clang__) 86 #if defined(__GNUC__) || defined(__clang__)
85 #define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 87 #define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
86 #else 88 #else
87 #define ATTRIBUTE_UNUSED 89 #define ATTRIBUTE_UNUSED
88 #endif 90 #endif
89 #endif 91 #endif
90 92
91 // Macro to be used for switch-case fallthrough (required for enabling 93 // Macro to be used for switch-case fallthrough (required for enabling
92 // -Wimplicit-fallthrough warning on Clang). 94 // -Wimplicit-fallthrough warning on Clang).
93 #ifndef FALLTHROUGH 95 #ifndef FALLTHROUGH
94 #if defined(__clang__) 96 #if defined(__clang__)
95 #define FALLTHROUGH() [[clang::fallthrough]] 97 #define FALLTHROUGH() [[clang::fallthrough]]
96 #else 98 #else
97 #define FALLTHROUGH() do { } while (0) 99 #define FALLTHROUGH() do { } while (0)
98 #endif 100 #endif
99 #endif 101 #endif
100 102
101 #ifndef NO_RETURN 103 #ifndef NO_RETURN
102 // Annotate a function that will not return control flow to the caller. 104 // Annotate a function that will not return control flow to the caller.
103 #if defined(_MSC_VER) 105 #if defined(_MSC_VER)
104 #define NO_RETURN __declspec(noreturn) 106 #define NO_RETURN __declspec(noreturn)
105 #elif defined(__GNUC__) 107 #elif defined(__GNUC__)
106 #define NO_RETURN __attribute__ ((__noreturn__)) 108 #define NO_RETURN __attribute__ ((__noreturn__))
107 #else 109 #else
108 #define NO_RETURN 110 #define NO_RETURN
109 #endif 111 #endif
110 #endif 112 #endif
111 113
114 // Prevent the compiler from warning about an unused variable. For example:
115 // int result = DoSomething();
116 // assert(result == 17);
117 // RTC_UNUSED(result);
118 // Note: In most cases it is better to remove the unused variable rather than
119 // suppressing the compiler warning.
120 #ifndef RTC_UNUSED
121 #define RTC_UNUSED(x) static_cast<void>(x)
122 #endif // RTC_UNUSED
123
112 #endif // WEBRTC_TYPEDEFS_H_ 124 #endif // WEBRTC_TYPEDEFS_H_
OLDNEW
« 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