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

Unified Diff: base/compiler_specific.h

Issue 10796020: Upgrade AlignedMemory to support dynamic allocations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change AlignedMemory back to POD. Retry now that NaCl fixed. Created 8 years, 5 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 | « base/base.gypi ('k') | base/memory/aligned_memory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/compiler_specific.h
diff --git a/base/compiler_specific.h b/base/compiler_specific.h
index 64273a98db93c4fc0158690958bc7cd4de225d32..5d7d9d11019bd22bc0a9c9e28f06ccb036566a5e 100644
--- a/base/compiler_specific.h
+++ b/base/compiler_specific.h
@@ -114,11 +114,13 @@
#define ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment)))
#endif
-// Return the byte alignment of the given type (available at compile time).
+// Return the byte alignment of the given type (available at compile time). Use
+// sizeof(type) prior to checking __alignof to workaround Visual C++ bug:
+// http://goo.gl/isH0C
// Use like:
// ALIGNOF(int32) // this would be 4
#if defined(COMPILER_MSVC)
-#define ALIGNOF(type) __alignof(type)
+#define ALIGNOF(type) (sizeof(type) - sizeof(type) + __alignof(type))
#elif defined(COMPILER_GCC)
#define ALIGNOF(type) __alignof__(type)
#endif
« no previous file with comments | « base/base.gypi ('k') | base/memory/aligned_memory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698