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

Side by Side Diff: include/v8config.h

Issue 1393023003: Reland: Introduce a V8_NORETURN macro and use it to make GCC 4.9.2 happy again. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: avoid gcc 4.8 arm compiler bug on release and debug by moving checks to the bottom Created 5 years, 2 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
« no previous file with comments | « no previous file | src/arguments.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 V8CONFIG_H_ 5 #ifndef V8CONFIG_H_
6 #define V8CONFIG_H_ 6 #define V8CONFIG_H_
7 7
8 // clang-format off 8 // clang-format off
9 9
10 // Platform headers for feature detection below. 10 // Platform headers for feature detection below.
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // 167 //
168 // Compiler-specific feature detection 168 // Compiler-specific feature detection
169 // 169 //
170 // V8_HAS___ALIGNOF - __alignof(type) operator supported 170 // V8_HAS___ALIGNOF - __alignof(type) operator supported
171 // V8_HAS___ALIGNOF__ - __alignof__(type) operator supported 171 // V8_HAS___ALIGNOF__ - __alignof__(type) operator supported
172 // V8_HAS_ATTRIBUTE_ALIGNED - __attribute__((aligned(n))) supported 172 // V8_HAS_ATTRIBUTE_ALIGNED - __attribute__((aligned(n))) supported
173 // V8_HAS_ATTRIBUTE_ALWAYS_INLINE - __attribute__((always_inline)) 173 // V8_HAS_ATTRIBUTE_ALWAYS_INLINE - __attribute__((always_inline))
174 // supported 174 // supported
175 // V8_HAS_ATTRIBUTE_DEPRECATED - __attribute__((deprecated)) supported 175 // V8_HAS_ATTRIBUTE_DEPRECATED - __attribute__((deprecated)) supported
176 // V8_HAS_ATTRIBUTE_NOINLINE - __attribute__((noinline)) supported 176 // V8_HAS_ATTRIBUTE_NOINLINE - __attribute__((noinline)) supported
177 // V8_HAS_ATTRIBUTE_NORETURN - __attribute__((noreturn)) supported
177 // V8_HAS_ATTRIBUTE_UNUSED - __attribute__((unused)) supported 178 // V8_HAS_ATTRIBUTE_UNUSED - __attribute__((unused)) supported
178 // V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported 179 // V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported
179 // V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT - __attribute__((warn_unused_result)) 180 // V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT - __attribute__((warn_unused_result))
180 // supported 181 // supported
181 // V8_HAS_BUILTIN_CLZ - __builtin_clz() supported 182 // V8_HAS_BUILTIN_CLZ - __builtin_clz() supported
182 // V8_HAS_BUILTIN_CTZ - __builtin_ctz() supported 183 // V8_HAS_BUILTIN_CTZ - __builtin_ctz() supported
183 // V8_HAS_BUILTIN_EXPECT - __builtin_expect() supported 184 // V8_HAS_BUILTIN_EXPECT - __builtin_expect() supported
184 // V8_HAS_BUILTIN_FRAME_ADDRESS - __builtin_frame_address() supported 185 // V8_HAS_BUILTIN_FRAME_ADDRESS - __builtin_frame_address() supported
185 // V8_HAS_BUILTIN_POPCOUNT - __builtin_popcount() supported 186 // V8_HAS_BUILTIN_POPCOUNT - __builtin_popcount() supported
186 // V8_HAS_BUILTIN_SADD_OVERFLOW - __builtin_sadd_overflow() supported 187 // V8_HAS_BUILTIN_SADD_OVERFLOW - __builtin_sadd_overflow() supported
187 // V8_HAS_BUILTIN_SSUB_OVERFLOW - __builtin_ssub_overflow() supported 188 // V8_HAS_BUILTIN_SSUB_OVERFLOW - __builtin_ssub_overflow() supported
188 // V8_HAS_BUILTIN_UADD_OVERFLOW - __builtin_uadd_overflow() supported 189 // V8_HAS_BUILTIN_UADD_OVERFLOW - __builtin_uadd_overflow() supported
189 // V8_HAS_DECLSPEC_ALIGN - __declspec(align(n)) supported 190 // V8_HAS_DECLSPEC_ALIGN - __declspec(align(n)) supported
190 // V8_HAS_DECLSPEC_DEPRECATED - __declspec(deprecated) supported 191 // V8_HAS_DECLSPEC_DEPRECATED - __declspec(deprecated) supported
191 // V8_HAS_DECLSPEC_NOINLINE - __declspec(noinline) supported 192 // V8_HAS_DECLSPEC_NOINLINE - __declspec(noinline) supported
192 // V8_HAS_DECLSPEC_SELECTANY - __declspec(selectany) supported 193 // V8_HAS_DECLSPEC_SELECTANY - __declspec(selectany) supported
194 // V8_HAS_DECLSPEC_NORETURN - __declspec(noreturn) supported
193 // V8_HAS___FORCEINLINE - __forceinline supported 195 // V8_HAS___FORCEINLINE - __forceinline supported
194 // 196 //
195 // Note that testing for compilers and/or features must be done using #if 197 // Note that testing for compilers and/or features must be done using #if
196 // not #ifdef. For example, to test for Intel C++ Compiler, use: 198 // not #ifdef. For example, to test for Intel C++ Compiler, use:
197 // #if V8_CC_INTEL 199 // #if V8_CC_INTEL
198 // ... 200 // ...
199 // #endif 201 // #endif
200 202
201 #if defined(__clang__) 203 #if defined(__clang__)
202 204
203 #if defined(__GNUC__) // Clang in gcc mode. 205 #if defined(__GNUC__) // Clang in gcc mode.
204 # define V8_CC_GNU 1 206 # define V8_CC_GNU 1
205 #endif 207 #endif
206 208
207 // Clang defines __alignof__ as alias for __alignof 209 // Clang defines __alignof__ as alias for __alignof
208 # define V8_HAS___ALIGNOF 1 210 # define V8_HAS___ALIGNOF 1
209 # define V8_HAS___ALIGNOF__ V8_HAS___ALIGNOF 211 # define V8_HAS___ALIGNOF__ V8_HAS___ALIGNOF
210 212
211 # define V8_HAS_ATTRIBUTE_ALIGNED (__has_attribute(aligned)) 213 # define V8_HAS_ATTRIBUTE_ALIGNED (__has_attribute(aligned))
212 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline)) 214 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
213 # define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated)) 215 # define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated))
214 # define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline)) 216 # define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline))
217 # define V8_HAS_ATTRIBUTE_NORETURN (__has_attribute(noreturn))
215 # define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused)) 218 # define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused))
216 # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility)) 219 # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
217 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \ 220 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
218 (__has_attribute(warn_unused_result)) 221 (__has_attribute(warn_unused_result))
219 222
220 # define V8_HAS_BUILTIN_CLZ (__has_builtin(__builtin_clz)) 223 # define V8_HAS_BUILTIN_CLZ (__has_builtin(__builtin_clz))
221 # define V8_HAS_BUILTIN_CTZ (__has_builtin(__builtin_ctz)) 224 # define V8_HAS_BUILTIN_CTZ (__has_builtin(__builtin_ctz))
222 # define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect)) 225 # define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect))
223 # define V8_HAS_BUILTIN_FRAME_ADDRESS (__has_builtin(__builtin_frame_address)) 226 # define V8_HAS_BUILTIN_FRAME_ADDRESS (__has_builtin(__builtin_frame_address))
224 # define V8_HAS_BUILTIN_POPCOUNT (__has_builtin(__builtin_popcount)) 227 # define V8_HAS_BUILTIN_POPCOUNT (__has_builtin(__builtin_popcount))
(...skipping 21 matching lines...) Expand all
246 # define V8_HAS___ALIGNOF__ (V8_GNUC_PREREQ(4, 3, 0)) 249 # define V8_HAS___ALIGNOF__ (V8_GNUC_PREREQ(4, 3, 0))
247 250
248 # define V8_HAS_ATTRIBUTE_ALIGNED (V8_GNUC_PREREQ(2, 95, 0)) 251 # define V8_HAS_ATTRIBUTE_ALIGNED (V8_GNUC_PREREQ(2, 95, 0))
249 // always_inline is available in gcc 4.0 but not very reliable until 4.4. 252 // always_inline is available in gcc 4.0 but not very reliable until 4.4.
250 // Works around "sorry, unimplemented: inlining failed" build errors with 253 // Works around "sorry, unimplemented: inlining failed" build errors with
251 // older compilers. 254 // older compilers.
252 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4, 4, 0)) 255 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4, 4, 0))
253 # define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0)) 256 # define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0))
254 # define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE (V8_GNUC_PREREQ(4, 5, 0)) 257 # define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE (V8_GNUC_PREREQ(4, 5, 0))
255 # define V8_HAS_ATTRIBUTE_NOINLINE (V8_GNUC_PREREQ(3, 4, 0)) 258 # define V8_HAS_ATTRIBUTE_NOINLINE (V8_GNUC_PREREQ(3, 4, 0))
259 # define V8_HAS_ATTRIBUTE_NORETURN (V8_GNUC_PREREQ(2, 5, 0))
256 # define V8_HAS_ATTRIBUTE_UNUSED (V8_GNUC_PREREQ(2, 95, 0)) 260 # define V8_HAS_ATTRIBUTE_UNUSED (V8_GNUC_PREREQ(2, 95, 0))
257 # define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4, 3, 0)) 261 # define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4, 3, 0))
258 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \ 262 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
259 (!V8_CC_INTEL && V8_GNUC_PREREQ(4, 1, 0)) 263 (!V8_CC_INTEL && V8_GNUC_PREREQ(4, 1, 0))
260 264
261 # define V8_HAS_BUILTIN_CLZ (V8_GNUC_PREREQ(3, 4, 0)) 265 # define V8_HAS_BUILTIN_CLZ (V8_GNUC_PREREQ(3, 4, 0))
262 # define V8_HAS_BUILTIN_CTZ (V8_GNUC_PREREQ(3, 4, 0)) 266 # define V8_HAS_BUILTIN_CTZ (V8_GNUC_PREREQ(3, 4, 0))
263 # define V8_HAS_BUILTIN_EXPECT (V8_GNUC_PREREQ(2, 96, 0)) 267 # define V8_HAS_BUILTIN_EXPECT (V8_GNUC_PREREQ(2, 96, 0))
264 # define V8_HAS_BUILTIN_FRAME_ADDRESS (V8_GNUC_PREREQ(2, 96, 0)) 268 # define V8_HAS_BUILTIN_FRAME_ADDRESS (V8_GNUC_PREREQ(2, 96, 0))
265 # define V8_HAS_BUILTIN_POPCOUNT (V8_GNUC_PREREQ(3, 4, 0)) 269 # define V8_HAS_BUILTIN_POPCOUNT (V8_GNUC_PREREQ(3, 4, 0))
(...skipping 12 matching lines...) Expand all
278 #endif 282 #endif
279 283
280 #if defined(_MSC_VER) 284 #if defined(_MSC_VER)
281 # define V8_CC_MSVC 1 285 # define V8_CC_MSVC 1
282 # define V8_HAS___ALIGNOF 1 286 # define V8_HAS___ALIGNOF 1
283 287
284 # define V8_HAS_DECLSPEC_ALIGN 1 288 # define V8_HAS_DECLSPEC_ALIGN 1
285 # define V8_HAS_DECLSPEC_DEPRECATED 1 289 # define V8_HAS_DECLSPEC_DEPRECATED 1
286 # define V8_HAS_DECLSPEC_NOINLINE 1 290 # define V8_HAS_DECLSPEC_NOINLINE 1
287 # define V8_HAS_DECLSPEC_SELECTANY 1 291 # define V8_HAS_DECLSPEC_SELECTANY 1
292 # define V8_HAS_DECLSPEC_NORETURN 1
288 293
289 # define V8_HAS___FORCEINLINE 1 294 # define V8_HAS___FORCEINLINE 1
290 295
291 #endif 296 #endif
292 297
293 298
294 // ----------------------------------------------------------------------------- 299 // -----------------------------------------------------------------------------
295 // Helper macros 300 // Helper macros
296 301
297 // A macro used to make better inlining. Don't bother for debug builds. 302 // A macro used to make better inlining. Don't bother for debug builds.
(...skipping 14 matching lines...) Expand all
312 // V8_NOINLINE int GetMinusOne() { return -1; } 317 // V8_NOINLINE int GetMinusOne() { return -1; }
313 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_NOINLINE 318 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_NOINLINE
314 # define V8_NOINLINE __attribute__((noinline)) 319 # define V8_NOINLINE __attribute__((noinline))
315 #elif !defined(DEBUG) && V8_HAS_DECLSPEC_NOINLINE 320 #elif !defined(DEBUG) && V8_HAS_DECLSPEC_NOINLINE
316 # define V8_NOINLINE __declspec(noinline) 321 # define V8_NOINLINE __declspec(noinline)
317 #else 322 #else
318 # define V8_NOINLINE /* NOT SUPPORTED */ 323 # define V8_NOINLINE /* NOT SUPPORTED */
319 #endif 324 #endif
320 325
321 326
327 // A macro used to tell the compiler that a particular function never returns.
328 // Use like:
329 // V8_NORETURN void MyAbort() { abort(); }
330 #if V8_HAS_ATTRIBUTE_NORETURN
331 # define V8_NORETURN __attribute__((noreturn))
332 #elif HAS_DECLSPEC_NORETURN
333 # define V8_NORETURN __declspec(noreturn)
334 #else
335 # define V8_NORETURN /* NOT SUPPORTED */
336 #endif
337
338
322 // A macro (V8_DEPRECATED) to mark classes or functions as deprecated. 339 // A macro (V8_DEPRECATED) to mark classes or functions as deprecated.
323 #if defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE 340 #if defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE
324 #define V8_DEPRECATED(message, declarator) \ 341 #define V8_DEPRECATED(message, declarator) \
325 declarator __attribute__((deprecated(message))) 342 declarator __attribute__((deprecated(message)))
326 #elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED 343 #elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED
327 #define V8_DEPRECATED(message, declarator) \ 344 #define V8_DEPRECATED(message, declarator) \
328 declarator __attribute__((deprecated)) 345 declarator __attribute__((deprecated))
329 #elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED 346 #elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED
330 #define V8_DEPRECATED(message, declarator) __declspec(deprecated) declarator 347 #define V8_DEPRECATED(message, declarator) __declspec(deprecated) declarator
331 #else 348 #else
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 // int foo() WARN_UNUSED_RESULT; 432 // int foo() WARN_UNUSED_RESULT;
416 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT 433 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
417 #define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) 434 #define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
418 #else 435 #else
419 #define V8_WARN_UNUSED_RESULT /* NOT SUPPORTED */ 436 #define V8_WARN_UNUSED_RESULT /* NOT SUPPORTED */
420 #endif 437 #endif
421 438
422 // clang-format on 439 // clang-format on
423 440
424 #endif // V8CONFIG_H_ 441 #endif // V8CONFIG_H_
OLDNEW
« no previous file with comments | « no previous file | src/arguments.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698