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

Side by Side Diff: webrtc/rtc_base/annotations.h

Issue 3007253002: Remove typedefs.h from webrtc/ root (part 1)
Patch Set: backwards compatible FALLTHROUGH #define Created 3 years, 3 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/rtc_base/BUILD.gn ('k') | webrtc/rtc_base/arch.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
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 // TODO(solenberg): For backwards compatibility - remove once Chromium updated.
38 #define FALLTHROUGH RTC_FALLTHROUGH
39
40 // Prevent the compiler from warning about an unused variable. For example:
41 // int result = DoSomething();
42 // assert(result == 17);
43 // RTC_UNUSED(result);
44 // Note: In most cases it is better to remove the unused variable rather than
45 // suppressing the compiler warning.
46 #define RTC_UNUSED(x) static_cast<void>(x)
47
48 #endif // WEBRTC_RTC_BASE_ANNOTATIONS_H_
OLDNEW
« no previous file with comments | « webrtc/rtc_base/BUILD.gn ('k') | webrtc/rtc_base/arch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698