Use std::max_align_t rather than __attribute__((__aligned__)) to get max alignment
authorChristopher Dykes <cdykes@fb.com>
Thu, 4 Aug 2016 23:32:18 +0000 (16:32 -0700)
committerFacebook Github Bot 5 <facebook-github-bot-5-bot@fb.com>
Thu, 4 Aug 2016 23:38:26 +0000 (16:38 -0700)
Summary: Because the former is standardized, and the latter is a syntax error under MSVC.

Reviewed By: yfeldblum

Differential Revision: D3672667

fbshipit-source-id: c0149b11367e36ba5574625240c41a167348199f

folly/test/ThreadCachedArenaTest.cpp

index 22ba10577bfe35fe272a15e6885269bb0749710b..9332c7397edd5059b4a5d97924e2ca2b0fa7d2c3 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <folly/Range.h>
 #include <folly/Benchmark.h>
+#include <folly/Portability.h>
 
 using namespace folly;
 
@@ -94,8 +95,7 @@ void ArenaTester::merge(ArenaTester&& other) {
 }  // namespace
 
 TEST(ThreadCachedArena, BlockSize) {
-  struct Align { char c; } __attribute__((__aligned__));
-  static const size_t alignment = alignof(Align);
+  static const size_t alignment = alignof(std::max_align_t);
   static const size_t requestedBlockSize = 64;
 
   ThreadCachedArena arena(requestedBlockSize);