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

Side by Side Diff: src/checks.h

Issue 303463005: Extract build configuration into a separate header and move it to the base lib (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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/macros.h ('k') | src/flags.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_CHECKS_H_ 5 #ifndef V8_CHECKS_H_
6 #define V8_CHECKS_H_ 6 #define V8_CHECKS_H_
7 7
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "../include/v8stdint.h" 10 #include "../include/v8stdint.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 #define CHECK_NE(unexpected, value) CheckNonEqualsHelper(__FILE__, __LINE__, \ 233 #define CHECK_NE(unexpected, value) CheckNonEqualsHelper(__FILE__, __LINE__, \
234 #unexpected, unexpected, #value, value) 234 #unexpected, unexpected, #value, value)
235 235
236 236
237 #define CHECK_GT(a, b) CHECK((a) > (b)) 237 #define CHECK_GT(a, b) CHECK((a) > (b))
238 #define CHECK_GE(a, b) CHECK((a) >= (b)) 238 #define CHECK_GE(a, b) CHECK((a) >= (b))
239 #define CHECK_LT(a, b) CHECK((a) < (b)) 239 #define CHECK_LT(a, b) CHECK((a) < (b))
240 #define CHECK_LE(a, b) CHECK((a) <= (b)) 240 #define CHECK_LE(a, b) CHECK((a) <= (b))
241 241
242 242
243 // Use C++11 static_assert if possible, which gives error
244 // messages that are easier to understand on first sight.
245 #if V8_HAS_CXX11_STATIC_ASSERT
246 #define STATIC_ASSERT(test) static_assert(test, #test)
247 #else
248 // This is inspired by the static assertion facility in boost. This
249 // is pretty magical. If it causes you trouble on a platform you may
250 // find a fix in the boost code.
251 template <bool> class StaticAssertion;
252 template <> class StaticAssertion<true> { };
253 // This macro joins two tokens. If one of the tokens is a macro the
254 // helper call causes it to be resolved before joining.
255 #define SEMI_STATIC_JOIN(a, b) SEMI_STATIC_JOIN_HELPER(a, b)
256 #define SEMI_STATIC_JOIN_HELPER(a, b) a##b
257 // Causes an error during compilation of the condition is not
258 // statically known to be true. It is formulated as a typedef so that
259 // it can be used wherever a typedef can be used. Beware that this
260 // actually causes each use to introduce a new defined type with a
261 // name depending on the source line.
262 template <int> class StaticAssertionHelper { };
263 #define STATIC_ASSERT(test) \
264 typedef \
265 StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>((test))>)> \
266 SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__) V8_UNUSED
267 #endif
268
269
270 #ifdef DEBUG 243 #ifdef DEBUG
271 #ifndef OPTIMIZED_DEBUG 244 #ifndef OPTIMIZED_DEBUG
272 #define ENABLE_SLOW_ASSERTS 1 245 #define ENABLE_SLOW_ASSERTS 1
273 #endif 246 #endif
274 #endif 247 #endif
275 248
276 namespace v8 { 249 namespace v8 {
277 namespace internal { 250 namespace internal {
278 #ifdef ENABLE_SLOW_ASSERTS 251 #ifdef ENABLE_SLOW_ASSERTS
279 #define SLOW_ASSERT(condition) \ 252 #define SLOW_ASSERT(condition) \
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 288
316 // "Extra checks" are lightweight checks that are enabled in some release 289 // "Extra checks" are lightweight checks that are enabled in some release
317 // builds. 290 // builds.
318 #ifdef ENABLE_EXTRA_CHECKS 291 #ifdef ENABLE_EXTRA_CHECKS
319 #define EXTRA_CHECK(condition) CHECK(condition) 292 #define EXTRA_CHECK(condition) CHECK(condition)
320 #else 293 #else
321 #define EXTRA_CHECK(condition) ((void) 0) 294 #define EXTRA_CHECK(condition) ((void) 0)
322 #endif 295 #endif
323 296
324 #endif // V8_CHECKS_H_ 297 #endif // V8_CHECKS_H_
OLDNEW
« no previous file with comments | « src/base/macros.h ('k') | src/flags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698