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

Side by Side Diff: src/checks.h

Issue 9295048: Inline an inline function into the CHECK macro (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 10 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 | « no previous file | no next file » | 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 // 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 V8_Fatal(__FILE__, __LINE__, "unreachable code") 44 V8_Fatal(__FILE__, __LINE__, "unreachable code")
45 #else 45 #else
46 #define FATAL(msg) \ 46 #define FATAL(msg) \
47 V8_Fatal("", 0, "%s", (msg)) 47 V8_Fatal("", 0, "%s", (msg))
48 #define UNIMPLEMENTED() \ 48 #define UNIMPLEMENTED() \
49 V8_Fatal("", 0, "unimplemented code") 49 V8_Fatal("", 0, "unimplemented code")
50 #define UNREACHABLE() ((void) 0) 50 #define UNREACHABLE() ((void) 0)
51 #endif 51 #endif
52 52
53 53
54 // Used by the CHECK macro -- should not be called directly.
55 inline void CheckHelper(const char* file,
56 int line,
57 const char* source,
58 bool condition) {
59 if (!condition)
60 V8_Fatal(file, line, "CHECK(%s) failed", source);
61 }
62
63
64 // The CHECK macro checks that the given condition is true; if not, it 54 // The CHECK macro checks that the given condition is true; if not, it
65 // prints a message to stderr and aborts. 55 // prints a message to stderr and aborts.
66 #define CHECK(condition) do { \ 56 #define CHECK(condition) do { \
67 if (!(condition)) CheckHelper(__FILE__, __LINE__, #condition, false); \ 57 if (!(condition)) { \
58 V8_Fatal(__FILE__, __LINE__, "CHECK(%s) failed", #condition); \
59 } \
68 } while (0) 60 } while (0)
69 61
70 62
71 // Helper function used by the CHECK_EQ function when given int 63 // Helper function used by the CHECK_EQ function when given int
72 // arguments. Should not be called directly. 64 // arguments. Should not be called directly.
73 inline void CheckEqualsHelper(const char* file, int line, 65 inline void CheckEqualsHelper(const char* file, int line,
74 const char* expected_source, int expected, 66 const char* expected_source, int expected,
75 const char* value_source, int value) { 67 const char* value_source, int value) {
76 if (expected != value) { 68 if (expected != value) {
77 V8_Fatal(file, line, 69 V8_Fatal(file, line,
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 // Static asserts has no impact on runtime performance, so they can be 278 // Static asserts has no impact on runtime performance, so they can be
287 // safely enabled in release mode. Moreover, the ((void) 0) expression 279 // safely enabled in release mode. Moreover, the ((void) 0) expression
288 // obeys different syntax rules than typedef's, e.g. it can't appear 280 // obeys different syntax rules than typedef's, e.g. it can't appear
289 // inside class declaration, this leads to inconsistency between debug 281 // inside class declaration, this leads to inconsistency between debug
290 // and release compilation modes behavior. 282 // and release compilation modes behavior.
291 #define STATIC_ASSERT(test) STATIC_CHECK(test) 283 #define STATIC_ASSERT(test) STATIC_CHECK(test)
292 284
293 #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p) 285 #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p)
294 286
295 #endif // V8_CHECKS_H_ 287 #endif // V8_CHECKS_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698