OLD | NEW |
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_BASE_LOGGING_H_ | 5 #ifndef V8_BASE_LOGGING_H_ |
6 #define V8_BASE_LOGGING_H_ | 6 #define V8_BASE_LOGGING_H_ |
7 | 7 |
8 #include <cstring> | 8 #include <cstring> |
9 #include <sstream> | 9 #include <sstream> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "src/base/build_config.h" | 12 #include "src/base/build_config.h" |
13 | 13 |
14 extern "C" void V8_Fatal(const char* file, int line, const char* format, ...); | 14 extern "C" void V8_Fatal(const char* file, int line, const char* format, ...); |
15 | 15 |
16 | 16 |
17 // The FATAL, UNREACHABLE and UNIMPLEMENTED macros are useful during | 17 // The FATAL, UNREACHABLE and UNIMPLEMENTED macros are useful during |
18 // development, but they should not be relied on in the final product. | 18 // development, but they should not be relied on in the final product. |
19 #ifdef DEBUG | 19 #ifdef DEBUG |
20 #define FATAL(msg) \ | 20 #define FATAL(msg) \ |
21 V8_Fatal(__FILE__, __LINE__, "%s", (msg)) | 21 V8_Fatal(__FILE__, __LINE__, "%s", (msg)) |
22 #define UNIMPLEMENTED() \ | 22 #define UNIMPLEMENTED() \ |
23 V8_Fatal(__FILE__, __LINE__, "unimplemented code") | 23 V8_Fatal(__FILE__, __LINE__, "unimplemented code") |
24 #define UNREACHABLE() \ | 24 #define UNREACHABLE() \ |
25 V8_Fatal(__FILE__, __LINE__, "unreachable code") | 25 V8_Fatal(__FILE__, __LINE__, "unreachable code") |
26 #else | 26 #else |
27 #define FATAL(msg) \ | 27 #define FATAL(msg) ((void) 0) |
28 V8_Fatal("", 0, "%s", (msg)) | 28 #define UNIMPLEMENTED() ((void) 0) |
29 #define UNIMPLEMENTED() \ | 29 #define UNREACHABLE() ((void) 0) |
30 V8_Fatal("", 0, "unimplemented code") | |
31 #define UNREACHABLE() ((void) 0) | |
32 #endif | 30 #endif |
33 | 31 |
34 | 32 |
35 namespace v8 { | 33 namespace v8 { |
36 namespace base { | 34 namespace base { |
37 | 35 |
38 // CHECK dies with a fatal error if condition is not true. It is *not* | 36 // CHECK dies with a fatal error if condition is not true. It is *not* |
39 // controlled by DEBUG, so the check will be executed regardless of | 37 // controlled by DEBUG, so the check will be executed regardless of |
40 // compilation mode. | 38 // compilation mode. |
41 // | 39 // |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 #define DCHECK_NE(v1, v2) ((void) 0) | 163 #define DCHECK_NE(v1, v2) ((void) 0) |
166 #define DCHECK_GE(v1, v2) ((void) 0) | 164 #define DCHECK_GE(v1, v2) ((void) 0) |
167 #define DCHECK_LT(v1, v2) ((void) 0) | 165 #define DCHECK_LT(v1, v2) ((void) 0) |
168 #define DCHECK_LE(v1, v2) ((void) 0) | 166 #define DCHECK_LE(v1, v2) ((void) 0) |
169 #define DCHECK_NULL(val) ((void) 0) | 167 #define DCHECK_NULL(val) ((void) 0) |
170 #define DCHECK_NOT_NULL(val) ((void) 0) | 168 #define DCHECK_NOT_NULL(val) ((void) 0) |
171 #define DCHECK_IMPLIES(v1, v2) ((void) 0) | 169 #define DCHECK_IMPLIES(v1, v2) ((void) 0) |
172 #endif | 170 #endif |
173 | 171 |
174 #endif // V8_BASE_LOGGING_H_ | 172 #endif // V8_BASE_LOGGING_H_ |
OLD | NEW |