diff --git a/libraries/libstratosphere/source/os/impl/os_waitable_holder_base.hpp b/libraries/libstratosphere/source/os/impl/os_waitable_holder_base.hpp index d0fd901b5..fd504653e 100644 --- a/libraries/libstratosphere/source/os/impl/os_waitable_holder_base.hpp +++ b/libraries/libstratosphere/source/os/impl/os_waitable_holder_base.hpp @@ -22,11 +22,11 @@ namespace ams::os::impl { class WaitableManagerImpl; class WaitableHolderBase { + private: + WaitableManagerImpl *manager = nullptr; public: util::IntrusiveListNode manager_node; util::IntrusiveListNode object_list_node; - private: - WaitableManagerImpl *manager = nullptr; public: /* Gets whether the held waitable is currently signaled. */ virtual TriBool IsSignaled() const = 0; diff --git a/libraries/libvapours/include/vapours/util/util_intrusive_list.hpp b/libraries/libvapours/include/vapours/util/util_intrusive_list.hpp index 42afcbf1c..c00e100bf 100644 --- a/libraries/libvapours/include/vapours/util/util_intrusive_list.hpp +++ b/libraries/libvapours/include/vapours/util/util_intrusive_list.hpp @@ -561,6 +561,9 @@ namespace ams::util { static constexpr Derived const &GetParent(IntrusiveListNode const &node) { return util::GetParentReference(&node); } + private: + static constexpr TYPED_STORAGE(Derived) DerivedStorage = {}; + static_assert(std::addressof(GetParent(GetNode(GetReference(DerivedStorage)))) == GetPointer(DerivedStorage)); }; template diff --git a/libraries/libvapours/include/vapours/util/util_intrusive_red_black_tree.hpp b/libraries/libvapours/include/vapours/util/util_intrusive_red_black_tree.hpp index 9feeb938f..01f7be282 100644 --- a/libraries/libvapours/include/vapours/util/util_intrusive_red_black_tree.hpp +++ b/libraries/libvapours/include/vapours/util/util_intrusive_red_black_tree.hpp @@ -250,11 +250,11 @@ namespace ams::util { friend class IntrusiveRedBlackTree; static constexpr IntrusiveRedBlackTreeNode *GetNode(Derived *parent) { - return &(parent->*Member); + return std::addressof(parent->*Member); } static constexpr IntrusiveRedBlackTreeNode const *GetNode(Derived const *parent) { - return &(parent->*Member); + return std::addressof(parent->*Member); } static constexpr Derived *GetParent(IntrusiveRedBlackTreeNode *node) { @@ -264,6 +264,9 @@ namespace ams::util { static constexpr Derived const *GetParent(IntrusiveRedBlackTreeNode const *node) { return util::GetParentPointer(node); } + private: + static constexpr TYPED_STORAGE(Derived) DerivedStorage = {}; + static_assert(std::addressof(GetParent(GetNode(GetPointer(DerivedStorage)))) == GetPointer(DerivedStorage)); }; template diff --git a/libraries/libvapours/include/vapours/util/util_parent_of_member.hpp b/libraries/libvapours/include/vapours/util/util_parent_of_member.hpp index 99c9821f8..8de42b9a4 100644 --- a/libraries/libvapours/include/vapours/util/util_parent_of_member.hpp +++ b/libraries/libvapours/include/vapours/util/util_parent_of_member.hpp @@ -169,7 +169,7 @@ namespace ams::util { /* Defines, for use by other code. */ -#define OFFSETOF(parent, member) (::ams::util::OffsetOf<&parent::member, parent>) +#define OFFSETOF(parent, member) (::ams::util::impl::OffsetOf<&parent::member, parent>) #define GET_PARENT_PTR(parent, member, _arg) (::ams::util::GetParentPointer<&parent::member, parent>(_arg))