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

Unified Diff: third_party/crashpad/crashpad/util/stdlib/aligned_allocator_test.cc

Issue 2932053002: Use C++11 alignment primitives (Closed)
Patch Set: Fix merge Created 3 years, 6 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 | « third_party/crashpad/crashpad/util/stdlib/aligned_allocator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/crashpad/crashpad/util/stdlib/aligned_allocator_test.cc
diff --git a/third_party/crashpad/crashpad/util/stdlib/aligned_allocator_test.cc b/third_party/crashpad/crashpad/util/stdlib/aligned_allocator_test.cc
index 66ee6e6c082bdec21897fd40ac2585e9e4e6d499..2799558ef60e6b4ab429ef2e64150438901de46f 100644
--- a/third_party/crashpad/crashpad/util/stdlib/aligned_allocator_test.cc
+++ b/third_party/crashpad/crashpad/util/stdlib/aligned_allocator_test.cc
@@ -40,30 +40,30 @@ TEST(AlignedAllocator, AlignedVector) {
AlignedVector<NaturalAlignedStruct> natural_aligned_vector;
natural_aligned_vector.push_back(NaturalAlignedStruct());
EXPECT_TRUE(
- IsAligned(&natural_aligned_vector[0], ALIGNOF(NaturalAlignedStruct)));
+ IsAligned(&natural_aligned_vector[0], alignof(NaturalAlignedStruct)));
natural_aligned_vector.resize(3);
EXPECT_TRUE(
- IsAligned(&natural_aligned_vector[0], ALIGNOF(NaturalAlignedStruct)));
+ IsAligned(&natural_aligned_vector[0], alignof(NaturalAlignedStruct)));
EXPECT_TRUE(
- IsAligned(&natural_aligned_vector[1], ALIGNOF(NaturalAlignedStruct)));
+ IsAligned(&natural_aligned_vector[1], alignof(NaturalAlignedStruct)));
EXPECT_TRUE(
- IsAligned(&natural_aligned_vector[2], ALIGNOF(NaturalAlignedStruct)));
+ IsAligned(&natural_aligned_vector[2], alignof(NaturalAlignedStruct)));
// Test a structure that declares its own alignment.
- struct ALIGNAS(32) AlignedStruct {
+ struct alignas(32) AlignedStruct {
int i;
};
- ASSERT_EQ(ALIGNOF(AlignedStruct), 32u);
+ ASSERT_EQ(alignof(AlignedStruct), 32u);
AlignedVector<AlignedStruct> aligned_vector;
aligned_vector.push_back(AlignedStruct());
- EXPECT_TRUE(IsAligned(&aligned_vector[0], ALIGNOF(AlignedStruct)));
+ EXPECT_TRUE(IsAligned(&aligned_vector[0], alignof(AlignedStruct)));
aligned_vector.resize(3);
- EXPECT_TRUE(IsAligned(&aligned_vector[0], ALIGNOF(AlignedStruct)));
- EXPECT_TRUE(IsAligned(&aligned_vector[1], ALIGNOF(AlignedStruct)));
- EXPECT_TRUE(IsAligned(&aligned_vector[2], ALIGNOF(AlignedStruct)));
+ EXPECT_TRUE(IsAligned(&aligned_vector[0], alignof(AlignedStruct)));
+ EXPECT_TRUE(IsAligned(&aligned_vector[1], alignof(AlignedStruct)));
+ EXPECT_TRUE(IsAligned(&aligned_vector[2], alignof(AlignedStruct)));
// Try a custom alignment. Since the structure itself doesn’t specify an
// alignment constraint, only the base address will be aligned to the
@@ -73,19 +73,19 @@ TEST(AlignedAllocator, AlignedVector) {
EXPECT_TRUE(IsAligned(&custom_aligned_vector[0], 64));
// Try a structure with a pretty big alignment request.
- struct ALIGNAS(1024) BigAlignedStruct {
+ struct alignas(1024) BigAlignedStruct {
int i;
};
- ASSERT_EQ(ALIGNOF(BigAlignedStruct), 1024u);
+ ASSERT_EQ(alignof(BigAlignedStruct), 1024u);
AlignedVector<BigAlignedStruct> big_aligned_vector;
big_aligned_vector.push_back(BigAlignedStruct());
- EXPECT_TRUE(IsAligned(&big_aligned_vector[0], ALIGNOF(BigAlignedStruct)));
+ EXPECT_TRUE(IsAligned(&big_aligned_vector[0], alignof(BigAlignedStruct)));
big_aligned_vector.resize(3);
- EXPECT_TRUE(IsAligned(&big_aligned_vector[0], ALIGNOF(BigAlignedStruct)));
- EXPECT_TRUE(IsAligned(&big_aligned_vector[1], ALIGNOF(BigAlignedStruct)));
- EXPECT_TRUE(IsAligned(&big_aligned_vector[2], ALIGNOF(BigAlignedStruct)));
+ EXPECT_TRUE(IsAligned(&big_aligned_vector[0], alignof(BigAlignedStruct)));
+ EXPECT_TRUE(IsAligned(&big_aligned_vector[1], alignof(BigAlignedStruct)));
+ EXPECT_TRUE(IsAligned(&big_aligned_vector[2], alignof(BigAlignedStruct)));
}
void BadAlignmentTest() {
« no previous file with comments | « third_party/crashpad/crashpad/util/stdlib/aligned_allocator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698