| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_COMPILER_SPECIFIC_H_ | 5 #ifndef BASE_COMPILER_SPECIFIC_H_ |
| 6 #define BASE_COMPILER_SPECIFIC_H_ | 6 #define BASE_COMPILER_SPECIFIC_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #if defined(COMPILER_MSVC) | 10 #if defined(COMPILER_MSVC) |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 #define MSVC_SUPPRESS_WARNING(n) | 64 #define MSVC_SUPPRESS_WARNING(n) |
| 65 #define MSVC_PUSH_DISABLE_WARNING(n) | 65 #define MSVC_PUSH_DISABLE_WARNING(n) |
| 66 #define MSVC_PUSH_WARNING_LEVEL(n) | 66 #define MSVC_PUSH_WARNING_LEVEL(n) |
| 67 #define MSVC_POP_WARNING() | 67 #define MSVC_POP_WARNING() |
| 68 #define MSVC_DISABLE_OPTIMIZE() | 68 #define MSVC_DISABLE_OPTIMIZE() |
| 69 #define MSVC_ENABLE_OPTIMIZE() | 69 #define MSVC_ENABLE_OPTIMIZE() |
| 70 #define NON_EXPORTED_BASE(code) code | 70 #define NON_EXPORTED_BASE(code) code |
| 71 | 71 |
| 72 #endif // COMPILER_MSVC | 72 #endif // COMPILER_MSVC |
| 73 | 73 |
| 74 | |
| 75 // Annotate a variable indicating it's ok if the variable is not used. | 74 // Annotate a variable indicating it's ok if the variable is not used. |
| 76 // (Typically used to silence a compiler warning when the assignment | 75 // (Typically used to silence a compiler warning when the assignment |
| 77 // is important for some other reason.) | 76 // is important for some other reason.) |
| 78 // Use like: | 77 // Use like: |
| 79 // int x = ...; | 78 // int x = ...; |
| 80 // ALLOW_UNUSED_LOCAL(x); | 79 // ALLOW_UNUSED_LOCAL(x); |
| 81 #define ALLOW_UNUSED_LOCAL(x) false ? (void)x : (void)0 | 80 #define ALLOW_UNUSED_LOCAL(x) (void)x |
| 82 | 81 |
| 83 // Annotate a typedef or function indicating it's ok if it's not used. | 82 // Annotate a typedef or function indicating it's ok if it's not used. |
| 84 // Use like: | 83 // Use like: |
| 85 // typedef Foo Bar ALLOW_UNUSED_TYPE; | 84 // typedef Foo Bar ALLOW_UNUSED_TYPE; |
| 86 #if defined(COMPILER_GCC) || defined(__clang__) | 85 #if defined(COMPILER_GCC) || defined(__clang__) |
| 87 #define ALLOW_UNUSED_TYPE __attribute__((unused)) | 86 #define ALLOW_UNUSED_TYPE __attribute__((unused)) |
| 88 #else | 87 #else |
| 89 #define ALLOW_UNUSED_TYPE | 88 #define ALLOW_UNUSED_TYPE |
| 90 #endif | 89 #endif |
| 91 | 90 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 223 |
| 225 // Compiler feature-detection. | 224 // Compiler feature-detection. |
| 226 // clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension | 225 // clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension |
| 227 #if defined(__has_feature) | 226 #if defined(__has_feature) |
| 228 #define HAS_FEATURE(FEATURE) __has_feature(FEATURE) | 227 #define HAS_FEATURE(FEATURE) __has_feature(FEATURE) |
| 229 #else | 228 #else |
| 230 #define HAS_FEATURE(FEATURE) 0 | 229 #define HAS_FEATURE(FEATURE) 0 |
| 231 #endif | 230 #endif |
| 232 | 231 |
| 233 #endif // BASE_COMPILER_SPECIFIC_H_ | 232 #endif // BASE_COMPILER_SPECIFIC_H_ |
| OLD | NEW |