| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // To explicitly ignore a result, see |ignore_result()| in <base/macros.h>. |
| 72 // 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 |
| 73 // libjingle are merged. | 73 // libjingle are merged. |
| 74 #if !defined(WARN_UNUSED_RESULT) | 74 #if !defined(WARN_UNUSED_RESULT) |
| 75 #if defined(__GNUC__) || defined(__clang__) | 75 #if defined(__GNUC__) || defined(__clang__) |
| 76 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) | 76 #define WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__)) |
| 77 #else | 77 #else |
| 78 #define WARN_UNUSED_RESULT | 78 #define WARN_UNUSED_RESULT |
| 79 #endif | 79 #endif |
| 80 #endif // WARN_UNUSED_RESULT | 80 #endif // WARN_UNUSED_RESULT |
| 81 | 81 |
| 82 // 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: |
| 83 // int result ATTRIBUTE_UNUSED = DoSomething(); | 83 // int result ATTRIBUTE_UNUSED = DoSomething(); |
| 84 // assert(result == 17); | 84 // assert(result == 17); |
| 85 #ifndef ATTRIBUTE_UNUSED | 85 #ifndef ATTRIBUTE_UNUSED |
| 86 #if defined(__GNUC__) || defined(__clang__) | 86 #if defined(__GNUC__) || defined(__clang__) |
| 87 #define ATTRIBUTE_UNUSED __attribute__((unused)) | 87 #define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) |
| 88 #else | 88 #else |
| 89 #define ATTRIBUTE_UNUSED | 89 #define ATTRIBUTE_UNUSED |
| 90 #endif | 90 #endif |
| 91 #endif | 91 #endif |
| 92 | 92 |
| 93 // Macro to be used for switch-case fallthrough (required for enabling | 93 // Macro to be used for switch-case fallthrough (required for enabling |
| 94 // -Wimplicit-fallthrough warning on Clang). | 94 // -Wimplicit-fallthrough warning on Clang). |
| 95 #ifndef FALLTHROUGH | 95 #ifndef FALLTHROUGH |
| 96 #if defined(__clang__) | 96 #if defined(__clang__) |
| 97 #define FALLTHROUGH() [[clang::fallthrough]] | 97 #define FALLTHROUGH() [[clang::fallthrough]] |
| 98 #else | 98 #else |
| 99 #define FALLTHROUGH() do { } while (0) | 99 #define FALLTHROUGH() do { } while (0) |
| 100 #endif | 100 #endif |
| 101 #endif | 101 #endif |
| 102 | 102 |
| 103 // 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. |
| 104 #if defined(_MSC_VER) | 104 #if defined(_MSC_VER) |
| 105 #define NO_RETURN __declspec(noreturn) | 105 #define NO_RETURN __declspec(noreturn) |
| 106 #elif defined(__GNUC__) | 106 #elif defined(__GNUC__) |
| 107 #define NO_RETURN __attribute__((noreturn)) | 107 #define NO_RETURN __attribute__ ((__noreturn__)) |
| 108 #else | 108 #else |
| 109 #define NO_RETURN | 109 #define NO_RETURN |
| 110 #endif | 110 #endif |
| 111 | 111 |
| 112 #endif // WEBRTC_TYPEDEFS_H_ | 112 #endif // WEBRTC_TYPEDEFS_H_ |
| OLD | NEW |