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

Side by Side Diff: include/v8config.h

Issue 69413002: Fix compilation with GCC 4.8 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: only use __attribute__ when supported Created 7 years, 1 month 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 | « include/v8.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // 180 //
181 // Compiler-specific feature detection 181 // Compiler-specific feature detection
182 // 182 //
183 // V8_HAS___ALIGNOF - __alignof(type) operator supported 183 // V8_HAS___ALIGNOF - __alignof(type) operator supported
184 // V8_HAS___ALIGNOF__ - __alignof__(type) operator supported 184 // V8_HAS___ALIGNOF__ - __alignof__(type) operator supported
185 // V8_HAS_ATTRIBUTE_ALIGNED - __attribute__((aligned(n))) supported 185 // V8_HAS_ATTRIBUTE_ALIGNED - __attribute__((aligned(n))) supported
186 // V8_HAS_ATTRIBUTE_ALWAYS_INLINE - __attribute__((always_inline)) 186 // V8_HAS_ATTRIBUTE_ALWAYS_INLINE - __attribute__((always_inline))
187 // supported 187 // supported
188 // V8_HAS_ATTRIBUTE_DEPRECATED - __attribute__((deprecated)) supported 188 // V8_HAS_ATTRIBUTE_DEPRECATED - __attribute__((deprecated)) supported
189 // V8_HAS_ATTRIBUTE_NOINLINE - __attribute__((noinline)) supported 189 // V8_HAS_ATTRIBUTE_NOINLINE - __attribute__((noinline)) supported
190 // V8_HAS_ATTRIBUTE_UNUSED - __attribute__((unused)) supported
190 // V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported 191 // V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported
191 // V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT - __attribute__((warn_unused_result)) 192 // V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT - __attribute__((warn_unused_result))
192 // supported 193 // supported
193 // V8_HAS_BUILTIN_EXPECT - __builtin_expect() supported 194 // V8_HAS_BUILTIN_EXPECT - __builtin_expect() supported
194 // V8_HAS_DECLSPEC_ALIGN - __declspec(align(n)) supported 195 // V8_HAS_DECLSPEC_ALIGN - __declspec(align(n)) supported
195 // V8_HAS_DECLSPEC_DEPRECATED - __declspec(deprecated) supported 196 // V8_HAS_DECLSPEC_DEPRECATED - __declspec(deprecated) supported
196 // V8_HAS_DECLSPEC_NOINLINE - __declspec(noinline) supported 197 // V8_HAS_DECLSPEC_NOINLINE - __declspec(noinline) supported
197 // V8_HAS___FINAL - __final supported in non-C++11 mode 198 // V8_HAS___FINAL - __final supported in non-C++11 mode
198 // V8_HAS___FORCEINLINE - __forceinline supported 199 // V8_HAS___FORCEINLINE - __forceinline supported
199 // V8_HAS_SEALED - MSVC style sealed marker supported 200 // V8_HAS_SEALED - MSVC style sealed marker supported
200 // 201 //
201 // Note that testing for compilers and/or features must be done using #if 202 // Note that testing for compilers and/or features must be done using #if
202 // not #ifdef. For example, to test for Intel C++ Compiler, use: 203 // not #ifdef. For example, to test for Intel C++ Compiler, use:
203 // #if V8_CC_INTEL 204 // #if V8_CC_INTEL
204 // ... 205 // ...
205 // #endif 206 // #endif
206 207
207 #if defined(__clang__) 208 #if defined(__clang__)
208 209
209 # define V8_CC_CLANG 1 210 # define V8_CC_CLANG 1
210 211
211 // Clang defines __alignof__ as alias for __alignof 212 // Clang defines __alignof__ as alias for __alignof
212 # define V8_HAS___ALIGNOF 1 213 # define V8_HAS___ALIGNOF 1
213 # define V8_HAS___ALIGNOF__ V8_HAS___ALIGNOF 214 # define V8_HAS___ALIGNOF__ V8_HAS___ALIGNOF
214 215
215 # define V8_HAS_ATTRIBUTE_ALIGNED (__has_attribute(aligned)) 216 # define V8_HAS_ATTRIBUTE_ALIGNED (__has_attribute(aligned))
216 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline)) 217 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
217 # define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated)) 218 # define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated))
218 # define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline)) 219 # define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline))
220 # define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused))
219 # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility)) 221 # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
220 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \ 222 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
221 (__has_attribute(warn_unused_result)) 223 (__has_attribute(warn_unused_result))
222 224
223 # define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect)) 225 # define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect))
224 226
225 # define V8_HAS_CXX11_ALIGNAS (__has_feature(cxx_alignas)) 227 # define V8_HAS_CXX11_ALIGNAS (__has_feature(cxx_alignas))
226 # define V8_HAS_CXX11_STATIC_ASSERT (__has_feature(cxx_static_assert)) 228 # define V8_HAS_CXX11_STATIC_ASSERT (__has_feature(cxx_static_assert))
227 # define V8_HAS_CXX11_DELETE (__has_feature(cxx_deleted_functions)) 229 # define V8_HAS_CXX11_DELETE (__has_feature(cxx_deleted_functions))
228 # define V8_HAS_CXX11_FINAL (__has_feature(cxx_override_control)) 230 # define V8_HAS_CXX11_FINAL (__has_feature(cxx_override_control))
(...skipping 11 matching lines...) Expand all
240 # define V8_HAS___ALIGNOF__ (V8_GNUC_PREREQ(4, 3, 0)) 242 # define V8_HAS___ALIGNOF__ (V8_GNUC_PREREQ(4, 3, 0))
241 243
242 # define V8_HAS_ATTRIBUTE_ALIGNED (V8_GNUC_PREREQ(2, 95, 0)) 244 # define V8_HAS_ATTRIBUTE_ALIGNED (V8_GNUC_PREREQ(2, 95, 0))
243 // always_inline is available in gcc 4.0 but not very reliable until 4.4. 245 // always_inline is available in gcc 4.0 but not very reliable until 4.4.
244 // Works around "sorry, unimplemented: inlining failed" build errors with 246 // Works around "sorry, unimplemented: inlining failed" build errors with
245 // older compilers. 247 // older compilers.
246 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4, 4, 0)) 248 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4, 4, 0))
247 # define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0)) 249 # define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0))
248 # define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE (V8_GNUC_PREREQ(4, 5, 0)) 250 # define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE (V8_GNUC_PREREQ(4, 5, 0))
249 # define V8_HAS_ATTRIBUTE_NOINLINE (V8_GNUC_PREREQ(3, 4, 0)) 251 # define V8_HAS_ATTRIBUTE_NOINLINE (V8_GNUC_PREREQ(3, 4, 0))
252 # define V8_HAS_ATTRIBUTE_UNUSED (V8_GNUC_PREREQ(2, 95, 0))
250 # define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4, 3, 0)) 253 # define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4, 3, 0))
251 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \ 254 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
252 (!V8_CC_INTEL && V8_GNUC_PREREQ(4, 1, 0)) 255 (!V8_CC_INTEL && V8_GNUC_PREREQ(4, 1, 0))
253 256
254 # define V8_HAS_BUILTIN_EXPECT (V8_GNUC_PREREQ(2, 96, 0)) 257 # define V8_HAS_BUILTIN_EXPECT (V8_GNUC_PREREQ(2, 96, 0))
255 258
256 // g++ requires -std=c++0x or -std=gnu++0x to support C++11 functionality 259 // g++ requires -std=c++0x or -std=gnu++0x to support C++11 functionality
257 // without warnings (functionality used by the macros below). These modes 260 // without warnings (functionality used by the macros below). These modes
258 // are detectable by checking whether __GXX_EXPERIMENTAL_CXX0X__ is defined or, 261 // are detectable by checking whether __GXX_EXPERIMENTAL_CXX0X__ is defined or,
259 // more standardly, by checking whether __cplusplus has a C++11 or greater 262 // more standardly, by checking whether __cplusplus has a C++11 or greater
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 #elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED 330 #elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED
328 # define V8_DEPRECATED(message, declarator) \ 331 # define V8_DEPRECATED(message, declarator) \
329 declarator __attribute__((deprecated)) 332 declarator __attribute__((deprecated))
330 #elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED 333 #elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED
331 # define V8_DEPRECATED(message, declarator) __declspec(deprecated) declarator 334 # define V8_DEPRECATED(message, declarator) __declspec(deprecated) declarator
332 #else 335 #else
333 # define V8_DEPRECATED(message, declarator) declarator 336 # define V8_DEPRECATED(message, declarator) declarator
334 #endif 337 #endif
335 338
336 339
340 // A macro to mark variables or types as unused, avoiding compiler warnings.
341 #if V8_HAS_ATTRIBUTE_UNUSED
342 # define V8_UNUSED __attribute__((unused))
343 #else
344 # define V8_UNUSED
345 #endif
346
347
337 // Annotate a function indicating the caller must examine the return value. 348 // Annotate a function indicating the caller must examine the return value.
338 // Use like: 349 // Use like:
339 // int foo() V8_WARN_UNUSED_RESULT; 350 // int foo() V8_WARN_UNUSED_RESULT;
340 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT 351 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
341 # define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) 352 # define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
342 #else 353 #else
343 # define V8_WARN_UNUSED_RESULT /* NOT SUPPORTED */ 354 # define V8_WARN_UNUSED_RESULT /* NOT SUPPORTED */
344 #endif 355 #endif
345 356
346 357
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 # define V8_ALIGNOF(type) __alignof__(type) 458 # define V8_ALIGNOF(type) __alignof__(type)
448 #else 459 #else
449 // Note that alignment of a type within a struct can be less than the 460 // Note that alignment of a type within a struct can be less than the
450 // alignment of the type stand-alone (because of ancient ABIs), so this 461 // alignment of the type stand-alone (because of ancient ABIs), so this
451 // should only be used as a last resort. 462 // should only be used as a last resort.
452 namespace v8 { template <typename T> class AlignOfHelper { char c; T t; }; } 463 namespace v8 { template <typename T> class AlignOfHelper { char c; T t; }; }
453 # define V8_ALIGNOF(type) (sizeof(::v8::AlignOfHelper<type>) - sizeof(type)) 464 # define V8_ALIGNOF(type) (sizeof(::v8::AlignOfHelper<type>) - sizeof(type))
454 #endif 465 #endif
455 466
456 #endif // V8CONFIG_H_ 467 #endif // V8CONFIG_H_
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/checks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698