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

Side by Side Diff: src/base/macros.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/build_config.h ('k') | src/checks.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_MACROS_H_ 5 #ifndef V8_BASE_MACROS_H_
6 #define V8_BASE_MACROS_H_ 6 #define V8_BASE_MACROS_H_
7 7
8 #include "../../include/v8stdint.h" 8 #include "../../include/v8stdint.h"
9 9
10 10
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 #define DISABLE_ASAN 68 #define DISABLE_ASAN
69 #endif 69 #endif
70 70
71 71
72 #if V8_CC_GNU 72 #if V8_CC_GNU
73 #define V8_IMMEDIATE_CRASH() __builtin_trap() 73 #define V8_IMMEDIATE_CRASH() __builtin_trap()
74 #else 74 #else
75 #define V8_IMMEDIATE_CRASH() ((void(*)())0)() 75 #define V8_IMMEDIATE_CRASH() ((void(*)())0)()
76 #endif 76 #endif
77 77
78
79 // Use C++11 static_assert if possible, which gives error
80 // messages that are easier to understand on first sight.
81 #if V8_HAS_CXX11_STATIC_ASSERT
82 #define STATIC_ASSERT(test) static_assert(test, #test)
83 #else
84 // This is inspired by the static assertion facility in boost. This
85 // is pretty magical. If it causes you trouble on a platform you may
86 // find a fix in the boost code.
87 template <bool> class StaticAssertion;
88 template <> class StaticAssertion<true> { };
89 // This macro joins two tokens. If one of the tokens is a macro the
90 // helper call causes it to be resolved before joining.
91 #define SEMI_STATIC_JOIN(a, b) SEMI_STATIC_JOIN_HELPER(a, b)
92 #define SEMI_STATIC_JOIN_HELPER(a, b) a##b
93 // Causes an error during compilation of the condition is not
94 // statically known to be true. It is formulated as a typedef so that
95 // it can be used wherever a typedef can be used. Beware that this
96 // actually causes each use to introduce a new defined type with a
97 // name depending on the source line.
98 template <int> class StaticAssertionHelper { };
99 #define STATIC_ASSERT(test) \
100 typedef \
101 StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>((test))>)> \
102 SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__) V8_UNUSED
103
104 #endif
105
106
107 // The USE(x) template is used to silence C++ compiler warnings
108 // issued for (yet) unused variables (typically parameters).
109 template <typename T>
110 inline void USE(T) { }
111
78 #endif // V8_BASE_MACROS_H_ 112 #endif // V8_BASE_MACROS_H_
OLDNEW
« no previous file with comments | « src/base/build_config.h ('k') | src/checks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698