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

Side by Side Diff: sky/engine/wtf/Compiler.h

Issue 673403002: Remove compiler feature detection for = delete (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Don't remove #define for FINAL Created 6 years, 2 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 | « sky/engine/platform/heap/Heap.h ('k') | sky/engine/wtf/Noncopyable.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #define CLANG_PRAGMA(PRAGMA) _Pragma(PRAGMA) 44 #define CLANG_PRAGMA(PRAGMA) _Pragma(PRAGMA)
45 45
46 /* Specific compiler features */ 46 /* Specific compiler features */
47 #define WTF_COMPILER_SUPPORTS_CXX_VARIADIC_TEMPLATES __has_extension(cxx_variadi c_templates) 47 #define WTF_COMPILER_SUPPORTS_CXX_VARIADIC_TEMPLATES __has_extension(cxx_variadi c_templates)
48 48
49 /* There is a bug in clang that comes with Xcode 4.2 where AtomicStrings can't b e implicitly converted to Strings 49 /* There is a bug in clang that comes with Xcode 4.2 where AtomicStrings can't b e implicitly converted to Strings
50 in the presence of move constructors and/or move assignment operators. This b ug has been fixed in Xcode 4.3 clang, so we 50 in the presence of move constructors and/or move assignment operators. This b ug has been fixed in Xcode 4.3 clang, so we
51 check for both cxx_rvalue_references as well as the unrelated cxx_nonstatic_m ember_init feature which we know was added in 4.3 */ 51 check for both cxx_rvalue_references as well as the unrelated cxx_nonstatic_m ember_init feature which we know was added in 4.3 */
52 #define WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES __has_extension(cxx_rvalue_r eferences) && __has_extension(cxx_nonstatic_member_init) 52 #define WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES __has_extension(cxx_rvalue_r eferences) && __has_extension(cxx_nonstatic_member_init)
53 53
54 #define WTF_COMPILER_SUPPORTS_CXX_DELETED_FUNCTIONS __has_extension(cxx_deleted_ functions)
55 #define WTF_COMPILER_SUPPORTS_CXX_NULLPTR __has_feature(cxx_nullptr) 54 #define WTF_COMPILER_SUPPORTS_CXX_NULLPTR __has_feature(cxx_nullptr)
56 #define WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS __has_feature(cxx_explici t_conversions) 55 #define WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS __has_feature(cxx_explici t_conversions)
57 #define WTF_COMPILER_SUPPORTS_BLOCKS __has_feature(blocks) 56 #define WTF_COMPILER_SUPPORTS_BLOCKS __has_feature(blocks)
58 #define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT __has_extension(c_static_assert) 57 #define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT __has_extension(c_static_assert)
59 #define WTF_COMPILER_SUPPORTS_CXX_STATIC_ASSERT __has_extension(cxx_static_asser t) 58 #define WTF_COMPILER_SUPPORTS_CXX_STATIC_ASSERT __has_extension(cxx_static_asser t)
60 #define WTF_COMPILER_SUPPORTS_CXX_OVERRIDE_CONTROL __has_extension(cxx_override_ control)
61 #define WTF_COMPILER_SUPPORTS_HAS_TRIVIAL_DESTRUCTOR __has_extension(has_trivial _destructor) 59 #define WTF_COMPILER_SUPPORTS_HAS_TRIVIAL_DESTRUCTOR __has_extension(has_trivial _destructor)
62 #define WTF_COMPILER_SUPPORTS_CXX_STRONG_ENUMS __has_extension(cxx_strong_enums) 60 #define WTF_COMPILER_SUPPORTS_CXX_STRONG_ENUMS __has_extension(cxx_strong_enums)
63 61
64 #endif 62 #endif
65 63
66 #ifndef CLANG_PRAGMA 64 #ifndef CLANG_PRAGMA
67 #define CLANG_PRAGMA(PRAGMA) 65 #define CLANG_PRAGMA(PRAGMA)
68 #endif 66 #endif
69 67
70 /* COMPILER(MSVC) - Microsoft Visual C++ */ 68 /* COMPILER(MSVC) - Microsoft Visual C++ */
71 #if defined(_MSC_VER) 69 #if defined(_MSC_VER)
72 #define WTF_COMPILER_MSVC 1 70 #define WTF_COMPILER_MSVC 1
73 71
74 /* Specific compiler features */ 72 /* Specific compiler features */
75 #if !COMPILER(CLANG) && _MSC_VER >= 1600 73 #if !COMPILER(CLANG) && _MSC_VER >= 1600
76 #define WTF_COMPILER_SUPPORTS_CXX_NULLPTR 1 74 #define WTF_COMPILER_SUPPORTS_CXX_NULLPTR 1
77 #endif 75 #endif
78 76
79 #if COMPILER(CLANG) 77 #if COMPILER(CLANG)
80 /* Keep strong enums turned off when building with clang-cl: We cannot yet build all of Blink without fallback to cl.exe, and strong enums are exposed at ABI bo undaries. */ 78 /* Keep strong enums turned off when building with clang-cl: We cannot yet build all of Blink without fallback to cl.exe, and strong enums are exposed at ABI bo undaries. */
81 #undef WTF_COMPILER_SUPPORTS_CXX_STRONG_ENUMS 79 #undef WTF_COMPILER_SUPPORTS_CXX_STRONG_ENUMS
82 #else
83 #define WTF_COMPILER_SUPPORTS_CXX_OVERRIDE_CONTROL 1
84 #endif 80 #endif
85 81
86 #endif 82 #endif
87 83
88 /* COMPILER(GCC) - GNU Compiler Collection */ 84 /* COMPILER(GCC) - GNU Compiler Collection */
89 #if defined(__GNUC__) 85 #if defined(__GNUC__)
90 #define WTF_COMPILER_GCC 1 86 #define WTF_COMPILER_GCC 1
91 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL __) 87 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL __)
92 #define GCC_VERSION_AT_LEAST(major, minor, patch) (GCC_VERSION >= (major * 10000 + minor * 100 + patch)) 88 #define GCC_VERSION_AT_LEAST(major, minor, patch) (GCC_VERSION >= (major * 10000 + minor * 100 + patch))
93 #else 89 #else
94 /* Define this for !GCC compilers, just so we can write things like GCC_VERSION_ AT_LEAST(4, 1, 0). */ 90 /* Define this for !GCC compilers, just so we can write things like GCC_VERSION_ AT_LEAST(4, 1, 0). */
95 #define GCC_VERSION_AT_LEAST(major, minor, patch) 0 91 #define GCC_VERSION_AT_LEAST(major, minor, patch) 0
96 #endif 92 #endif
97 93
98 /* Specific compiler features */ 94 /* Specific compiler features */
99 #if COMPILER(GCC) && !COMPILER(CLANG) 95 #if COMPILER(GCC) && !COMPILER(CLANG)
100 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L 96 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
101 /* C11 support */ 97 /* C11 support */
102 #define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT 1 98 #define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT 1
103 #endif 99 #endif
104 #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && __cplusplus >= 201103L) 100 #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && __cplusplus >= 201103L)
105 /* C++11 support */ 101 /* C++11 support */
106 #if GCC_VERSION_AT_LEAST(4, 3, 0) 102 #if GCC_VERSION_AT_LEAST(4, 3, 0)
107 #define WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES 1 103 #define WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES 1
108 #define WTF_COMPILER_SUPPORTS_CXX_STATIC_ASSERT 1 104 #define WTF_COMPILER_SUPPORTS_CXX_STATIC_ASSERT 1
109 #define WTF_COMPILER_SUPPORTS_CXX_VARIADIC_TEMPLATES 1 105 #define WTF_COMPILER_SUPPORTS_CXX_VARIADIC_TEMPLATES 1
110 #endif 106 #endif
111 #if GCC_VERSION_AT_LEAST(4, 4, 0)
112 #define WTF_COMPILER_SUPPORTS_CXX_DELETED_FUNCTIONS 1
113 #endif
114 #if GCC_VERSION_AT_LEAST(4, 5, 0) 107 #if GCC_VERSION_AT_LEAST(4, 5, 0)
115 #define WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS 1 108 #define WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS 1
116 #endif 109 #endif
117 #if GCC_VERSION_AT_LEAST(4, 6, 0) 110 #if GCC_VERSION_AT_LEAST(4, 6, 0)
118 #define WTF_COMPILER_SUPPORTS_CXX_NULLPTR 1 111 #define WTF_COMPILER_SUPPORTS_CXX_NULLPTR 1
119 /* Strong enums should work from gcc 4.4, but doesn't seem to support some opera tors */ 112 /* Strong enums should work from gcc 4.4, but doesn't seem to support some opera tors */
120 #define WTF_COMPILER_SUPPORTS_CXX_STRONG_ENUMS 1 113 #define WTF_COMPILER_SUPPORTS_CXX_STRONG_ENUMS 1
121 #endif 114 #endif
122 #if GCC_VERSION_AT_LEAST(4, 7, 0)
123 #define WTF_COMPILER_SUPPORTS_CXX_OVERRIDE_CONTROL 1
124 #endif
125 #endif /* defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && __cplu splus >= 201103L) */ 115 #endif /* defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && __cplu splus >= 201103L) */
126 #endif /* COMPILER(GCC) */ 116 #endif /* COMPILER(GCC) */
127 117
128 /* ==== Compiler features ==== */ 118 /* ==== Compiler features ==== */
129 119
130 120
131 /* ALWAYS_INLINE */ 121 /* ALWAYS_INLINE */
132 122
133 #ifndef ALWAYS_INLINE 123 #ifndef ALWAYS_INLINE
134 #if COMPILER(GCC) && defined(NDEBUG) && !COMPILER(MINGW) 124 #if COMPILER(GCC) && defined(NDEBUG) && !COMPILER(MINGW)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 #endif 189 #endif
200 190
201 /* ALLOW_UNUSED */ 191 /* ALLOW_UNUSED */
202 192
203 #if COMPILER(GCC) 193 #if COMPILER(GCC)
204 #define ALLOW_UNUSED __attribute__((unused)) 194 #define ALLOW_UNUSED __attribute__((unused))
205 #else 195 #else
206 #define ALLOW_UNUSED 196 #define ALLOW_UNUSED
207 #endif 197 #endif
208 198
209 /* override and FINAL */ 199 /* FIXME: Convert all instance of FINAL to final */
210
211 #if COMPILER_SUPPORTS(CXX_OVERRIDE_CONTROL)
212 #define override override
213 #define FINAL final 200 #define FINAL final
214 #else
215 #define override
216 #define FINAL
217 #endif
218
219 /* WTF_DELETED_FUNCTION */
220
221 #if COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS)
222 #define WTF_DELETED_FUNCTION = delete
223 #else
224 #define WTF_DELETED_FUNCTION
225 #endif
226 201
227 /* REFERENCED_FROM_ASM */ 202 /* REFERENCED_FROM_ASM */
228 203
229 #ifndef REFERENCED_FROM_ASM 204 #ifndef REFERENCED_FROM_ASM
230 #if COMPILER(GCC) 205 #if COMPILER(GCC)
231 #define REFERENCED_FROM_ASM __attribute__((used)) 206 #define REFERENCED_FROM_ASM __attribute__((used))
232 #else 207 #else
233 #define REFERENCED_FROM_ASM 208 #define REFERENCED_FROM_ASM
234 #endif 209 #endif
235 #endif 210 #endif
(...skipping 14 matching lines...) Expand all
250 #define WTF_COMPILER_SUPPORTS_PRETTY_FUNCTION 1 225 #define WTF_COMPILER_SUPPORTS_PRETTY_FUNCTION 1
251 #define WTF_PRETTY_FUNCTION __PRETTY_FUNCTION__ 226 #define WTF_PRETTY_FUNCTION __PRETTY_FUNCTION__
252 #elif COMPILER(MSVC) 227 #elif COMPILER(MSVC)
253 #define WTF_COMPILER_SUPPORTS_PRETTY_FUNCTION 1 228 #define WTF_COMPILER_SUPPORTS_PRETTY_FUNCTION 1
254 #define WTF_PRETTY_FUNCTION __FUNCSIG__ 229 #define WTF_PRETTY_FUNCTION __FUNCSIG__
255 #else 230 #else
256 #define WTF_PRETTY_FUNCTION __FUNCTION__ 231 #define WTF_PRETTY_FUNCTION __FUNCTION__
257 #endif 232 #endif
258 233
259 #endif /* WTF_Compiler_h */ 234 #endif /* WTF_Compiler_h */
OLDNEW
« no previous file with comments | « sky/engine/platform/heap/Heap.h ('k') | sky/engine/wtf/Noncopyable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698