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

Unified Diff: include/v8config.h

Issue 22979004: Revert "Add V8_ALIGNOF() and use that in lazy-instance.h." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/lazy-instance.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8config.h
diff --git a/include/v8config.h b/include/v8config.h
index 4f6cf7b7873421344328d19221323e013f48a5b5..aa24eebff50bb193543295723c9195ece613b8ec 100644
--- a/include/v8config.h
+++ b/include/v8config.h
@@ -86,31 +86,6 @@
#endif
-// This macro checks for a required GCC version. It also works with compilers
-// that pretend to be GCC, i.e. Clang, ICC or the ARM compiler with the --gnu
-// flag.
-// Use like this if you want to check for a GCC compatible version:
-// #if V8_GNUC_PREREQ(x, y, z)
-// ...
-// #endif
-//
-// Use like ths if you want to check for a specific GCC version:
-// #if V8_CC_GNU && V8_GNUC_PREREQ(x, y, z)
-// ...
-// #endif
-#if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
-# define V8_GNUC_PREREQ(major, minor, patchlevel) \
- ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= \
- ((major) * 10000 + (minor) * 100 + (patchlevel)))
-#elif defined(__GNUC__) && defined(__GNUC_MINOR__)
-# define V8_GNUC_PREREQ(major, minor, patchlevel) \
- ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= \
- ((major) * 10000 + (minor) * 100 + (patchlevel)))
-#else
-# define V8_GNUC_PREREQ(major, minor, patchlevel) 0
-#endif
-
-
// -----------------------------------------------------------------------------
// Compiler detection
//
@@ -122,7 +97,6 @@
// C++11 feature detection
//
// V8_HAS_CXX11_ALIGNAS - alignas specifier supported
-// V8_HAS_CXX11_ALIGNOF - alignas operator supported
// V8_HAS_CXX11_STATIC_ASSERT - static_assert() supported
// V8_HAS_CXX11_DELETE - deleted functions supported
// V8_HAS_CXX11_FINAL - final marker supported
@@ -130,9 +104,7 @@
//
// Compiler-specific feature detection
//
-// V8_HAS___ALIGNOF - __alignof(t) operator supported
-// V8_HAS___ALIGNOF__ - __alignof__(t) operator supported
-// V8_HAS_ATTRIBUTE_ALIGNED - __attribute__((aligned(n))) supported
+// V8_HAS_ATTRIBUTE___ALIGNED__ - __attribute__((__aligned__(n))) supported
// V8_HAS_ATTRIBUTE_ALWAYS_INLINE - __attribute__((always_inline)) supported
// V8_HAS_ATTRIBUTE_DEPRECATED - __attribute__((deprecated)) supported
// V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported
@@ -145,11 +117,12 @@
#if defined(__clang__)
-# define V8_CC_CLANG 1
+// Don't treat clang as GCC.
+# define V8_GNUC_PREREQ(major, minor, patchlevel) 0
-# define V8_HAS___ALIGNOF__ (V8_GNUC_PREREQ(2, 95, 0))
+# define V8_CC_CLANG 1
-# define V8_HAS_ATTRIBUTE_ALIGNED (__has_attribute(aligned))
+# define V8_HAS_ATTRIBUTE___ALIGNED__ (__has_attribute(__aligned__))
# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
# define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated))
# define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
@@ -164,14 +137,16 @@
#elif defined(__GNUC__)
+# define V8_GNUC_PREREQ(major, minor, patchlevel) \
+ ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= \
+ ((major) * 10000 + (minor) * 100 + (patchlevel)))
+
# define V8_CC_GNU 1
# if defined(__MINGW32__)
# define V8_CC_MINGW 1
# endif
-# define V8_HAS___ALIGNOF__ (V8_GNUC_PREREQ(2, 95, 0))
-
-# define V8_HAS_ATTRIBUTE_ALIGNED (V8_GNUC_PREREQ(2, 95, 0))
+# define V8_HAS_ATTRIBUTE___ALIGNED__ (V8_GNUC_PREREQ(2, 95, 0))
// always_inline is available in gcc 4.0 but not very reliable until 4.4.
// Works around "sorry, unimplemented: inlining failed" build errors with
// older compilers.
@@ -189,7 +164,6 @@
// both for forward compatibility.
# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
# define V8_HAS_CXX11_ALIGNAS (V8_GNUC_PREREQ(4, 8, 0))
-# define V8_HAS_CXX11_ALIGNOF (V8_GNUC_PREREQ(4, 5, 0))
# define V8_HAS_CXX11_STATIC_ASSERT (V8_GNUC_PREREQ(4, 3, 0))
# define V8_HAS_CXX11_DELETE (V8_GNUC_PREREQ(4, 4, 0))
# define V8_HAS_CXX11_OVERRIDE (V8_GNUC_PREREQ(4, 7, 0))
@@ -201,6 +175,8 @@
#elif defined(_MSC_VER)
+# define V8_GNUC_PREREQ(major, minor, patchlevel) 0
+
# define V8_CC_MSVC 1
// Override control was added with Visual Studio 2005, but
@@ -212,7 +188,6 @@
# define V8_HAS_DECLSPEC_ALIGN 1
# define V8_HAS_DECLSPEC_DEPRECATED (_MSC_VER >= 1300)
-# define V8_HAS___ALIGNOF 1
# define V8_HAS___FORCEINLINE 1
#endif
@@ -304,28 +279,12 @@
// V8_ALIGNAS(32) int array[42];
#if V8_HAS_CXX11_ALIGNAS
# define V8_ALIGNAS(n) alignas(n)
-#elif V8_HAS_ATTRIBUTE_ALIGNED
-# define V8_ALIGNAS(n) __attribute__((aligned(n)))
+#elif V8_HAS_ATTRIBUTE___ALIGNED__
+# define V8_ALIGNAS(n) __attribute__((__aligned__(n)))
#elif V8_HAS_DECLSPEC_ALIGN
# define V8_ALIGNAS(n) __declspec(align(n))
#else
# define V8_ALIGNAS(n) /* NOT SUPPORTED */
#endif
-// This macro takes a type and returns the power of 2 byte boundary on which
-// the type instances must be allocated.
-// Use like:
-// size_t alignment = V8_ALIGNOF(double);
-// V8_ALIGNAS(V8_ALIGNOF(void*)) int x;
-#if V8_HAS_CXX11_ALIGNOF
-# define V8_ALIGNOF(t) alignof(t)
-#elif V8_HAS___ALIGNOF
-# define V8_ALIGNOF(t) __alignof(t)
-#elif V8_HAS___ALIGNOF__
-# define V8_ALIGNOF(t) __alignof__(t)
-#else
-namespace v8 { template <typename T> struct AlignOfHelper { char x; T t; }; }
-# define V8_ALIGNOF(t) (sizeof(::v8::AlignOfHelper<t>) - sizeof(t))
-#endif
-
#endif // V8CONFIG_H_
« no previous file with comments | « no previous file | src/lazy-instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698