OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | |
kwiberg-webrtc
2017/09/08 11:11:34
You said (c) 2012 in the other new file. You shoul
the sun
2017/09/08 13:28:03
done.
| |
3 * | |
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 | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #ifndef WEBRTC_RTC_BASE_ANNOTATIONS_H_ | |
12 #define WEBRTC_RTC_BASE_ANNOTATIONS_H_ | |
13 | |
14 // Annotate a function indicating the caller must examine the return value. | |
15 // Use like: | |
16 // int foo() RTC_WARN_UNUSED_RESULT; | |
17 // To explicitly ignore a result, cast to void. | |
18 // TODO(kwiberg): Remove when we can use [[nodiscard]] from C++17. | |
19 #if defined(__clang__) | |
20 #define RTC_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) | |
21 #elif defined(__GNUC__) | |
22 // gcc has a __warn_unused_result__ attribute, but you can't quiet it by | |
23 // casting to void, so we don't use it. | |
24 #define RTC_WARN_UNUSED_RESULT | |
25 #else | |
26 #define RTC_WARN_UNUSED_RESULT | |
27 #endif | |
28 | |
29 // Macro to be used for switch-case fallthrough (required for enabling | |
30 // -Wimplicit-fallthrough warning on Clang). | |
31 #if defined(__clang__) | |
32 #define RTC_FALLTHROUGH() [[clang::fallthrough]] | |
33 #else | |
34 #define RTC_FALLTHROUGH() do { } while (0) | |
35 #endif | |
36 | |
37 // Prevent the compiler from warning about an unused variable. For example: | |
38 // int result = DoSomething(); | |
39 // assert(result == 17); | |
40 // RTC_UNUSED(result); | |
41 // Note: In most cases it is better to remove the unused variable rather than | |
42 // suppressing the compiler warning. | |
43 #define RTC_UNUSED(x) static_cast<void>(x) | |
44 | |
45 #endif // WEBRTC_RTC_BASE_ANNOTATIONS_H_ | |
OLD | NEW |