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

Side by Side Diff: base/memory/singleton_unittest.cc

Issue 2670873002: Remove base's ALIGNOF/ALIGNAS in favor of alignof/alignas. (Closed)
Patch Set: #if / #endif all the things 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
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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
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<32, 32> >* align32 = 279 AlignedTestSingleton<AlignedMemory<32, 32> >* align32 =
280 AlignedTestSingleton<AlignedMemory<32, 32> >::GetInstance(); 280 AlignedTestSingleton<AlignedMemory<32, 32> >::GetInstance();
281 // GCC doesn't like alignment >64 on ARM.
danakj 2017/02/08 21:29:47 Same?
dcheng 2017/02/09 00:01:24 Done.
282 #if !defined(ARCH_CPU_ARM_FAMILY) || defined(__clang__)
281 AlignedTestSingleton<AlignedMemory<128, 128> >* align128 = 283 AlignedTestSingleton<AlignedMemory<128, 128> >* align128 =
282 AlignedTestSingleton<AlignedMemory<128, 128> >::GetInstance(); 284 AlignedTestSingleton<AlignedMemory<128, 128> >::GetInstance();
283 AlignedTestSingleton<AlignedMemory<4096, 4096> >* align4096 = 285 AlignedTestSingleton<AlignedMemory<4096, 4096> >* align4096 =
284 AlignedTestSingleton<AlignedMemory<4096, 4096> >::GetInstance(); 286 AlignedTestSingleton<AlignedMemory<4096, 4096> >::GetInstance();
287 #endif
285 288
286 EXPECT_ALIGNED(align4, 4); 289 EXPECT_ALIGNED(align4, 4);
287 EXPECT_ALIGNED(align32, 32); 290 EXPECT_ALIGNED(align32, 32);
291 // GCC doesn't like alignment >64 on ARM.
292 #if !defined(ARCH_CPU_ARM_FAMILY) || defined(__clang__)
288 EXPECT_ALIGNED(align128, 128); 293 EXPECT_ALIGNED(align128, 128);
289 EXPECT_ALIGNED(align4096, 4096); 294 EXPECT_ALIGNED(align4096, 4096);
295 #endif
290 } 296 }
291 297
292 } // namespace 298 } // namespace
293 } // namespace base 299 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698