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

Side by Side Diff: base/lazy_instance_unittest.cc

Issue 2670873002: Remove base's ALIGNOF/ALIGNAS in favor of alignof/alignas. (Closed)
Patch Set: rebase Created 3 years, 10 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 | « base/lazy_instance.h ('k') | base/memory/aligned_memory.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 (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 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/atomic_sequence_num.h" 8 #include "base/atomic_sequence_num.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/memory/aligned_memory.h" 10 #include "base/memory/aligned_memory.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 EXPECT_EQ(0u, reinterpret_cast<uintptr_t>(ptr) & (align - 1)) 159 EXPECT_EQ(0u, reinterpret_cast<uintptr_t>(ptr) & (align - 1))
160 160
161 TEST(LazyInstanceTest, Alignment) { 161 TEST(LazyInstanceTest, Alignment) {
162 using base::LazyInstance; 162 using base::LazyInstance;
163 163
164 // Create some static instances with increasing sizes and alignment 164 // Create some static instances with increasing sizes and alignment
165 // requirements. By ordering this way, the linker will need to do some work to 165 // requirements. By ordering this way, the linker will need to do some work to
166 // ensure proper alignment of the static data. 166 // ensure proper alignment of the static data.
167 static LazyInstance<AlignedData<4> > align4 = LAZY_INSTANCE_INITIALIZER; 167 static LazyInstance<AlignedData<4> > align4 = LAZY_INSTANCE_INITIALIZER;
168 static LazyInstance<AlignedData<32> > align32 = LAZY_INSTANCE_INITIALIZER; 168 static LazyInstance<AlignedData<32> > align32 = LAZY_INSTANCE_INITIALIZER;
169 static LazyInstance<AlignedData<4096> > align4096 = LAZY_INSTANCE_INITIALIZER; 169 static LazyInstance<AlignedData<64>> align64 = LAZY_INSTANCE_INITIALIZER;
170 170
171 EXPECT_ALIGNED(align4.Pointer(), 4); 171 EXPECT_ALIGNED(align4.Pointer(), 4);
172 EXPECT_ALIGNED(align32.Pointer(), 32); 172 EXPECT_ALIGNED(align32.Pointer(), 32);
173 EXPECT_ALIGNED(align4096.Pointer(), 4096); 173 EXPECT_ALIGNED(align64.Pointer(), 64);
174 } 174 }
OLDNEW
« no previous file with comments | « base/lazy_instance.h ('k') | base/memory/aligned_memory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698