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

Side by Side Diff: src/base/macros.h

Issue 526223002: Use Chrome compatible naming for compiler specifics. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: mips Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/base/flags.h ('k') | src/base/platform/condition-variable.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 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project 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 V8_BASE_MACROS_H_ 5 #ifndef V8_BASE_MACROS_H_
6 #define V8_BASE_MACROS_H_ 6 #define V8_BASE_MACROS_H_
7 7
8 #include "include/v8stdint.h" 8 #include "include/v8stdint.h"
9 #include "src/base/build_config.h" 9 #include "src/base/build_config.h"
10 #include "src/base/compiler-specific.h"
10 #include "src/base/logging.h" 11 #include "src/base/logging.h"
11 12
12 13
13 // The expression OFFSET_OF(type, field) computes the byte-offset 14 // The expression OFFSET_OF(type, field) computes the byte-offset
14 // of the specified field relative to the containing type. This 15 // of the specified field relative to the containing type. This
15 // corresponds to 'offsetof' (in stddef.h), except that it doesn't 16 // corresponds to 'offsetof' (in stddef.h), except that it doesn't
16 // use 0 or NULL, which causes a problem with the compiler warnings 17 // use 0 or NULL, which causes a problem with the compiler warnings
17 // we have enabled (which is also why 'offsetof' doesn't seem to work). 18 // we have enabled (which is also why 'offsetof' doesn't seem to work).
18 // Here we simply use the non-zero value 4, which seems to work. 19 // Here we simply use the non-zero value 4, which seems to work.
19 #define OFFSET_OF(type, field) \ 20 #define OFFSET_OF(type, field) \
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 #define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ 118 #define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
118 TypeName() V8_DELETE; \ 119 TypeName() V8_DELETE; \
119 DISALLOW_COPY_AND_ASSIGN(TypeName) 120 DISALLOW_COPY_AND_ASSIGN(TypeName)
120 121
121 122
122 // Newly written code should use V8_INLINE and V8_NOINLINE directly. 123 // Newly written code should use V8_INLINE and V8_NOINLINE directly.
123 #define INLINE(declarator) V8_INLINE declarator 124 #define INLINE(declarator) V8_INLINE declarator
124 #define NO_INLINE(declarator) V8_NOINLINE declarator 125 #define NO_INLINE(declarator) V8_NOINLINE declarator
125 126
126 127
127 // Newly written code should use V8_WARN_UNUSED_RESULT. 128 // Newly written code should use WARN_UNUSED_RESULT.
128 #define MUST_USE_RESULT V8_WARN_UNUSED_RESULT 129 #define MUST_USE_RESULT WARN_UNUSED_RESULT
129 130
130 131
131 // Define V8_USE_ADDRESS_SANITIZER macros. 132 // Define V8_USE_ADDRESS_SANITIZER macros.
132 #if defined(__has_feature) 133 #if defined(__has_feature)
133 #if __has_feature(address_sanitizer) 134 #if __has_feature(address_sanitizer)
134 #define V8_USE_ADDRESS_SANITIZER 1 135 #define V8_USE_ADDRESS_SANITIZER 1
135 #endif 136 #endif
136 #endif 137 #endif
137 138
138 // Define DISABLE_ASAN macros. 139 // Define DISABLE_ASAN macros.
(...skipping 27 matching lines...) Expand all
166 #define SEMI_STATIC_JOIN_HELPER(a, b) a##b 167 #define SEMI_STATIC_JOIN_HELPER(a, b) a##b
167 // Causes an error during compilation of the condition is not 168 // Causes an error during compilation of the condition is not
168 // statically known to be true. It is formulated as a typedef so that 169 // statically known to be true. It is formulated as a typedef so that
169 // it can be used wherever a typedef can be used. Beware that this 170 // it can be used wherever a typedef can be used. Beware that this
170 // actually causes each use to introduce a new defined type with a 171 // actually causes each use to introduce a new defined type with a
171 // name depending on the source line. 172 // name depending on the source line.
172 template <int> class StaticAssertionHelper { }; 173 template <int> class StaticAssertionHelper { };
173 #define STATIC_ASSERT(test) \ 174 #define STATIC_ASSERT(test) \
174 typedef \ 175 typedef \
175 StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>((test))>)> \ 176 StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>((test))>)> \
176 SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__) V8_UNUSED 177 SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__) ALLOW_UNUSED
177 178
178 #endif 179 #endif
179 180
180 181
181 // The USE(x) template is used to silence C++ compiler warnings 182 // The USE(x) template is used to silence C++ compiler warnings
182 // issued for (yet) unused variables (typically parameters). 183 // issued for (yet) unused variables (typically parameters).
183 template <typename T> 184 template <typename T>
184 inline void USE(T) { } 185 inline void USE(T) { }
185 186
186 187
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 // Returns current value of top of the stack. Works correctly with ASAN. 323 // Returns current value of top of the stack. Works correctly with ASAN.
323 DISABLE_ASAN 324 DISABLE_ASAN
324 inline uintptr_t GetCurrentStackPosition() { 325 inline uintptr_t GetCurrentStackPosition() {
325 // Takes the address of the limit variable in order to find out where 326 // Takes the address of the limit variable in order to find out where
326 // the top of stack is right now. 327 // the top of stack is right now.
327 uintptr_t limit = reinterpret_cast<uintptr_t>(&limit); 328 uintptr_t limit = reinterpret_cast<uintptr_t>(&limit);
328 return limit; 329 return limit;
329 } 330 }
330 331
331 #endif // V8_BASE_MACROS_H_ 332 #endif // V8_BASE_MACROS_H_
OLDNEW
« no previous file with comments | « src/base/flags.h ('k') | src/base/platform/condition-variable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698