[libcxx] r248309 - Remove possible trailing padding from aligned_storage. Patch from Yiran Wang

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 22 11:37:03 PDT 2015


Author: ericwf
Date: Tue Sep 22 13:37:03 2015
New Revision: 248309

URL: http://llvm.org/viewvc/llvm-project?rev=248309&view=rev
Log:
Remove possible trailing padding from aligned_storage. Patch from Yiran Wang

Modified:
    libcxx/trunk/include/type_traits

Modified: libcxx/trunk/include/type_traits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=248309&r1=248308&r2=248309&view=diff
==============================================================================
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Tue Sep 22 13:37:03 2015
@@ -1190,7 +1190,7 @@ struct _LIBCPP_TYPE_VIS_ONLY aligned_sto
     union type
     {
         _Aligner __align;
-        unsigned char __data[_Len];
+        unsigned char __data[(_Len + _Align - 1)/_Align * _Align];
     };
 };
 
@@ -1205,7 +1205,7 @@ struct _LIBCPP_TYPE_VIS_ONLY aligned_sto
 {\
     struct _ALIGNAS(n) type\
     {\
-        unsigned char __lx[_Len];\
+        unsigned char __lx[(_Len + n - 1)/n * n];\
     };\
 }
 




More information about the cfe-commits mailing list