OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 | 225 |
226 | 226 |
227 #define CHECK_GT(a, b) CHECK((a) > (b)) | 227 #define CHECK_GT(a, b) CHECK((a) > (b)) |
228 #define CHECK_GE(a, b) CHECK((a) >= (b)) | 228 #define CHECK_GE(a, b) CHECK((a) >= (b)) |
229 #define CHECK_LT(a, b) CHECK((a) < (b)) | 229 #define CHECK_LT(a, b) CHECK((a) < (b)) |
230 #define CHECK_LE(a, b) CHECK((a) <= (b)) | 230 #define CHECK_LE(a, b) CHECK((a) <= (b)) |
231 | 231 |
232 | 232 |
233 // Use C++11 static_assert if possible, which gives error | 233 // Use C++11 static_assert if possible, which gives error |
234 // messages that are easier to understand on first sight. | 234 // messages that are easier to understand on first sight. |
235 #if __cplusplus >= 201103L || \ | 235 #if __cplusplus >= 201103L |
236 (defined(__has_feature) && __has_feature(cxx_static_assert)) || \ | |
Sven Panne
2013/07/18 07:57:57
If the need for the additional terms of the disjun
| |
237 (defined(__has_extension) && __has_extension(cxx_static_assert)) | |
238 #define STATIC_CHECK(test) static_assert(test, #test) | 236 #define STATIC_CHECK(test) static_assert(test, #test) |
239 #else | 237 #else |
240 // This is inspired by the static assertion facility in boost. This | 238 // This is inspired by the static assertion facility in boost. This |
241 // is pretty magical. If it causes you trouble on a platform you may | 239 // is pretty magical. If it causes you trouble on a platform you may |
242 // find a fix in the boost code. | 240 // find a fix in the boost code. |
243 template <bool> class StaticAssertion; | 241 template <bool> class StaticAssertion; |
244 template <> class StaticAssertion<true> { }; | 242 template <> class StaticAssertion<true> { }; |
245 // This macro joins two tokens. If one of the tokens is a macro the | 243 // This macro joins two tokens. If one of the tokens is a macro the |
246 // helper call causes it to be resolved before joining. | 244 // helper call causes it to be resolved before joining. |
247 #define SEMI_STATIC_JOIN(a, b) SEMI_STATIC_JOIN_HELPER(a, b) | 245 #define SEMI_STATIC_JOIN(a, b) SEMI_STATIC_JOIN_HELPER(a, b) |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
294 | 292 |
295 // "Extra checks" are lightweight checks that are enabled in some release | 293 // "Extra checks" are lightweight checks that are enabled in some release |
296 // builds. | 294 // builds. |
297 #ifdef ENABLE_EXTRA_CHECKS | 295 #ifdef ENABLE_EXTRA_CHECKS |
298 #define EXTRA_CHECK(condition) CHECK(condition) | 296 #define EXTRA_CHECK(condition) CHECK(condition) |
299 #else | 297 #else |
300 #define EXTRA_CHECK(condition) ((void) 0) | 298 #define EXTRA_CHECK(condition) ((void) 0) |
301 #endif | 299 #endif |
302 | 300 |
303 #endif // V8_CHECKS_H_ | 301 #endif // V8_CHECKS_H_ |
OLD | NEW |