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

Side by Side Diff: Source/wtf/Compiler.h

Issue 604843002: Replace OVERRIDE and FINAL with their C++11 counterparts in WTF (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 | « no previous file | Source/wtf/FilePrintStream.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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) 54 #define WTF_COMPILER_SUPPORTS_CXX_DELETED_FUNCTIONS __has_extension(cxx_deleted_ functions)
55 #define WTF_COMPILER_SUPPORTS_CXX_NULLPTR __has_feature(cxx_nullptr) 55 #define WTF_COMPILER_SUPPORTS_CXX_NULLPTR __has_feature(cxx_nullptr)
56 #define WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS __has_feature(cxx_explici t_conversions) 56 #define WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS __has_feature(cxx_explici t_conversions)
57 #define WTF_COMPILER_SUPPORTS_BLOCKS __has_feature(blocks) 57 #define WTF_COMPILER_SUPPORTS_BLOCKS __has_feature(blocks)
58 #define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT __has_extension(c_static_assert) 58 #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) 59 #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) 60 #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) 61 #define WTF_COMPILER_SUPPORTS_CXX_STRONG_ENUMS __has_extension(cxx_strong_enums)
63 62
64 #endif 63 #endif
65 64
66 #ifndef CLANG_PRAGMA 65 #ifndef CLANG_PRAGMA
67 #define CLANG_PRAGMA(PRAGMA) 66 #define CLANG_PRAGMA(PRAGMA)
68 #endif 67 #endif
69 68
70 /* COMPILER(MSVC) - Microsoft Visual C++ */ 69 /* COMPILER(MSVC) - Microsoft Visual C++ */
71 #if defined(_MSC_VER) 70 #if defined(_MSC_VER)
72 #define WTF_COMPILER_MSVC 1 71 #define WTF_COMPILER_MSVC 1
73 72
74 /* Specific compiler features */ 73 /* Specific compiler features */
75 #if !COMPILER(CLANG) && _MSC_VER >= 1600 74 #if !COMPILER(CLANG) && _MSC_VER >= 1600
76 #define WTF_COMPILER_SUPPORTS_CXX_NULLPTR 1 75 #define WTF_COMPILER_SUPPORTS_CXX_NULLPTR 1
77 #endif 76 #endif
78 77
79 #if COMPILER(CLANG) 78 #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. */ 79 /* 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 80 #undef WTF_COMPILER_SUPPORTS_CXX_STRONG_ENUMS
82 #else
83 #define WTF_COMPILER_SUPPORTS_CXX_OVERRIDE_CONTROL 1
84 #endif 81 #endif
85 82
86 #endif 83 #endif
87 84
88 /* COMPILER(GCC) - GNU Compiler Collection */ 85 /* COMPILER(GCC) - GNU Compiler Collection */
89 #if defined(__GNUC__) 86 #if defined(__GNUC__)
90 #define WTF_COMPILER_GCC 1 87 #define WTF_COMPILER_GCC 1
91 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL __) 88 #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)) 89 #define GCC_VERSION_AT_LEAST(major, minor, patch) (GCC_VERSION >= (major * 10000 + minor * 100 + patch))
93 #else 90 #else
(...skipping 18 matching lines...) Expand all
112 #define WTF_COMPILER_SUPPORTS_CXX_DELETED_FUNCTIONS 1 109 #define WTF_COMPILER_SUPPORTS_CXX_DELETED_FUNCTIONS 1
113 #endif 110 #endif
114 #if GCC_VERSION_AT_LEAST(4, 5, 0) 111 #if GCC_VERSION_AT_LEAST(4, 5, 0)
115 #define WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS 1 112 #define WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS 1
116 #endif 113 #endif
117 #if GCC_VERSION_AT_LEAST(4, 6, 0) 114 #if GCC_VERSION_AT_LEAST(4, 6, 0)
118 #define WTF_COMPILER_SUPPORTS_CXX_NULLPTR 1 115 #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 */ 116 /* 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 117 #define WTF_COMPILER_SUPPORTS_CXX_STRONG_ENUMS 1
121 #endif 118 #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) */ 119 #endif /* defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && __cplu splus >= 201103L) */
126 #endif /* COMPILER(GCC) */ 120 #endif /* COMPILER(GCC) */
127 121
128 /* ==== Compiler features ==== */ 122 /* ==== Compiler features ==== */
129 123
130 124
131 /* ALWAYS_INLINE */ 125 /* ALWAYS_INLINE */
132 126
133 #ifndef ALWAYS_INLINE 127 #ifndef ALWAYS_INLINE
134 #if COMPILER(GCC) && defined(NDEBUG) && !COMPILER(MINGW) 128 #if COMPILER(GCC) && defined(NDEBUG) && !COMPILER(MINGW)
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 /* ALLOW_UNUSED */ 195 /* ALLOW_UNUSED */
202 196
203 #if COMPILER(GCC) 197 #if COMPILER(GCC)
204 #define ALLOW_UNUSED __attribute__((unused)) 198 #define ALLOW_UNUSED __attribute__((unused))
205 #else 199 #else
206 #define ALLOW_UNUSED 200 #define ALLOW_UNUSED
207 #endif 201 #endif
208 202
209 /* OVERRIDE and FINAL */ 203 /* OVERRIDE and FINAL */
210 204
211 #if COMPILER_SUPPORTS(CXX_OVERRIDE_CONTROL)
212 #define OVERRIDE override 205 #define OVERRIDE override
213 #define FINAL final 206 #define FINAL final
214 #else
215 #define OVERRIDE
216 #define FINAL
Nico 2014/09/25 19:32:38 nit: This seems kind of independent of the mechani
217 #endif
218 207
219 /* WTF_DELETED_FUNCTION */ 208 /* WTF_DELETED_FUNCTION */
220 209
221 #if COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS) 210 #if COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS)
222 #define WTF_DELETED_FUNCTION = delete 211 #define WTF_DELETED_FUNCTION = delete
223 #else 212 #else
224 #define WTF_DELETED_FUNCTION 213 #define WTF_DELETED_FUNCTION
225 #endif 214 #endif
226 215
227 /* REFERENCED_FROM_ASM */ 216 /* REFERENCED_FROM_ASM */
(...skipping 22 matching lines...) Expand all
250 #define WTF_COMPILER_SUPPORTS_PRETTY_FUNCTION 1 239 #define WTF_COMPILER_SUPPORTS_PRETTY_FUNCTION 1
251 #define WTF_PRETTY_FUNCTION __PRETTY_FUNCTION__ 240 #define WTF_PRETTY_FUNCTION __PRETTY_FUNCTION__
252 #elif COMPILER(MSVC) 241 #elif COMPILER(MSVC)
253 #define WTF_COMPILER_SUPPORTS_PRETTY_FUNCTION 1 242 #define WTF_COMPILER_SUPPORTS_PRETTY_FUNCTION 1
254 #define WTF_PRETTY_FUNCTION __FUNCSIG__ 243 #define WTF_PRETTY_FUNCTION __FUNCSIG__
255 #else 244 #else
256 #define WTF_PRETTY_FUNCTION __FUNCTION__ 245 #define WTF_PRETTY_FUNCTION __FUNCTION__
257 #endif 246 #endif
258 247
259 #endif /* WTF_Compiler_h */ 248 #endif /* WTF_Compiler_h */
OLDNEW
« no previous file with comments | « no previous file | Source/wtf/FilePrintStream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698