| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 // This macro joins two tokens. If one of the tokens is a macro the | 244 // This macro joins two tokens. If one of the tokens is a macro the |
| 245 // helper call causes it to be resolved before joining. | 245 // helper call causes it to be resolved before joining. |
| 246 #define SEMI_STATIC_JOIN(a, b) SEMI_STATIC_JOIN_HELPER(a, b) | 246 #define SEMI_STATIC_JOIN(a, b) SEMI_STATIC_JOIN_HELPER(a, b) |
| 247 #define SEMI_STATIC_JOIN_HELPER(a, b) a##b | 247 #define SEMI_STATIC_JOIN_HELPER(a, b) a##b |
| 248 // Causes an error during compilation of the condition is not | 248 // Causes an error during compilation of the condition is not |
| 249 // statically known to be true. It is formulated as a typedef so that | 249 // statically known to be true. It is formulated as a typedef so that |
| 250 // it can be used wherever a typedef can be used. Beware that this | 250 // it can be used wherever a typedef can be used. Beware that this |
| 251 // actually causes each use to introduce a new defined type with a | 251 // actually causes each use to introduce a new defined type with a |
| 252 // name depending on the source line. | 252 // name depending on the source line. |
| 253 template <int> class StaticAssertionHelper { }; | 253 template <int> class StaticAssertionHelper { }; |
| 254 #define STATIC_CHECK(test) \ | 254 #define STATIC_CHECK(test) \ |
| 255 typedef \ | 255 typedef \ |
| 256 StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>(test)>)> \ | 256 StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>((test))>)> \ |
| 257 SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__) | 257 SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__) |
| 258 | 258 |
| 259 | 259 |
| 260 namespace v8 { namespace internal { | 260 namespace v8 { namespace internal { |
| 261 | 261 |
| 262 bool EnableSlowAsserts(); | 262 bool EnableSlowAsserts(); |
| 263 | 263 |
| 264 } } // namespace v8::internal | 264 } } // namespace v8::internal |
| 265 | 265 |
| 266 // The ASSERT macro is equivalent to CHECK except that it only | 266 // The ASSERT macro is equivalent to CHECK except that it only |
| (...skipping 20 matching lines...) Expand all Loading... |
| 287 // Static asserts has no impact on runtime performance, so they can be | 287 // Static asserts has no impact on runtime performance, so they can be |
| 288 // safely enabled in release mode. Moreover, the ((void) 0) expression | 288 // safely enabled in release mode. Moreover, the ((void) 0) expression |
| 289 // obeys different syntax rules than typedef's, e.g. it can't appear | 289 // obeys different syntax rules than typedef's, e.g. it can't appear |
| 290 // inside class declaration, this leads to inconsistency between debug | 290 // inside class declaration, this leads to inconsistency between debug |
| 291 // and release compilation modes behavior. | 291 // and release compilation modes behavior. |
| 292 #define STATIC_ASSERT(test) STATIC_CHECK(test) | 292 #define STATIC_ASSERT(test) STATIC_CHECK(test) |
| 293 | 293 |
| 294 #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p) | 294 #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p) |
| 295 | 295 |
| 296 #endif // V8_CHECKS_H_ | 296 #endif // V8_CHECKS_H_ |
| OLD | NEW |