OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 19 matching lines...) Expand all Loading... |
30 #define COMPILER(WTF_FEATURE) \ | 30 #define COMPILER(WTF_FEATURE) \ |
31 (defined WTF_COMPILER_##WTF_FEATURE && WTF_COMPILER_##WTF_FEATURE) | 31 (defined WTF_COMPILER_##WTF_FEATURE && WTF_COMPILER_##WTF_FEATURE) |
32 | 32 |
33 /* ==== COMPILER() - the compiler being used to build the project ==== */ | 33 /* ==== COMPILER() - the compiler being used to build the project ==== */ |
34 | 34 |
35 /* COMPILER(CLANG) - Clang */ | 35 /* COMPILER(CLANG) - Clang */ |
36 #if defined(__clang__) | 36 #if defined(__clang__) |
37 #define WTF_COMPILER_CLANG 1 | 37 #define WTF_COMPILER_CLANG 1 |
38 #endif | 38 #endif |
39 | 39 |
40 /* COMPILER(MSVC) - Microsoft Visual C++ (and Clang when compiling for Windows).
*/ | 40 /* COMPILER(MSVC) - Microsoft Visual C++ (and Clang when compiling for Windows). |
| 41 */ |
41 #if defined(_MSC_VER) | 42 #if defined(_MSC_VER) |
42 #define WTF_COMPILER_MSVC 1 | 43 #define WTF_COMPILER_MSVC 1 |
43 #endif | 44 #endif |
44 | 45 |
45 /* COMPILER(GCC) - GNU Compiler Collection (and Clang when compiling for platfor
ms other than Windows). */ | 46 /* COMPILER(GCC) - GNU Compiler Collection (and Clang when compiling for |
| 47 * platforms other than Windows). */ |
46 #if defined(__GNUC__) | 48 #if defined(__GNUC__) |
47 #define WTF_COMPILER_GCC 1 | 49 #define WTF_COMPILER_GCC 1 |
48 #define GCC_VERSION \ | 50 #define GCC_VERSION \ |
49 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) | 51 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) |
50 #define GCC_VERSION_AT_LEAST(major, minor, patch) \ | 52 #define GCC_VERSION_AT_LEAST(major, minor, patch) \ |
51 (GCC_VERSION >= (major * 10000 + minor * 100 + patch)) | 53 (GCC_VERSION >= (major * 10000 + minor * 100 + patch)) |
52 #else | 54 #else |
53 /* Define this for !GCC compilers, just so we can write things like GCC_VERSION_
AT_LEAST(4, 1, 0). */ | 55 /* Define this for !GCC compilers, just so we can write things like |
| 56 * GCC_VERSION_AT_LEAST(4, 1, 0). */ |
54 #define GCC_VERSION_AT_LEAST(major, minor, patch) 0 | 57 #define GCC_VERSION_AT_LEAST(major, minor, patch) 0 |
55 #endif | 58 #endif |
56 | 59 |
57 /* ==== Compiler features ==== */ | 60 /* ==== Compiler features ==== */ |
58 | 61 |
59 /* ALWAYS_INLINE */ | 62 /* ALWAYS_INLINE */ |
60 | 63 |
61 #ifndef ALWAYS_INLINE | 64 #ifndef ALWAYS_INLINE |
62 #if COMPILER(GCC) && defined(NDEBUG) && !COMPILER(MINGW) | 65 #if COMPILER(GCC) && defined(NDEBUG) && !COMPILER(MINGW) |
63 #define ALWAYS_INLINE inline __attribute__((__always_inline__)) | 66 #define ALWAYS_INLINE inline __attribute__((__always_inline__)) |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 /* NO_SANITIZE_UNRELATED_CAST - Disable runtime checks related to casts between | 150 /* NO_SANITIZE_UNRELATED_CAST - Disable runtime checks related to casts between |
148 * unrelated objects (-fsanitize=cfi-unrelated-cast or -fsanitize=vptr). */ | 151 * unrelated objects (-fsanitize=cfi-unrelated-cast or -fsanitize=vptr). */ |
149 | 152 |
150 #if COMPILER(CLANG) | 153 #if COMPILER(CLANG) |
151 #define NO_SANITIZE_UNRELATED_CAST \ | 154 #define NO_SANITIZE_UNRELATED_CAST \ |
152 __attribute__((no_sanitize("cfi-unrelated-cast", "vptr"))) | 155 __attribute__((no_sanitize("cfi-unrelated-cast", "vptr"))) |
153 #else | 156 #else |
154 #define NO_SANITIZE_UNRELATED_CAST | 157 #define NO_SANITIZE_UNRELATED_CAST |
155 #endif | 158 #endif |
156 | 159 |
157 /* WTF_NON_EXPORTED_BASE; similar NON_EXPORTED_BASE in base/compiler_specific.h
*/ | 160 /* WTF_NON_EXPORTED_BASE; similar NON_EXPORTED_BASE in base/compiler_specific.h |
| 161 */ |
158 | 162 |
159 #if COMPILER(MSVC) | 163 #if COMPILER(MSVC) |
160 #define WTF_NON_EXPORTED_BASE(code) __pragma(warning(suppress : 4275)) code | 164 #define WTF_NON_EXPORTED_BASE(code) __pragma(warning(suppress : 4275)) code |
161 #else | 165 #else |
162 #define WTF_NON_EXPORTED_BASE(code) code | 166 #define WTF_NON_EXPORTED_BASE(code) code |
163 #endif | 167 #endif |
164 | 168 |
165 #endif /* WTF_Compiler_h */ | 169 #endif /* WTF_Compiler_h */ |
OLD | NEW |