From a91ed7e3d220f14215e185278c25e0aaf9e27375 Mon Sep 17 00:00:00 2001 From: Tom Jackson Date: Thu, 6 Nov 2014 17:20:41 -0800 Subject: [PATCH] Remove volatile from MemoryMappingTest Summary: Not needed, I don't know why I put them there before. Test Plan: Run the unit test Reviewed By: njormrod@fb.com Subscribers: njormrod, folly-diffs@ FB internal diff: D1665689 Tasks: 5487902 Signature: t1:1665689:1415323144:0998e7f700a3b40652615a36c3b9c9f661fbdadf --- folly/test/MemoryMappingTest.cpp | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/folly/test/MemoryMappingTest.cpp b/folly/test/MemoryMappingTest.cpp index 2a18f206..428aa2bb 100644 --- a/folly/test/MemoryMappingTest.cpp +++ b/folly/test/MemoryMappingTest.cpp @@ -23,18 +23,17 @@ namespace folly { TEST(MemoryMapping, Basic) { File f = File::temporary(); { - MemoryMapping m(File(f.fd()), 0, sizeof(double), - MemoryMapping::writable()); - double volatile* d = m.asWritableRange().data(); + MemoryMapping m(File(f.fd()), 0, sizeof(double), MemoryMapping::writable()); + double* d = m.asWritableRange().data(); *d = 37 * M_PI; } { MemoryMapping m(File(f.fd()), 0, 3); - EXPECT_EQ(0, m.asRange().size()); //not big enough + EXPECT_EQ(0, m.asRange().size()); // not big enough } { MemoryMapping m(File(f.fd()), 0, sizeof(double)); - const double volatile* d = m.asRange().data(); + const double* d = m.asRange().data(); EXPECT_EQ(*d, 37 * M_PI); } } @@ -42,20 +41,20 @@ TEST(MemoryMapping, Basic) { TEST(MemoryMapping, Move) { File f = File::temporary(); { - MemoryMapping m(File(f.fd()), 0, sizeof(double) * 2, - MemoryMapping::writable()); - double volatile* d = m.asWritableRange().data(); + MemoryMapping m( + File(f.fd()), 0, sizeof(double) * 2, MemoryMapping::writable()); + double* d = m.asWritableRange().data(); d[0] = 37 * M_PI; MemoryMapping m2(std::move(m)); - double volatile* d2 = m2.asWritableRange().data(); + double* d2 = m2.asWritableRange().data(); d2[1] = 39 * M_PI; } { MemoryMapping m(File(f.fd()), 0, sizeof(double)); - const double volatile* d = m.asRange().data(); + const double* d = m.asRange().data(); EXPECT_EQ(d[0], 37 * M_PI); MemoryMapping m2(std::move(m)); - const double volatile* d2 = m2.asRange().data(); + const double* d2 = m2.asRange().data(); EXPECT_EQ(d2[1], 39 * M_PI); } } @@ -63,12 +62,11 @@ TEST(MemoryMapping, Move) { TEST(MemoryMapping, DoublyMapped) { File f = File::temporary(); // two mappings of the same memory, different addresses. - MemoryMapping mw(File(f.fd()), 0, sizeof(double), - MemoryMapping::writable()); + MemoryMapping mw(File(f.fd()), 0, sizeof(double), MemoryMapping::writable()); MemoryMapping mr(File(f.fd()), 0, sizeof(double)); - double volatile* dw = mw.asWritableRange().data(); - const double volatile* dr = mr.asRange().data(); + double* dw = mw.asWritableRange().data(); + const double* dr = mr.asRange().data(); // Show that it's truly the same value, even though the pointers differ EXPECT_NE(dw, dr); -- 2.34.1