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

Side by Side Diff: base/memory/singleton_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/memory/singleton.h ('k') | base/metrics/persistent_memory_allocator.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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 EXPECT_EQ(0u, reinterpret_cast<uintptr_t>(ptr) & (align - 1)) 269 EXPECT_EQ(0u, reinterpret_cast<uintptr_t>(ptr) & (align - 1))
270 270
271 TEST_F(SingletonTest, Alignment) { 271 TEST_F(SingletonTest, Alignment) {
272 using base::AlignedMemory; 272 using base::AlignedMemory;
273 273
274 // Create some static singletons with increasing sizes and alignment 274 // Create some static singletons with increasing sizes and alignment
275 // requirements. By ordering this way, the linker will need to do some work to 275 // requirements. By ordering this way, the linker will need to do some work to
276 // ensure proper alignment of the static data. 276 // ensure proper alignment of the static data.
277 AlignedTestSingleton<int32_t>* align4 = 277 AlignedTestSingleton<int32_t>* align4 =
278 AlignedTestSingleton<int32_t>::GetInstance(); 278 AlignedTestSingleton<int32_t>::GetInstance();
279 AlignedTestSingleton<AlignedMemory<8, 8>>* align8 =
280 AlignedTestSingleton<AlignedMemory<8, 8>>::GetInstance();
281 AlignedTestSingleton<AlignedMemory<16, 16>>* align16 =
282 AlignedTestSingleton<AlignedMemory<16, 16>>::GetInstance();
279 AlignedTestSingleton<AlignedMemory<32, 32> >* align32 = 283 AlignedTestSingleton<AlignedMemory<32, 32> >* align32 =
280 AlignedTestSingleton<AlignedMemory<32, 32> >::GetInstance(); 284 AlignedTestSingleton<AlignedMemory<32, 32> >::GetInstance();
281 AlignedTestSingleton<AlignedMemory<128, 128> >* align128 = 285 AlignedTestSingleton<AlignedMemory<64, 64>>* align64 =
282 AlignedTestSingleton<AlignedMemory<128, 128> >::GetInstance(); 286 AlignedTestSingleton<AlignedMemory<64, 64>>::GetInstance();
283 AlignedTestSingleton<AlignedMemory<4096, 4096> >* align4096 =
284 AlignedTestSingleton<AlignedMemory<4096, 4096> >::GetInstance();
285 287
286 EXPECT_ALIGNED(align4, 4); 288 EXPECT_ALIGNED(align4, 4);
289 EXPECT_ALIGNED(align8, 8);
290 EXPECT_ALIGNED(align16, 16);
287 EXPECT_ALIGNED(align32, 32); 291 EXPECT_ALIGNED(align32, 32);
288 EXPECT_ALIGNED(align128, 128); 292 EXPECT_ALIGNED(align64, 64);
289 EXPECT_ALIGNED(align4096, 4096);
290 } 293 }
291 294
292 } // namespace 295 } // namespace
293 } // namespace base 296 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/singleton.h ('k') | base/metrics/persistent_memory_allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698