OLD | NEW |
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 defined(WEBRTC_DETECT_NEON) | 61 defined(WEBRTC_DETECT_NEON) |
62 #define WEBRTC_CPU_DETECTION | 62 #define WEBRTC_CPU_DETECTION |
63 #endif | 63 #endif |
64 | 64 |
65 // TODO(pbos): Use webrtc/base/basictypes.h instead to include fixed-size ints. | 65 // TODO(pbos): Use webrtc/base/basictypes.h instead to include fixed-size ints. |
66 #include <stdint.h> | 66 #include <stdint.h> |
67 | 67 |
68 // Annotate a function indicating the caller must examine the return value. | 68 // Annotate a function indicating the caller must examine the return value. |
69 // Use like: | 69 // Use like: |
70 // int foo() WARN_UNUSED_RESULT; | 70 // int foo() WARN_UNUSED_RESULT; |
| 71 // To explicitly ignore a result, see |ignore_result()| in <base/macros.h>. |
71 // TODO(ajm): Hack to avoid multiple definitions until the base/ of webrtc and | 72 // TODO(ajm): Hack to avoid multiple definitions until the base/ of webrtc and |
72 // libjingle are merged. | 73 // libjingle are merged. |
73 #if !defined(WARN_UNUSED_RESULT) | 74 #if !defined(WARN_UNUSED_RESULT) |
74 #if defined(__GNUC__) | 75 #if defined(__GNUC__) || defined(__clang__) |
75 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) | 76 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) |
76 #else | 77 #else |
77 #define WARN_UNUSED_RESULT | 78 #define WARN_UNUSED_RESULT |
78 #endif | 79 #endif |
79 #endif // WARN_UNUSED_RESULT | 80 #endif // WARN_UNUSED_RESULT |
80 | 81 |
81 // Put after a variable that might not be used, to prevent compiler warnings: | 82 // Put after a variable that might not be used, to prevent compiler warnings: |
82 // int result ATTRIBUTE_UNUSED = DoSomething(); | 83 // int result ATTRIBUTE_UNUSED = DoSomething(); |
83 // assert(result == 17); | 84 // assert(result == 17); |
84 #ifndef ATTRIBUTE_UNUSED | 85 #ifndef ATTRIBUTE_UNUSED |
(...skipping 17 matching lines...) Expand all Loading... |
102 // Annotate a function that will not return control flow to the caller. | 103 // Annotate a function that will not return control flow to the caller. |
103 #if defined(_MSC_VER) | 104 #if defined(_MSC_VER) |
104 #define NO_RETURN __declspec(noreturn) | 105 #define NO_RETURN __declspec(noreturn) |
105 #elif defined(__GNUC__) | 106 #elif defined(__GNUC__) |
106 #define NO_RETURN __attribute__((noreturn)) | 107 #define NO_RETURN __attribute__((noreturn)) |
107 #else | 108 #else |
108 #define NO_RETURN | 109 #define NO_RETURN |
109 #endif | 110 #endif |
110 | 111 |
111 #endif // WEBRTC_TYPEDEFS_H_ | 112 #endif // WEBRTC_TYPEDEFS_H_ |
OLD | NEW |