From 1f5ec68a5c17bdf277900dc998649f1543558b9a Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Sat, 6 May 2023 17:49:36 -0700 Subject: [PATCH] ams: fix compilation with gcc 13 --- .../include/mesosphere/kern_k_auto_object.hpp | 2 +- .../include/mesosphere/kern_k_typed_address.hpp | 4 ---- .../include/mesosphere/kern_slab_helpers.hpp | 3 ++- .../libmesosphere/source/svc/kern_svc_physical_memory.cpp | 2 +- .../sf/hipc/sf_hipc_server_domain_session_manager.cpp | 4 ++-- .../include/vapours/util/util_intrusive_list.hpp | 8 -------- .../vapours/util/util_intrusive_red_black_tree.hpp | 8 -------- stratosphere/ams_mitm/source/fs_mitm/fsmitm_romfs.cpp | 5 ++--- 8 files changed, 8 insertions(+), 28 deletions(-) diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_auto_object.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_auto_object.hpp index 9e42f572d..1b7b433b8 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_auto_object.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_auto_object.hpp @@ -257,7 +257,7 @@ namespace ams::kern { class KScopedAutoObject { NON_COPYABLE(KScopedAutoObject); private: - template + template requires std::derived_from friend class KScopedAutoObject; private: T *m_obj; diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_typed_address.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_typed_address.hpp index 1456977d3..5f8ba89d8 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_typed_address.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_typed_address.hpp @@ -120,10 +120,6 @@ namespace ams::kern { return m_address == rhs; } - constexpr ALWAYS_INLINE bool operator!=(uintptr_t rhs) const { - return m_address != rhs; - } - /* Allow getting the address explicitly, for use in accessors. */ constexpr ALWAYS_INLINE uintptr_t GetValue() const { return m_address; diff --git a/libraries/libmesosphere/include/mesosphere/kern_slab_helpers.hpp b/libraries/libmesosphere/include/mesosphere/kern_slab_helpers.hpp index 28b39e84a..6cf90555b 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_slab_helpers.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_slab_helpers.hpp @@ -164,8 +164,9 @@ namespace ams::kern { }; - template requires std::derived_from + template class KAutoObjectWithSlabHeapAndContainer : public KAutoObjectWithSlabHeapBase { + static_assert(std::derived_from); private: static constinit inline KAutoObjectWithListContainer s_container; public: diff --git a/libraries/libmesosphere/source/svc/kern_svc_physical_memory.cpp b/libraries/libmesosphere/source/svc/kern_svc_physical_memory.cpp index 1319bf1e2..fc5414905 100644 --- a/libraries/libmesosphere/source/svc/kern_svc_physical_memory.cpp +++ b/libraries/libmesosphere/source/svc/kern_svc_physical_memory.cpp @@ -27,7 +27,7 @@ namespace ams::kern::svc { R_UNLESS(size < ams::kern::MainMemorySizeMax, svc::ResultInvalidSize()); /* Set the heap size. */ - KProcessAddress address; + KProcessAddress address = Null; R_TRY(GetCurrentProcess().GetPageTable().SetHeapSize(std::addressof(address), size)); /* Set the output. */ diff --git a/libraries/libstratosphere/source/sf/hipc/sf_hipc_server_domain_session_manager.cpp b/libraries/libstratosphere/source/sf/hipc/sf_hipc_server_domain_session_manager.cpp index 6f16fa0e7..c1e6bdb6e 100644 --- a/libraries/libstratosphere/source/sf/hipc/sf_hipc_server_domain_session_manager.cpp +++ b/libraries/libstratosphere/source/sf/hipc/sf_hipc_server_domain_session_manager.cpp @@ -48,7 +48,7 @@ namespace ams::sf::hipc { AMS_ABORT_UNLESS(ServerManagerBase::CanAnyManageMitmServers()); /* Clone the forward service. */ - std::shared_ptr<::Service> new_forward_service = std::move(ServerSession::CreateForwardService()); + std::shared_ptr<::Service> new_forward_service = ServerSession::CreateForwardService(); R_ABORT_UNLESS(serviceClone(util::GetReference(m_session->m_forward_service).get(), new_forward_service.get())); R_ABORT_UNLESS(tagged_manager->RegisterMitmSession(server_handle, std::move(clone), std::move(new_forward_service))); } @@ -168,7 +168,7 @@ namespace ams::sf::hipc { R_ABORT_UNLESS(hipc::CreateSession(std::addressof(server_handle), std::addressof(client_handle))); /* Register. */ - std::shared_ptr<::Service> new_forward_service = std::move(ServerSession::CreateForwardService()); + std::shared_ptr<::Service> new_forward_service = ServerSession::CreateForwardService(); serviceCreate(new_forward_service.get(), new_forward_target); R_ABORT_UNLESS(m_manager->RegisterMitmSession(server_handle, std::move(object), std::move(new_forward_service))); diff --git a/libraries/libvapours/include/vapours/util/util_intrusive_list.hpp b/libraries/libvapours/include/vapours/util/util_intrusive_list.hpp index 783117bec..0eceec9eb 100644 --- a/libraries/libvapours/include/vapours/util/util_intrusive_list.hpp +++ b/libraries/libvapours/include/vapours/util/util_intrusive_list.hpp @@ -144,10 +144,6 @@ namespace ams::util { return m_node == rhs.m_node; } - constexpr ALWAYS_INLINE bool operator!=(const Iterator &rhs) const { - return !(*this == rhs); - } - constexpr ALWAYS_INLINE pointer operator->() const { return m_node; } @@ -355,10 +351,6 @@ namespace ams::util { return m_iterator == rhs.m_iterator; } - constexpr ALWAYS_INLINE bool operator!=(const Iterator &rhs) const { - return !(*this == rhs); - } - constexpr ALWAYS_INLINE pointer operator->() const { return std::addressof(Traits::GetParent(*m_iterator)); } 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 a25f0b783..0476fc9cc 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 @@ -94,10 +94,6 @@ namespace ams::util { return m_node == rhs.m_node; } - constexpr ALWAYS_INLINE bool operator!=(const Iterator &rhs) const { - return !(*this == rhs); - } - constexpr ALWAYS_INLINE pointer operator->() const { return m_node; } @@ -304,10 +300,6 @@ namespace ams::util { return m_impl == rhs.m_impl; } - constexpr ALWAYS_INLINE bool operator!=(const Iterator &rhs) const { - return !(*this == rhs); - } - constexpr ALWAYS_INLINE pointer operator->() const { return Traits::GetParent(std::addressof(*m_impl)); } diff --git a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_romfs.cpp b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_romfs.cpp index 576ab3122..542d5e202 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_romfs.cpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_romfs.cpp @@ -251,12 +251,11 @@ namespace ams::mitm::fs { using DirectoryTableWriter = TableWriter; using FileTableWriter = TableWriter; - constexpr inline u32 CalculatePathHash(u32 parent, const char *_path, u32 start, size_t path_len) { - const unsigned char *path = reinterpret_cast(_path); + constexpr inline u32 CalculatePathHash(u32 parent, const char *path, u32 start, size_t path_len) { u32 hash = parent ^ 123456789; for (size_t i = 0; i < path_len; i++) { hash = (hash >> 5) | (hash << 27); - hash ^= path[start + i]; + hash ^= static_cast(path[start + i]); } return hash; }