From e8f1efd01bde65c7b2ae4ed9c000a62043fd990b Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Wed, 6 Oct 2021 17:58:42 -0700 Subject: [PATCH] libstrat: fix compilation without pre-compiled header/without lto --- .../include/stratosphere/fs/fs_istorage.hpp | 2 ++ .../stratosphere/fs/fs_memory_storage.hpp | 3 +++ .../stratosphere/fs/fs_read_only_filesystem.hpp | 2 ++ .../stratosphere/fs/fs_remote_filesystem.hpp | 2 ++ .../stratosphere/fs/fs_remote_storage.hpp | 1 + .../include/stratosphere/fs/fsa/fs_ifile.hpp | 5 +++++ .../stratosphere/fs/fsa/fs_ifilesystem.hpp | 5 +++++ .../include/stratosphere/fs/impl/fs_newable.hpp | 1 + .../fssrv_memory_resource_from_exp_heap.hpp | 3 +++ ...v_memory_resource_from_standard_allocator.hpp | 1 + .../buffers/fssystem_file_system_buddy_heap.hpp | 2 ++ .../fssystem_file_system_buffer_manager.hpp | 2 ++ ...fssystem_aes_ctr_counter_extended_storage.hpp | 2 ++ .../fssystem/fssystem_indirect_storage.hpp | 2 ++ .../fssystem_integrity_romfs_storage.hpp | 2 +- .../fssystem/fssystem_sparse_storage.hpp | 5 +++++ .../fssystem_thread_priority_changer.hpp | 12 ++++++------ .../fssystem_block_cache_buffered_storage.hpp | 2 +- ...erarchical_integrity_verification_storage.hpp | 2 +- .../fssystem_integrity_verification_storage.hpp | 2 +- .../stratosphere/ncm/ncm_content_info_data.hpp | 16 ++++++++-------- .../ncm/ncm_content_manager_impl.hpp | 1 + .../stratosphere/ncm/ncm_content_meta_id.hpp | 2 +- .../stratosphere/ncm/ncm_install_task_base.hpp | 2 +- .../ncm/ncm_system_content_meta_id.hpp | 14 +++++++------- .../powctl/driver/impl/powctl_charge_arbiter.hpp | 2 +- .../sf/hipc/sf_hipc_server_manager.hpp | 1 + .../sf/hipc/sf_hipc_server_session_manager.hpp | 1 + .../sf/impl/sf_impl_command_serialization.hpp | 1 + .../stratosphere/sf/sf_exp_heap_allocator.hpp | 4 +++- .../include/stratosphere/sf/sf_lmem_utility.hpp | 5 +++++ .../include/stratosphere/sf/sf_mem_utility.hpp | 1 + .../source/htc/server/rpc/htc_rpc_client.cpp | 3 +++ .../source/lm/lm_remote_log_service.cpp | 2 +- .../mem/impl/mem_impl_platform.os.horizon.cpp | 5 ++++- .../source/ncm/ncm_install_task_base.cpp | 2 +- .../os/impl/os_address_space_allocator.cpp | 2 +- 37 files changed, 89 insertions(+), 33 deletions(-) diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_istorage.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_istorage.hpp index 0f6fff4ae..8d026a9f5 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_istorage.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_istorage.hpp @@ -98,11 +98,13 @@ namespace ams::fs { virtual Result Write(s64 offset, const void *buffer, size_t size) override { /* TODO: Better result? Is it possible to get a more specific one? */ + AMS_UNUSED(offset, buffer, size); return fs::ResultUnsupportedOperation(); } virtual Result SetSize(s64 size) override { /* TODO: Better result? Is it possible to get a more specific one? */ + AMS_UNUSED(size); return fs::ResultUnsupportedOperation(); } }; diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_memory_storage.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_memory_storage.hpp index 3393ee37a..7a1881ebd 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_memory_storage.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_memory_storage.hpp @@ -63,10 +63,13 @@ namespace ams::fs { } virtual Result SetSize(s64 size) override { + AMS_UNUSED(size); return fs::ResultUnsupportedOperationInMemoryStorageA(); } virtual Result OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override { + AMS_UNUSED(offset, size, src, src_size); + switch (op_id) { case OperationId::Invalidate: return ResultSuccess(); diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_read_only_filesystem.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_read_only_filesystem.hpp index 2610f29f5..c766dcfa4 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_read_only_filesystem.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_read_only_filesystem.hpp @@ -46,10 +46,12 @@ namespace ams::fs { } virtual Result DoWrite(s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) override final { + AMS_UNUSED(offset, buffer, size, option); return fs::ResultUnsupportedOperationInReadOnlyFileA(); } virtual Result DoSetSize(s64 size) override final { + AMS_UNUSED(size); return fs::ResultUnsupportedOperationInReadOnlyFileA(); } diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_remote_filesystem.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_remote_filesystem.hpp index a35bd7d2d..456664470 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_remote_filesystem.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_remote_filesystem.hpp @@ -53,6 +53,8 @@ namespace ams::fs { } virtual Result DoOperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override final { + AMS_UNUSED(src, src_size); + R_UNLESS(op_id == OperationId::QueryRange, fs::ResultUnsupportedOperationInFileServiceObjectAdapterA()); R_UNLESS(dst_size == sizeof(FileQueryRangeInfo), fs::ResultInvalidSize()); diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_remote_storage.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_remote_storage.hpp index 8a905713c..972208508 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_remote_storage.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_remote_storage.hpp @@ -53,6 +53,7 @@ namespace ams::fs { virtual Result OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override { /* TODO: How to deal with this? */ + AMS_UNUSED(dst, dst_size, op_id, offset, size, src, src_size); return fs::ResultUnsupportedOperation(); }; }; diff --git a/libraries/libstratosphere/include/stratosphere/fs/fsa/fs_ifile.hpp b/libraries/libstratosphere/include/stratosphere/fs/fsa/fs_ifile.hpp index 79be8ddf5..fb9f1c58b 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fsa/fs_ifile.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fsa/fs_ifile.hpp @@ -84,6 +84,8 @@ namespace ams::fs::fsa { virtual sf::cmif::DomainObjectId GetDomainObjectId() const = 0; protected: Result DryRead(size_t *out, s64 offset, size_t size, const fs::ReadOption &option, OpenMode open_mode) { + AMS_UNUSED(option); + /* Check that we can read. */ R_UNLESS((open_mode & OpenMode_Read) != 0, fs::ResultReadNotPermitted()); @@ -101,11 +103,14 @@ namespace ams::fs::fsa { R_UNLESS((open_mode & OpenMode_Write) != 0, fs::ResultWriteNotPermitted()); AMS_ASSERT(size >= 0); + AMS_UNUSED(size); return ResultSuccess(); } Result DryWrite(bool *out_append, s64 offset, size_t size, const fs::WriteOption &option, fs::OpenMode open_mode) { + AMS_UNUSED(option); + /* Check that we can write. */ R_UNLESS((open_mode & OpenMode_Write) != 0, fs::ResultWriteNotPermitted()); diff --git a/libraries/libstratosphere/include/stratosphere/fs/fsa/fs_ifilesystem.hpp b/libraries/libstratosphere/include/stratosphere/fs/fsa/fs_ifilesystem.hpp index 496ccdcf9..fbf1ad690 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fsa/fs_ifilesystem.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fsa/fs_ifilesystem.hpp @@ -159,25 +159,30 @@ namespace ams::fs::fsa { virtual Result DoCommit() = 0; virtual Result DoGetFreeSpaceSize(s64 *out, const char *path) { + AMS_UNUSED(out, path); return fs::ResultNotImplemented(); } virtual Result DoGetTotalSpaceSize(s64 *out, const char *path) { + AMS_UNUSED(out, path); return fs::ResultNotImplemented(); } virtual Result DoCleanDirectoryRecursively(const char *path) = 0; virtual Result DoGetFileTimeStampRaw(fs::FileTimeStampRaw *out, const char *path) { + AMS_UNUSED(out, path); return fs::ResultNotImplemented(); } virtual Result DoQueryEntry(char *dst, size_t dst_size, const char *src, size_t src_size, fs::fsa::QueryId query, const char *path) { + AMS_UNUSED(dst, dst_size, src, src_size, query, path); return fs::ResultNotImplemented(); } /* These aren't accessible as commands. */ virtual Result DoCommitProvisionally(s64 counter) { + AMS_UNUSED(counter); return fs::ResultNotImplemented(); } diff --git a/libraries/libstratosphere/include/stratosphere/fs/impl/fs_newable.hpp b/libraries/libstratosphere/include/stratosphere/fs/impl/fs_newable.hpp index 586e5939c..6924ac59c 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/impl/fs_newable.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/impl/fs_newable.hpp @@ -25,6 +25,7 @@ namespace ams::fs::impl { } static ALWAYS_INLINE void *operator new(size_t size, Newable *placement) noexcept { + AMS_UNUSED(size); return placement; } diff --git a/libraries/libstratosphere/include/stratosphere/fssrv/fssrv_memory_resource_from_exp_heap.hpp b/libraries/libstratosphere/include/stratosphere/fssrv/fssrv_memory_resource_from_exp_heap.hpp index bfc65dd9d..7393e5e1d 100644 --- a/libraries/libstratosphere/include/stratosphere/fssrv/fssrv_memory_resource_from_exp_heap.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssrv/fssrv_memory_resource_from_exp_heap.hpp @@ -31,10 +31,12 @@ namespace ams::fssrv { } virtual void DeallocateImpl(void *p, size_t size, size_t align) override { + AMS_UNUSED(size, align); return lmem::FreeToExpHeap(this->heap_handle, p); } virtual bool IsEqualImpl(const MemoryResource &rhs) const override { + AMS_UNUSED(rhs); return false; } }; @@ -67,6 +69,7 @@ namespace ams::fssrv { virtual void *AllocateImpl(size_t size, size_t align) override; virtual void DeallocateImpl(void *p, size_t size, size_t align) override; virtual bool IsEqualImpl(const MemoryResource &rhs) const override { + AMS_UNUSED(rhs); return false; } }; diff --git a/libraries/libstratosphere/include/stratosphere/fssrv/fssrv_memory_resource_from_standard_allocator.hpp b/libraries/libstratosphere/include/stratosphere/fssrv/fssrv_memory_resource_from_standard_allocator.hpp index de30f9f36..566c5b954 100644 --- a/libraries/libstratosphere/include/stratosphere/fssrv/fssrv_memory_resource_from_standard_allocator.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssrv/fssrv_memory_resource_from_standard_allocator.hpp @@ -44,6 +44,7 @@ namespace ams::fssrv { virtual void *AllocateImpl(size_t size, size_t align) override; virtual void DeallocateImpl(void *p, size_t size, size_t align) override; virtual bool IsEqualImpl(const MemoryResource &rhs) const override { + AMS_UNUSED(rhs); return false; } }; diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/buffers/fssystem_file_system_buddy_heap.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/buffers/fssystem_file_system_buddy_heap.hpp index 01a446618..5bc42e6bd 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/buffers/fssystem_file_system_buddy_heap.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/buffers/fssystem_file_system_buddy_heap.hpp @@ -97,6 +97,8 @@ namespace ams::fssystem { Result Initialize(uintptr_t address, size_t size, size_t block_size, s32 order_max, void *work, size_t work_size) { AMS_ASSERT(work_size >= QueryWorkBufferSize(order_max)); + AMS_UNUSED(work_size); + const auto aligned_work = util::AlignUp(reinterpret_cast(work), alignof(PageList)); this->external_free_lists = reinterpret_cast(aligned_work); return this->Initialize(address, size, block_size, order_max); diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/buffers/fssystem_file_system_buffer_manager.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/buffers/fssystem_file_system_buffer_manager.hpp index c84ee1713..676bb0a65 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/buffers/fssystem_file_system_buffer_manager.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/buffers/fssystem_file_system_buffer_manager.hpp @@ -178,10 +178,12 @@ namespace ams::fssystem { AttrInfo *FindAttrInfo(const BufferAttribute &attr); s32 GetCacheCountMin(const BufferAttribute &attr) { + AMS_UNUSED(attr); return this->cache_count_min; } size_t GetCacheSizeMin(const BufferAttribute &attr) { + AMS_UNUSED(attr); return this->cache_size_min; } }; diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_aes_ctr_counter_extended_storage.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_aes_ctr_counter_extended_storage.hpp index c591a5511..8e8c891c7 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_aes_ctr_counter_extended_storage.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_aes_ctr_counter_extended_storage.hpp @@ -103,10 +103,12 @@ namespace ams::fssystem { } virtual Result Write(s64 offset, const void *buffer, size_t size) override { + AMS_UNUSED(offset, buffer, size); return fs::ResultUnsupportedOperationInAesCtrCounterExtendedStorageA(); } virtual Result SetSize(s64 size) override { + AMS_UNUSED(size); return fs::ResultUnsupportedOperationInAesCtrCounterExtendedStorageB(); } private: diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_indirect_storage.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_indirect_storage.hpp index 7b65b798c..c1145ec4b 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_indirect_storage.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_indirect_storage.hpp @@ -142,10 +142,12 @@ namespace ams::fssystem { } virtual Result Write(s64 offset, const void *buffer, size_t size) override { + AMS_UNUSED(offset, buffer, size); return fs::ResultUnsupportedOperationInIndirectStorageA(); } virtual Result SetSize(s64 size) override { + AMS_UNUSED(size); return fs::ResultUnsupportedOperationInIndirectStorageB(); } protected: diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_integrity_romfs_storage.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_integrity_romfs_storage.hpp index e7f34a81b..2ef964bbb 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_integrity_romfs_storage.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_integrity_romfs_storage.hpp @@ -48,7 +48,7 @@ namespace ams::fssystem { return this->integrity_storage.Write(offset, buffer, size); } - virtual Result SetSize(s64 size) override { return fs::ResultUnsupportedOperationInIntegrityRomFsStorageA(); } + virtual Result SetSize(s64 size) override { AMS_UNUSED(size); return fs::ResultUnsupportedOperationInIntegrityRomFsStorageA(); } virtual Result GetSize(s64 *out) override { return this->integrity_storage.GetSize(out); diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_sparse_storage.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_sparse_storage.hpp index 9ea5aac86..b3639bde2 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_sparse_storage.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_sparse_storage.hpp @@ -31,6 +31,8 @@ namespace ams::fssystem { virtual Result Read(s64 offset, void *buffer, size_t size) override { AMS_ASSERT(offset >= 0); AMS_ASSERT(buffer != nullptr || size == 0); + AMS_UNUSED(offset); + if (size > 0) { std::memset(buffer, 0, size); } @@ -38,6 +40,7 @@ namespace ams::fssystem { } virtual Result OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override { + AMS_UNUSED(dst, dst_size, op_id, offset, size, src, src_size); return ResultSuccess(); } @@ -52,10 +55,12 @@ namespace ams::fssystem { } virtual Result Write(s64 offset, const void *buffer, size_t size) override { + AMS_UNUSED(offset, buffer, size); return fs::ResultUnsupportedOperationInZeroStorageA(); } virtual Result SetSize(s64 size) override { + AMS_UNUSED(size); return fs::ResultUnsupportedOperationInZeroStorageB(); } }; diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_thread_priority_changer.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_thread_priority_changer.hpp index 046c3fdc0..dc6c90ea8 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_thread_priority_changer.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_thread_priority_changer.hpp @@ -26,16 +26,16 @@ namespace ams::fssystem { Relative, }; private: - os::ThreadType *thread; - s32 priority; + os::ThreadType *m_thread; + s32 m_priority; public: - ALWAYS_INLINE explicit ScopedThreadPriorityChanger(s32 prio, Mode mode) : thread(os::GetCurrentThread()), priority(0) { - const auto result_priority = std::min((mode == Mode::Relative) ? os::GetThreadPriority(this->thread) + priority : priority, os::LowestSystemThreadPriority); - this->priority = os::ChangeThreadPriority(thread, result_priority); + ALWAYS_INLINE explicit ScopedThreadPriorityChanger(s32 priority, Mode mode) : m_thread(os::GetCurrentThread()), m_priority(0) { + const auto result_priority = std::min((mode == Mode::Relative) ? os::GetThreadPriority(m_thread) + priority : priority, os::LowestSystemThreadPriority); + m_priority = os::ChangeThreadPriority(m_thread, result_priority); } ALWAYS_INLINE ~ScopedThreadPriorityChanger() { - os::ChangeThreadPriority(this->thread, this->priority); + os::ChangeThreadPriority(m_thread, m_priority); } }; diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/save/fssystem_block_cache_buffered_storage.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/save/fssystem_block_cache_buffered_storage.hpp index c28cb47da..8def5bd0c 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/save/fssystem_block_cache_buffered_storage.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/save/fssystem_block_cache_buffered_storage.hpp @@ -84,7 +84,7 @@ namespace ams::fssystem::save { virtual Result Read(s64 offset, void *buffer, size_t size) override; virtual Result Write(s64 offset, const void *buffer, size_t size) override; - virtual Result SetSize(s64 size) override { return fs::ResultUnsupportedOperationInBlockCacheBufferedStorageA(); } + virtual Result SetSize(s64 size) override { AMS_UNUSED(size); return fs::ResultUnsupportedOperationInBlockCacheBufferedStorageA(); } virtual Result GetSize(s64 *out) override; virtual Result Flush() override; diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/save/fssystem_hierarchical_integrity_verification_storage.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/save/fssystem_hierarchical_integrity_verification_storage.hpp index 384db909f..95803cdec 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/save/fssystem_hierarchical_integrity_verification_storage.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/save/fssystem_hierarchical_integrity_verification_storage.hpp @@ -163,7 +163,7 @@ namespace ams::fssystem::save { virtual Result Read(s64 offset, void *buffer, size_t size) override; virtual Result Write(s64 offset, const void *buffer, size_t size) override; - virtual Result SetSize(s64 size) override { return fs::ResultUnsupportedOperationInHierarchicalIntegrityVerificationStorageA(); } + virtual Result SetSize(s64 size) override { AMS_UNUSED(size); return fs::ResultUnsupportedOperationInHierarchicalIntegrityVerificationStorageA(); } virtual Result GetSize(s64 *out) override; virtual Result Flush() override; diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/save/fssystem_integrity_verification_storage.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/save/fssystem_integrity_verification_storage.hpp index b3569977b..e3d274763 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/save/fssystem_integrity_verification_storage.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/save/fssystem_integrity_verification_storage.hpp @@ -57,7 +57,7 @@ namespace ams::fssystem::save { virtual Result Read(s64 offset, void *buffer, size_t size) override; virtual Result Write(s64 offset, const void *buffer, size_t size) override; - virtual Result SetSize(s64 size) override { return fs::ResultUnsupportedOperationInIntegrityVerificationStorageA(); } + virtual Result SetSize(s64 size) override { AMS_UNUSED(size); return fs::ResultUnsupportedOperationInIntegrityVerificationStorageA(); } virtual Result GetSize(s64 *out) override; virtual Result Flush() override; diff --git a/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_info_data.hpp b/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_info_data.hpp index 26ae8d067..de7b8617f 100644 --- a/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_info_data.hpp +++ b/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_info_data.hpp @@ -40,11 +40,11 @@ namespace ams::ncm { return this->info.GetId(); } - constexpr const ContentType GetType() const { + constexpr ContentType GetType() const { return this->info.GetType(); } - constexpr const u8 GetIdOffset() const { + constexpr u8 GetIdOffset() const { return this->info.GetIdOffset(); } }; @@ -68,15 +68,15 @@ namespace ams::ncm { return this->info.GetId(); } - constexpr const u64 GetSize() const { + constexpr u64 GetSize() const { return this->info.GetSize(); } - constexpr const ContentType GetType() const { + constexpr ContentType GetType() const { return this->info.GetType(); } - constexpr const u8 GetIdOffset() const { + constexpr u8 GetIdOffset() const { return this->info.GetIdOffset(); } @@ -84,15 +84,15 @@ namespace ams::ncm { return this->placeholder_id; } - constexpr const ContentMetaType GetContentMetaType() const { + constexpr ContentMetaType GetContentMetaType() const { return this->meta_type; } - constexpr const InstallState GetInstallState() const { + constexpr InstallState GetInstallState() const { return this->install_state; } - constexpr const StorageId GetStorageId() const { + constexpr StorageId GetStorageId() const { return this->storage_id; } diff --git a/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_manager_impl.hpp b/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_manager_impl.hpp index ed02ccfc3..4cb037f80 100644 --- a/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_manager_impl.hpp +++ b/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_manager_impl.hpp @@ -51,6 +51,7 @@ namespace ams::ncm { } virtual void DeallocateImpl(void *buffer, size_t size, size_t alignment) override { + AMS_UNUSED(size, alignment); return this->allocator.Free(buffer); } diff --git a/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_meta_id.hpp b/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_meta_id.hpp index 55b1cd49f..de8a367b7 100644 --- a/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_meta_id.hpp +++ b/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_meta_id.hpp @@ -39,7 +39,7 @@ namespace ams::ncm { return ApplicationId::Start <= program_id && program_id <= ApplicationId::End; } - inline constexpr bool IsApplicationId(const ApplicationId &id) { + inline constexpr bool IsApplicationId(const ApplicationId &) { return true; } diff --git a/libraries/libstratosphere/include/stratosphere/ncm/ncm_install_task_base.hpp b/libraries/libstratosphere/include/stratosphere/ncm/ncm_install_task_base.hpp index f459224d2..029ed4a59 100644 --- a/libraries/libstratosphere/include/stratosphere/ncm/ncm_install_task_base.hpp +++ b/libraries/libstratosphere/include/stratosphere/ncm/ncm_install_task_base.hpp @@ -164,7 +164,7 @@ namespace ams::ncm { Result VerifyAllNotCommitted(const StorageContentMetaKey *keys, s32 num_keys); virtual Result PrepareInstallContentMetaData() = 0; - virtual Result GetLatestVersion(util::optional *out_version, u64 id) { return ncm::ResultContentMetaNotFound(); } + virtual Result GetLatestVersion(util::optional *out_version, u64 id) { AMS_UNUSED(out_version, id); return ncm::ResultContentMetaNotFound(); } virtual Result OnExecuteComplete() { return ResultSuccess(); } diff --git a/libraries/libstratosphere/include/stratosphere/ncm/ncm_system_content_meta_id.hpp b/libraries/libstratosphere/include/stratosphere/ncm/ncm_system_content_meta_id.hpp index a5916930a..c90b4d103 100644 --- a/libraries/libstratosphere/include/stratosphere/ncm/ncm_system_content_meta_id.hpp +++ b/libraries/libstratosphere/include/stratosphere/ncm/ncm_system_content_meta_id.hpp @@ -127,7 +127,7 @@ namespace ams::ncm { return program_id == AtmosphereProgramId::Mitm || program_id == AtmosphereProgramId::AtmosphereLogManager; } - inline constexpr bool IsSystemProgramId(const AtmosphereProgramId &program_id) { + inline constexpr bool IsSystemProgramId(const AtmosphereProgramId &) { return true; } @@ -213,7 +213,7 @@ namespace ams::ncm { return (SystemProgramId::Start <= program_id && program_id <= SystemProgramId::End) || IsAtmosphereProgramId(program_id); } - inline constexpr bool IsSystemProgramId(const SystemProgramId &program_id) { + inline constexpr bool IsSystemProgramId(const SystemProgramId &) { return true; } @@ -318,7 +318,7 @@ namespace ams::ncm { return SystemDataId::Start <= data_id && data_id <= SystemDataId::End; } - inline constexpr bool IsSystemDataId(const SystemDataId &data_id) { + inline constexpr bool IsSystemDataId(const SystemDataId &) { return true; } @@ -410,7 +410,7 @@ namespace ams::ncm { return SystemAppletId::Start <= program_id && program_id <= SystemAppletId::End; } - inline constexpr bool IsSystemAppletId(const SystemAppletId &program_id) { + inline constexpr bool IsSystemAppletId(const SystemAppletId &) { return true; } @@ -438,7 +438,7 @@ namespace ams::ncm { return SystemDebugAppletId::Start <= program_id && program_id <= SystemDebugAppletId::End; } - inline constexpr bool IsSystemDebugAppletId(const SystemDebugAppletId &program_id) { + inline constexpr bool IsSystemDebugAppletId(const SystemDebugAppletId &) { return true; } @@ -496,7 +496,7 @@ namespace ams::ncm { id == LibraryAppletId::MyPage; } - inline constexpr bool IsLibraryAppletId(const LibraryAppletId &id) { + inline constexpr bool IsLibraryAppletId(const LibraryAppletId &) { return true; } @@ -536,7 +536,7 @@ namespace ams::ncm { id == WebAppletId::WifiWebAuth; } - inline constexpr bool IsWebAppletId(const WebAppletId &id) { + inline constexpr bool IsWebAppletId(const WebAppletId &) { return true; } diff --git a/libraries/libstratosphere/include/stratosphere/powctl/driver/impl/powctl_charge_arbiter.hpp b/libraries/libstratosphere/include/stratosphere/powctl/driver/impl/powctl_charge_arbiter.hpp index 78bc0f808..5e1e6636d 100644 --- a/libraries/libstratosphere/include/stratosphere/powctl/driver/impl/powctl_charge_arbiter.hpp +++ b/libraries/libstratosphere/include/stratosphere/powctl/driver/impl/powctl_charge_arbiter.hpp @@ -97,7 +97,7 @@ namespace ams::powctl::driver::impl { const auto *rule = this->GetSelectedRule(); AMS_ASSERT(rule != nullptr); - return IsInRange(0, rule->min_battery_done_current, rule->max_battery_done_current); + return IsInRange(current, rule->min_battery_done_current, rule->max_battery_done_current); } const ChargeParametersRule *GetSelectedRule() const { diff --git a/libraries/libstratosphere/include/stratosphere/sf/hipc/sf_hipc_server_manager.hpp b/libraries/libstratosphere/include/stratosphere/sf/hipc/sf_hipc_server_manager.hpp index 52ec86ca9..8f15dc04c 100644 --- a/libraries/libstratosphere/include/stratosphere/sf/hipc/sf_hipc_server_manager.hpp +++ b/libraries/libstratosphere/include/stratosphere/sf/hipc/sf_hipc_server_manager.hpp @@ -176,6 +176,7 @@ namespace ams::sf::hipc { virtual Server *AllocateServer() = 0; virtual void DestroyServer(Server *server) = 0; virtual Result OnNeedsToAccept(int port_index, Server *server) { + AMS_UNUSED(port_index, server); AMS_ABORT("OnNeedsToAccept must be overridden when using indexed ports"); } diff --git a/libraries/libstratosphere/include/stratosphere/sf/hipc/sf_hipc_server_session_manager.hpp b/libraries/libstratosphere/include/stratosphere/sf/hipc/sf_hipc_server_session_manager.hpp index 754a8d9c0..ada9a68da 100644 --- a/libraries/libstratosphere/include/stratosphere/sf/hipc/sf_hipc_server_session_manager.hpp +++ b/libraries/libstratosphere/include/stratosphere/sf/hipc/sf_hipc_server_session_manager.hpp @@ -173,6 +173,7 @@ namespace ams::sf::hipc { virtual ServerSessionManager *GetSessionManagerByTag(u32 tag) { /* This is unused. */ + AMS_UNUSED(tag); return this; } }; diff --git a/libraries/libstratosphere/include/stratosphere/sf/impl/sf_impl_command_serialization.hpp b/libraries/libstratosphere/include/stratosphere/sf/impl/sf_impl_command_serialization.hpp index ab0cb59a1..8af93d370 100644 --- a/libraries/libstratosphere/include/stratosphere/sf/impl/sf_impl_command_serialization.hpp +++ b/libraries/libstratosphere/include/stratosphere/sf/impl/sf_impl_command_serialization.hpp @@ -790,6 +790,7 @@ namespace ams::sf::impl { virtual Result GetInObjects(cmif::ServiceObjectHolder *in_objects) const override final { /* By default, InObjects aren't supported. */ + AMS_UNUSED(in_objects); return sf::ResultNotSupported(); } }; diff --git a/libraries/libstratosphere/include/stratosphere/sf/sf_exp_heap_allocator.hpp b/libraries/libstratosphere/include/stratosphere/sf/sf_exp_heap_allocator.hpp index e23ce9dfa..ad1cd1595 100644 --- a/libraries/libstratosphere/include/stratosphere/sf/sf_exp_heap_allocator.hpp +++ b/libraries/libstratosphere/include/stratosphere/sf/sf_exp_heap_allocator.hpp @@ -31,7 +31,7 @@ namespace ams::sf { } void Detach() { - this->_handle = 0; + this->_handle = {}; } void *Allocate(size_t size) { @@ -42,6 +42,8 @@ namespace ams::sf { } void Deallocate(void *ptr, size_t size) { + AMS_UNUSED(size); + os::LockSdkMutex(std::addressof(this->_mutex)); lmem::FreeToExpHeap(this->_handle, ptr); os::UnlockSdkMutex(std::addressof(this->_mutex)); diff --git a/libraries/libstratosphere/include/stratosphere/sf/sf_lmem_utility.hpp b/libraries/libstratosphere/include/stratosphere/sf/sf_lmem_utility.hpp index cba78690c..341b903aa 100644 --- a/libraries/libstratosphere/include/stratosphere/sf/sf_lmem_utility.hpp +++ b/libraries/libstratosphere/include/stratosphere/sf/sf_lmem_utility.hpp @@ -39,6 +39,7 @@ namespace ams::sf { } virtual void DeallocateImpl(void *buffer, size_t size, size_t alignment) override { + AMS_UNUSED(size, alignment); return lmem::FreeToExpHeap(this->handle, buffer); } @@ -64,10 +65,14 @@ namespace ams::sf { virtual void *AllocateImpl(size_t size, size_t alignment) override { AMS_ASSERT(size <= lmem::GetUnitHeapUnitSize(this->handle)); AMS_ASSERT(alignment <= static_cast(lmem::GetUnitHeapAlignment(this->handle))); + AMS_UNUSED(size, alignment); + return lmem::AllocateFromUnitHeap(this->handle); } virtual void DeallocateImpl(void *buffer, size_t size, size_t alignment) override { + AMS_UNUSED(size, alignment); + return lmem::FreeToUnitHeap(this->handle, buffer); } diff --git a/libraries/libstratosphere/include/stratosphere/sf/sf_mem_utility.hpp b/libraries/libstratosphere/include/stratosphere/sf/sf_mem_utility.hpp index 7e3760430..d894c5d2e 100644 --- a/libraries/libstratosphere/include/stratosphere/sf/sf_mem_utility.hpp +++ b/libraries/libstratosphere/include/stratosphere/sf/sf_mem_utility.hpp @@ -33,6 +33,7 @@ namespace ams::sf { } virtual void DeallocateImpl(void *buffer, size_t size, size_t alignment) override { + AMS_UNUSED(size, alignment); return this->standard_allocator->Free(buffer); } diff --git a/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_client.cpp b/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_client.cpp index 955644231..ec67205de 100644 --- a/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_client.cpp +++ b/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_client.cpp @@ -412,6 +412,9 @@ namespace ams::htc::server::rpc { } s32 RpcClient::GetTaskHandle(u32 task_id) { + /* TODO: Why is this necessary to avoid a bogus array-bounds warning? */ + AMS_ASSUME(task_id < MaxRpcCount); + /* Check pre-conditions. */ AMS_ASSERT(m_task_active[task_id]); AMS_ASSERT(m_is_htcs_task[task_id]); diff --git a/libraries/libstratosphere/source/lm/lm_remote_log_service.cpp b/libraries/libstratosphere/source/lm/lm_remote_log_service.cpp index 9ea31ee99..88a4149b8 100644 --- a/libraries/libstratosphere/source/lm/lm_remote_log_service.cpp +++ b/libraries/libstratosphere/source/lm/lm_remote_log_service.cpp @@ -40,7 +40,7 @@ namespace ams::lm { /* Send libnx command. */ ::Service logger_srv; { - u64 pid_placeholder; + u64 pid_placeholder = 0; #define NX_SERVICE_ASSUME_NON_DOMAIN R_TRY(serviceDispatchIn(&m_srv, 0, pid_placeholder, diff --git a/libraries/libstratosphere/source/mem/impl/mem_impl_platform.os.horizon.cpp b/libraries/libstratosphere/source/mem/impl/mem_impl_platform.os.horizon.cpp index 4dcb31655..5cf49303b 100644 --- a/libraries/libstratosphere/source/mem/impl/mem_impl_platform.os.horizon.cpp +++ b/libraries/libstratosphere/source/mem/impl/mem_impl_platform.os.horizon.cpp @@ -70,15 +70,18 @@ namespace ams::mem::impl { uintptr_t addr; if (IsVirtualAddressMemoryEnabled()) { /* TODO: Support virtual address memory. */ - AMS_UNUSED(ptr); AMS_ABORT("Virtual address memory not supported yet"); } else { if (auto err = ConvertResult(os::AllocateMemoryBlock(std::addressof(addr), util::AlignUp(size, os::MemoryBlockUnitSize))); err != 0) { return err; } + os::SetMemoryPermission(addr, size, os::MemoryPermission_None); } + /* Set the output pointer. */ + *ptr = reinterpret_cast(addr); + return 0; } diff --git a/libraries/libstratosphere/source/ncm/ncm_install_task_base.cpp b/libraries/libstratosphere/source/ncm/ncm_install_task_base.cpp index 0ce78b0ef..07041b9a7 100644 --- a/libraries/libstratosphere/source/ncm/ncm_install_task_base.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_install_task_base.cpp @@ -648,7 +648,7 @@ namespace ams::ncm { /* Automatically choose a suitable storage id. */ auto reader = content_meta.GetReader(); - StorageId storage_id; + StorageId storage_id = StorageId::None; if (reader.GetStorageId() != StorageId::None) { storage_id = reader.GetStorageId(); } else { diff --git a/libraries/libstratosphere/source/os/impl/os_address_space_allocator.cpp b/libraries/libstratosphere/source/os/impl/os_address_space_allocator.cpp index e3cc5c8c6..208e2e6da 100644 --- a/libraries/libstratosphere/source/os/impl/os_address_space_allocator.cpp +++ b/libraries/libstratosphere/source/os/impl/os_address_space_allocator.cpp @@ -20,7 +20,7 @@ namespace ams::os::impl { template - AddressSpaceAllocatorBase::AddressSpaceAllocatorBase(u64 start_address, u64 end_address, SizeType guard_size, const AddressSpaceAllocatorForbiddenRegion *forbidden_regions, size_t num_forbidden_regions) : m_critical_section() { + AddressSpaceAllocatorBase::AddressSpaceAllocatorBase(u64 start_address, u64 end_address, SizeType guard_size, const AddressSpaceAllocatorForbiddenRegion *forbidden_regions, size_t num_forbidden_regions) : m_critical_section(), m_forbidden_region_count(0) { /* Check pre-conditions. */ AMS_ASSERT(start_address >= guard_size); AMS_ASSERT(end_address + guard_size >= end_address);