I removed all uses of AlignedCharArray since the minimum MSVC version can handle alignas on char arrays correctly. We can therefore remove AlignedCharArray.
This patch also updates AlignedCharArrayUnion to use C++11.
Differential D65249
[NFC] use C++11 in AlignOf.h, remove AlignedCharArray jfb on Jul 24 2019, 4:01 PM. Authored by
Details
I removed all uses of AlignedCharArray since the minimum MSVC version can handle alignas on char arrays correctly. We can therefore remove AlignedCharArray. This patch also updates AlignedCharArrayUnion to use C++11.
Diff Detail
Event TimelineComment Actions This is the main event: https://reviews.llvm.org/D65249#change-IWk6CtRl45h6 Comment Actions I still think this concern applies: I'm not sure how to track down an 19.11 release to test if we can pass std::aligned_storage values through function calls on x86. We might be better off raising the minimum to 19.14, which is a more recent MSVC release in the 2017 track. I don't think it's too much to ask developers to use the most recent version of the 2017 compiler, they won't have to change IDEs. Comment Actions @BillyONeal do you know if 19.11 has the aligned_storage issue on x86? If it does then indeed we should raise the minimum version, I'll send an RFC. Comment Actions
aligned_storage is still capped at what the library can fake with unions. It would be an ABI break to change it to use alignas, so things where the x86 stack temporarily breaks T's usual alignment rules will affect it (and for all releases using VS2015's ABI). We recommend customers use alignas(T) unsigned char space[sizeof(T)] if they can't tolerate such limitations. Comment Actions Thanks! @rnk: how about I add a bit of code that wraps aligned_storage on all platforms except MSVC (where I'd implement it as Billy suggests). That would mean updating all the uses of aligned_storage to this LLVM one, but that's not a big deal. Comment Actions Why not just always use the alignas version? Or even better, not involve a library for something you can say in the core language at all? Comment Actions (In fact I observe many patterns in this review like: enum { Foo = alignof(void*); } and then a bunch of casting to treat it as a char buffer; if it was just born as a char buffer you can remove both the casts and the enum hack: alignas(void*) char x[1234]; Comment Actions I have concerns that some of the patches that you landed prior to this will cause issues with old versions of MSVC, but in isolation, this is fine, and if anyone complains, we can address it on a case-by-case basis. lgtm Comment Actions IIUC Billy correctly, the issue was just with aligned_storage, but if you roll your own (as I have) we're fine. If I'm wrong, these tests will fail on MSVC bots :) |