OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 | 10 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 * Creates a string of the form "<filename>(<linenumber>) : " | 99 * Creates a string of the form "<filename>(<linenumber>) : " |
100 */ | 100 */ |
101 #define GR_FILE_AND_LINE_STR __FILE__ "(" GR_STRING(__LINE__) ") : " | 101 #define GR_FILE_AND_LINE_STR __FILE__ "(" GR_STRING(__LINE__) ") : " |
102 | 102 |
103 /** | 103 /** |
104 * Compilers have different ways of issuing warnings. This macro | 104 * Compilers have different ways of issuing warnings. This macro |
105 * attempts to abstract them, but may need to be specialized for your | 105 * attempts to abstract them, but may need to be specialized for your |
106 * particular compiler. | 106 * particular compiler. |
107 * To insert compiler warnings use "#pragma message GR_WARN(<string>)" | 107 * To insert compiler warnings use "#pragma message GR_WARN(<string>)" |
108 */ | 108 */ |
109 #if defined(_MSC_VER) && _MSC_VER | 109 #if defined(_MSC_VER) |
110 #define GR_WARN(MSG) (GR_FILE_AND_LINE_STR "WARNING: " MSG) | 110 #define GR_WARN(MSG) (GR_FILE_AND_LINE_STR "WARNING: " MSG) |
111 #else//__GNUC__ - may need other defines for different compilers | 111 #else//__GNUC__ - may need other defines for different compilers |
112 #define GR_WARN(MSG) ("WARNING: " MSG) | 112 #define GR_WARN(MSG) ("WARNING: " MSG) |
113 #endif | 113 #endif |
114 | 114 |
115 /** | 115 /** |
116 * GR_ALWAYSBREAK is an unconditional break in all builds. | 116 * GR_ALWAYSBREAK is an unconditional break in all builds. |
117 */ | 117 */ |
118 #if !defined(GR_ALWAYSBREAK) | 118 #if !defined(GR_ALWAYSBREAK) |
119 #if defined(SK_BUILD_FOR_WIN32) | 119 #if defined(SK_BUILD_FOR_WIN32) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 /** | 164 /** |
165 * Prettier forms of the above macros. | 165 * Prettier forms of the above macros. |
166 */ | 166 */ |
167 #define GrAlwaysAssert(COND) GR_ALWAYSASSERT(COND) | 167 #define GrAlwaysAssert(COND) GR_ALWAYSASSERT(COND) |
168 | 168 |
169 /** | 169 /** |
170 * GR_STATIC_ASSERT is a compile time assertion. Depending on the platform | 170 * GR_STATIC_ASSERT is a compile time assertion. Depending on the platform |
171 * it may print the message in the compiler log. Obviously, the condition must | 171 * it may print the message in the compiler log. Obviously, the condition must |
172 * be evaluatable at compile time. | 172 * be evaluatable at compile time. |
173 */ | 173 */ |
174 // VS 2010 and GCC compiled with c++0x or gnu++0x support the new | 174 #define GR_STATIC_ASSERT(CONDITION) static_assert(CONDITION, "bug") |
175 // static_assert. | |
176 #if !defined(GR_STATIC_ASSERT) | |
177 #if (defined(_MSC_VER) && _MSC_VER >= 1600) || (defined(__GXX_EXPERIMENTAL_C
XX0X__) && __GXX_EXPERIMENTAL_CXX0X__) | |
178 #define GR_STATIC_ASSERT(CONDITION) static_assert(CONDITION, "bug") | |
179 #else | |
180 template <bool> class GR_STATIC_ASSERT_FAILURE; | |
181 template <> class GR_STATIC_ASSERT_FAILURE<true> {}; | |
182 #define GR_STATIC_ASSERT(CONDITION) \ | |
183 enum {GR_CONCAT(X,__LINE__) = \ | |
184 sizeof(GR_STATIC_ASSERT_FAILURE<CONDITION>)} | |
185 #endif | |
186 #endif | |
187 | 175 |
188 /** | 176 /** |
189 * Set to 1 to enable pixel local storage path rendering on supported devices. | 177 * Set to 1 to enable pixel local storage path rendering on supported devices. |
190 */ | 178 */ |
191 #if !defined(GR_ENABLE_PLS_PATH_RENDERING) | 179 #if !defined(GR_ENABLE_PLS_PATH_RENDERING) |
192 #define GR_ENABLE_PLS_PATH_RENDERING 0 | 180 #define GR_ENABLE_PLS_PATH_RENDERING 0 |
193 #endif | 181 #endif |
194 | 182 |
195 #endif | 183 #endif |
OLD | NEW |