From d8a518b4db8ad7388da02a1e4692864fa8f2f752 Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Fri, 17 Mar 2023 19:44:09 +0800 Subject: Issue #2166 - Part 6: Remove mozilla::AlignedStorage Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1341951 --- mfbt/Alignment.h | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'mfbt') diff --git a/mfbt/Alignment.h b/mfbt/Alignment.h index 6dbf2eae66..13a5c8a354 100644 --- a/mfbt/Alignment.h +++ b/mfbt/Alignment.h @@ -98,36 +98,6 @@ struct AlignedElem<16> MOZ_ALIGNED_DECL(uint8_t elem, 16); }; -/* - * This utility pales in comparison to Boost's aligned_storage. The utility - * simply assumes that uint64_t is enough alignment for anyone. This may need - * to be extended one day... - * - * As an important side effect, pulling the storage into this template is - * enough obfuscation to confuse gcc's strict-aliasing analysis into not giving - * false negatives when we cast from the char buffer to whatever type we've - * constructed using the bytes. - */ -template -struct AlignedStorage -{ - union U - { - char mBytes[Nbytes]; - uint64_t mDummy; - } u; - - const void* addr() const { return u.mBytes; } - void* addr() { return u.mBytes; } - - AlignedStorage() = default; - - // AlignedStorage is non-copyable: the default copy constructor violates - // strict aliasing rules, per bug 1269319. - AlignedStorage(const AlignedStorage&) = delete; - void operator=(const AlignedStorage&) = delete; -}; - template struct MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS AlignedStorage2 { -- cgit v1.2.3