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

Side by Side 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: Final Fixes! Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium 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 BASE_COMPILER_SPECIFIC_H_ 5 #ifndef BASE_COMPILER_SPECIFIC_H_
6 #define BASE_COMPILER_SPECIFIC_H_ 6 #define BASE_COMPILER_SPECIFIC_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #if defined(COMPILER_MSVC) 10 #if defined(COMPILER_MSVC)
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // Specify memory alignment for structs, classes, etc. 107 // Specify memory alignment for structs, classes, etc.
108 // Use like: 108 // Use like:
109 // class ALIGNAS(16) MyClass { ... } 109 // class ALIGNAS(16) MyClass { ... }
110 // ALIGNAS(16) int array[4]; 110 // ALIGNAS(16) int array[4];
111 #if defined(COMPILER_MSVC) 111 #if defined(COMPILER_MSVC)
112 #define ALIGNAS(byte_alignment) __declspec(align(byte_alignment)) 112 #define ALIGNAS(byte_alignment) __declspec(align(byte_alignment))
113 #elif defined(COMPILER_GCC) 113 #elif defined(COMPILER_GCC)
114 #define ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment))) 114 #define ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment)))
115 #endif 115 #endif
116 116
117 // Return the byte alignment of the given type (available at compile time). 117 // Return the byte alignment of the given type (available at compile time). Use
118 // sizeof(type) prior to checking __alignof to workaround Visual C++ bug:
119 // http://connect.microsoft.com/VisualStudio/feedback/details/682695/c-alignof-f ails-to-properly-evalute-alignment-of-dependent-types
118 // Use like: 120 // Use like:
119 // ALIGNOF(int32) // this would be 4 121 // ALIGNOF(int32) // this would be 4
120 #if defined(COMPILER_MSVC) 122 #if defined(COMPILER_MSVC)
121 #define ALIGNOF(type) __alignof(type) 123 #define ALIGNOF(type) (sizeof(type) - sizeof(type) + __alignof(type))
122 #elif defined(COMPILER_GCC) 124 #elif defined(COMPILER_GCC)
123 #define ALIGNOF(type) __alignof__(type) 125 #define ALIGNOF(type) __alignof__(type)
124 #endif 126 #endif
125 127
126 // Annotate a virtual method indicating it must be overriding a virtual 128 // Annotate a virtual method indicating it must be overriding a virtual
127 // method in the parent class. 129 // method in the parent class.
128 // Use like: 130 // Use like:
129 // virtual void foo() OVERRIDE; 131 // virtual void foo() OVERRIDE;
130 #if defined(COMPILER_MSVC) 132 #if defined(COMPILER_MSVC)
131 #define OVERRIDE override 133 #define OVERRIDE override
(...skipping 26 matching lines...) Expand all
158 #endif 160 #endif
159 161
160 // WPRINTF_FORMAT is the same, but for wide format strings. 162 // WPRINTF_FORMAT is the same, but for wide format strings.
161 // This doesn't appear to yet be implemented in any compiler. 163 // This doesn't appear to yet be implemented in any compiler.
162 // See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38308 . 164 // See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38308 .
163 #define WPRINTF_FORMAT(format_param, dots_param) 165 #define WPRINTF_FORMAT(format_param, dots_param)
164 // If available, it would look like: 166 // If available, it would look like:
165 // __attribute__((format(wprintf, format_param, dots_param))) 167 // __attribute__((format(wprintf, format_param, dots_param)))
166 168
167 #endif // BASE_COMPILER_SPECIFIC_H_ 169 #endif // BASE_COMPILER_SPECIFIC_H_
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/memory/aligned_memory.h » ('j') | base/memory/aligned_memory.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698