libstrat: fix compilation without pre-compiled header/without lto

This commit is contained in:
Michael Scire 2021-10-06 17:58:42 -07:00
parent 7ca83c9d3b
commit e8f1efd01b
37 changed files with 89 additions and 33 deletions

View file

@ -98,11 +98,13 @@ namespace ams::fs {
virtual Result Write(s64 offset, const void *buffer, size_t size) override { virtual Result Write(s64 offset, const void *buffer, size_t size) override {
/* TODO: Better result? Is it possible to get a more specific one? */ /* TODO: Better result? Is it possible to get a more specific one? */
AMS_UNUSED(offset, buffer, size);
return fs::ResultUnsupportedOperation(); return fs::ResultUnsupportedOperation();
} }
virtual Result SetSize(s64 size) override { virtual Result SetSize(s64 size) override {
/* TODO: Better result? Is it possible to get a more specific one? */ /* TODO: Better result? Is it possible to get a more specific one? */
AMS_UNUSED(size);
return fs::ResultUnsupportedOperation(); return fs::ResultUnsupportedOperation();
} }
}; };

View file

@ -63,10 +63,13 @@ namespace ams::fs {
} }
virtual Result SetSize(s64 size) override { virtual Result SetSize(s64 size) override {
AMS_UNUSED(size);
return fs::ResultUnsupportedOperationInMemoryStorageA(); 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 { 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) { switch (op_id) {
case OperationId::Invalidate: case OperationId::Invalidate:
return ResultSuccess(); return ResultSuccess();

View file

@ -46,10 +46,12 @@ namespace ams::fs {
} }
virtual Result DoWrite(s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) override final { 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(); return fs::ResultUnsupportedOperationInReadOnlyFileA();
} }
virtual Result DoSetSize(s64 size) override final { virtual Result DoSetSize(s64 size) override final {
AMS_UNUSED(size);
return fs::ResultUnsupportedOperationInReadOnlyFileA(); return fs::ResultUnsupportedOperationInReadOnlyFileA();
} }

View file

@ -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 { 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(op_id == OperationId::QueryRange, fs::ResultUnsupportedOperationInFileServiceObjectAdapterA());
R_UNLESS(dst_size == sizeof(FileQueryRangeInfo), fs::ResultInvalidSize()); R_UNLESS(dst_size == sizeof(FileQueryRangeInfo), fs::ResultInvalidSize());

View file

@ -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 { 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? */ /* TODO: How to deal with this? */
AMS_UNUSED(dst, dst_size, op_id, offset, size, src, src_size);
return fs::ResultUnsupportedOperation(); return fs::ResultUnsupportedOperation();
}; };
}; };

View file

@ -84,6 +84,8 @@ namespace ams::fs::fsa {
virtual sf::cmif::DomainObjectId GetDomainObjectId() const = 0; virtual sf::cmif::DomainObjectId GetDomainObjectId() const = 0;
protected: protected:
Result DryRead(size_t *out, s64 offset, size_t size, const fs::ReadOption &option, OpenMode open_mode) { 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. */ /* Check that we can read. */
R_UNLESS((open_mode & OpenMode_Read) != 0, fs::ResultReadNotPermitted()); 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()); R_UNLESS((open_mode & OpenMode_Write) != 0, fs::ResultWriteNotPermitted());
AMS_ASSERT(size >= 0); AMS_ASSERT(size >= 0);
AMS_UNUSED(size);
return ResultSuccess(); return ResultSuccess();
} }
Result DryWrite(bool *out_append, s64 offset, size_t size, const fs::WriteOption &option, fs::OpenMode open_mode) { 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. */ /* Check that we can write. */
R_UNLESS((open_mode & OpenMode_Write) != 0, fs::ResultWriteNotPermitted()); R_UNLESS((open_mode & OpenMode_Write) != 0, fs::ResultWriteNotPermitted());

View file

@ -159,25 +159,30 @@ namespace ams::fs::fsa {
virtual Result DoCommit() = 0; virtual Result DoCommit() = 0;
virtual Result DoGetFreeSpaceSize(s64 *out, const char *path) { virtual Result DoGetFreeSpaceSize(s64 *out, const char *path) {
AMS_UNUSED(out, path);
return fs::ResultNotImplemented(); return fs::ResultNotImplemented();
} }
virtual Result DoGetTotalSpaceSize(s64 *out, const char *path) { virtual Result DoGetTotalSpaceSize(s64 *out, const char *path) {
AMS_UNUSED(out, path);
return fs::ResultNotImplemented(); return fs::ResultNotImplemented();
} }
virtual Result DoCleanDirectoryRecursively(const char *path) = 0; virtual Result DoCleanDirectoryRecursively(const char *path) = 0;
virtual Result DoGetFileTimeStampRaw(fs::FileTimeStampRaw *out, const char *path) { virtual Result DoGetFileTimeStampRaw(fs::FileTimeStampRaw *out, const char *path) {
AMS_UNUSED(out, path);
return fs::ResultNotImplemented(); 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) { 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(); return fs::ResultNotImplemented();
} }
/* These aren't accessible as commands. */ /* These aren't accessible as commands. */
virtual Result DoCommitProvisionally(s64 counter) { virtual Result DoCommitProvisionally(s64 counter) {
AMS_UNUSED(counter);
return fs::ResultNotImplemented(); return fs::ResultNotImplemented();
} }

View file

@ -25,6 +25,7 @@ namespace ams::fs::impl {
} }
static ALWAYS_INLINE void *operator new(size_t size, Newable *placement) noexcept { static ALWAYS_INLINE void *operator new(size_t size, Newable *placement) noexcept {
AMS_UNUSED(size);
return placement; return placement;
} }

View file

@ -31,10 +31,12 @@ namespace ams::fssrv {
} }
virtual void DeallocateImpl(void *p, size_t size, size_t align) override { virtual void DeallocateImpl(void *p, size_t size, size_t align) override {
AMS_UNUSED(size, align);
return lmem::FreeToExpHeap(this->heap_handle, p); return lmem::FreeToExpHeap(this->heap_handle, p);
} }
virtual bool IsEqualImpl(const MemoryResource &rhs) const override { virtual bool IsEqualImpl(const MemoryResource &rhs) const override {
AMS_UNUSED(rhs);
return false; return false;
} }
}; };
@ -67,6 +69,7 @@ namespace ams::fssrv {
virtual void *AllocateImpl(size_t size, size_t align) override; virtual void *AllocateImpl(size_t size, size_t align) override;
virtual void DeallocateImpl(void *p, 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 { virtual bool IsEqualImpl(const MemoryResource &rhs) const override {
AMS_UNUSED(rhs);
return false; return false;
} }
}; };

View file

@ -44,6 +44,7 @@ namespace ams::fssrv {
virtual void *AllocateImpl(size_t size, size_t align) override; virtual void *AllocateImpl(size_t size, size_t align) override;
virtual void DeallocateImpl(void *p, 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 { virtual bool IsEqualImpl(const MemoryResource &rhs) const override {
AMS_UNUSED(rhs);
return false; return false;
} }
}; };

View file

@ -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) { 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_ASSERT(work_size >= QueryWorkBufferSize(order_max));
AMS_UNUSED(work_size);
const auto aligned_work = util::AlignUp(reinterpret_cast<uintptr_t>(work), alignof(PageList)); const auto aligned_work = util::AlignUp(reinterpret_cast<uintptr_t>(work), alignof(PageList));
this->external_free_lists = reinterpret_cast<PageList *>(aligned_work); this->external_free_lists = reinterpret_cast<PageList *>(aligned_work);
return this->Initialize(address, size, block_size, order_max); return this->Initialize(address, size, block_size, order_max);

View file

@ -178,10 +178,12 @@ namespace ams::fssystem {
AttrInfo *FindAttrInfo(const BufferAttribute &attr); AttrInfo *FindAttrInfo(const BufferAttribute &attr);
s32 GetCacheCountMin(const BufferAttribute &attr) { s32 GetCacheCountMin(const BufferAttribute &attr) {
AMS_UNUSED(attr);
return this->cache_count_min; return this->cache_count_min;
} }
size_t GetCacheSizeMin(const BufferAttribute &attr) { size_t GetCacheSizeMin(const BufferAttribute &attr) {
AMS_UNUSED(attr);
return this->cache_size_min; return this->cache_size_min;
} }
}; };

View file

@ -103,10 +103,12 @@ namespace ams::fssystem {
} }
virtual Result Write(s64 offset, const void *buffer, size_t size) override { virtual Result Write(s64 offset, const void *buffer, size_t size) override {
AMS_UNUSED(offset, buffer, size);
return fs::ResultUnsupportedOperationInAesCtrCounterExtendedStorageA(); return fs::ResultUnsupportedOperationInAesCtrCounterExtendedStorageA();
} }
virtual Result SetSize(s64 size) override { virtual Result SetSize(s64 size) override {
AMS_UNUSED(size);
return fs::ResultUnsupportedOperationInAesCtrCounterExtendedStorageB(); return fs::ResultUnsupportedOperationInAesCtrCounterExtendedStorageB();
} }
private: private:

View file

@ -142,10 +142,12 @@ namespace ams::fssystem {
} }
virtual Result Write(s64 offset, const void *buffer, size_t size) override { virtual Result Write(s64 offset, const void *buffer, size_t size) override {
AMS_UNUSED(offset, buffer, size);
return fs::ResultUnsupportedOperationInIndirectStorageA(); return fs::ResultUnsupportedOperationInIndirectStorageA();
} }
virtual Result SetSize(s64 size) override { virtual Result SetSize(s64 size) override {
AMS_UNUSED(size);
return fs::ResultUnsupportedOperationInIndirectStorageB(); return fs::ResultUnsupportedOperationInIndirectStorageB();
} }
protected: protected:

View file

@ -48,7 +48,7 @@ namespace ams::fssystem {
return this->integrity_storage.Write(offset, buffer, size); 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 { virtual Result GetSize(s64 *out) override {
return this->integrity_storage.GetSize(out); return this->integrity_storage.GetSize(out);

View file

@ -31,6 +31,8 @@ namespace ams::fssystem {
virtual Result Read(s64 offset, void *buffer, size_t size) override { virtual Result Read(s64 offset, void *buffer, size_t size) override {
AMS_ASSERT(offset >= 0); AMS_ASSERT(offset >= 0);
AMS_ASSERT(buffer != nullptr || size == 0); AMS_ASSERT(buffer != nullptr || size == 0);
AMS_UNUSED(offset);
if (size > 0) { if (size > 0) {
std::memset(buffer, 0, size); 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 { 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(); return ResultSuccess();
} }
@ -52,10 +55,12 @@ namespace ams::fssystem {
} }
virtual Result Write(s64 offset, const void *buffer, size_t size) override { virtual Result Write(s64 offset, const void *buffer, size_t size) override {
AMS_UNUSED(offset, buffer, size);
return fs::ResultUnsupportedOperationInZeroStorageA(); return fs::ResultUnsupportedOperationInZeroStorageA();
} }
virtual Result SetSize(s64 size) override { virtual Result SetSize(s64 size) override {
AMS_UNUSED(size);
return fs::ResultUnsupportedOperationInZeroStorageB(); return fs::ResultUnsupportedOperationInZeroStorageB();
} }
}; };

View file

@ -26,16 +26,16 @@ namespace ams::fssystem {
Relative, Relative,
}; };
private: private:
os::ThreadType *thread; os::ThreadType *m_thread;
s32 priority; s32 m_priority;
public: public:
ALWAYS_INLINE explicit ScopedThreadPriorityChanger(s32 prio, Mode mode) : thread(os::GetCurrentThread()), priority(0) { 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(this->thread) + priority : priority, os::LowestSystemThreadPriority); const auto result_priority = std::min((mode == Mode::Relative) ? os::GetThreadPriority(m_thread) + priority : priority, os::LowestSystemThreadPriority);
this->priority = os::ChangeThreadPriority(thread, result_priority); m_priority = os::ChangeThreadPriority(m_thread, result_priority);
} }
ALWAYS_INLINE ~ScopedThreadPriorityChanger() { ALWAYS_INLINE ~ScopedThreadPriorityChanger() {
os::ChangeThreadPriority(this->thread, this->priority); os::ChangeThreadPriority(m_thread, m_priority);
} }
}; };

View file

@ -84,7 +84,7 @@ namespace ams::fssystem::save {
virtual Result Read(s64 offset, void *buffer, size_t size) override; 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 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 GetSize(s64 *out) override;
virtual Result Flush() override; virtual Result Flush() override;

View file

@ -163,7 +163,7 @@ namespace ams::fssystem::save {
virtual Result Read(s64 offset, void *buffer, size_t size) override; 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 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 GetSize(s64 *out) override;
virtual Result Flush() override; virtual Result Flush() override;

View file

@ -57,7 +57,7 @@ namespace ams::fssystem::save {
virtual Result Read(s64 offset, void *buffer, size_t size) override; 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 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 GetSize(s64 *out) override;
virtual Result Flush() override; virtual Result Flush() override;

View file

@ -40,11 +40,11 @@ namespace ams::ncm {
return this->info.GetId(); return this->info.GetId();
} }
constexpr const ContentType GetType() const { constexpr ContentType GetType() const {
return this->info.GetType(); return this->info.GetType();
} }
constexpr const u8 GetIdOffset() const { constexpr u8 GetIdOffset() const {
return this->info.GetIdOffset(); return this->info.GetIdOffset();
} }
}; };
@ -68,15 +68,15 @@ namespace ams::ncm {
return this->info.GetId(); return this->info.GetId();
} }
constexpr const u64 GetSize() const { constexpr u64 GetSize() const {
return this->info.GetSize(); return this->info.GetSize();
} }
constexpr const ContentType GetType() const { constexpr ContentType GetType() const {
return this->info.GetType(); return this->info.GetType();
} }
constexpr const u8 GetIdOffset() const { constexpr u8 GetIdOffset() const {
return this->info.GetIdOffset(); return this->info.GetIdOffset();
} }
@ -84,15 +84,15 @@ namespace ams::ncm {
return this->placeholder_id; return this->placeholder_id;
} }
constexpr const ContentMetaType GetContentMetaType() const { constexpr ContentMetaType GetContentMetaType() const {
return this->meta_type; return this->meta_type;
} }
constexpr const InstallState GetInstallState() const { constexpr InstallState GetInstallState() const {
return this->install_state; return this->install_state;
} }
constexpr const StorageId GetStorageId() const { constexpr StorageId GetStorageId() const {
return this->storage_id; return this->storage_id;
} }

View file

@ -51,6 +51,7 @@ namespace ams::ncm {
} }
virtual void DeallocateImpl(void *buffer, size_t size, size_t alignment) override { virtual void DeallocateImpl(void *buffer, size_t size, size_t alignment) override {
AMS_UNUSED(size, alignment);
return this->allocator.Free(buffer); return this->allocator.Free(buffer);
} }

View file

@ -39,7 +39,7 @@ namespace ams::ncm {
return ApplicationId::Start <= program_id && program_id <= ApplicationId::End; return ApplicationId::Start <= program_id && program_id <= ApplicationId::End;
} }
inline constexpr bool IsApplicationId(const ApplicationId &id) { inline constexpr bool IsApplicationId(const ApplicationId &) {
return true; return true;
} }

View file

@ -164,7 +164,7 @@ namespace ams::ncm {
Result VerifyAllNotCommitted(const StorageContentMetaKey *keys, s32 num_keys); Result VerifyAllNotCommitted(const StorageContentMetaKey *keys, s32 num_keys);
virtual Result PrepareInstallContentMetaData() = 0; virtual Result PrepareInstallContentMetaData() = 0;
virtual Result GetLatestVersion(util::optional<u32> *out_version, u64 id) { return ncm::ResultContentMetaNotFound(); } virtual Result GetLatestVersion(util::optional<u32> *out_version, u64 id) { AMS_UNUSED(out_version, id); return ncm::ResultContentMetaNotFound(); }
virtual Result OnExecuteComplete() { return ResultSuccess(); } virtual Result OnExecuteComplete() { return ResultSuccess(); }

View file

@ -127,7 +127,7 @@ namespace ams::ncm {
return program_id == AtmosphereProgramId::Mitm || program_id == AtmosphereProgramId::AtmosphereLogManager; 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; return true;
} }
@ -213,7 +213,7 @@ namespace ams::ncm {
return (SystemProgramId::Start <= program_id && program_id <= SystemProgramId::End) || IsAtmosphereProgramId(program_id); 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; return true;
} }
@ -318,7 +318,7 @@ namespace ams::ncm {
return SystemDataId::Start <= data_id && data_id <= SystemDataId::End; 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; return true;
} }
@ -410,7 +410,7 @@ namespace ams::ncm {
return SystemAppletId::Start <= program_id && program_id <= SystemAppletId::End; 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; return true;
} }
@ -438,7 +438,7 @@ namespace ams::ncm {
return SystemDebugAppletId::Start <= program_id && program_id <= SystemDebugAppletId::End; 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; return true;
} }
@ -496,7 +496,7 @@ namespace ams::ncm {
id == LibraryAppletId::MyPage; id == LibraryAppletId::MyPage;
} }
inline constexpr bool IsLibraryAppletId(const LibraryAppletId &id) { inline constexpr bool IsLibraryAppletId(const LibraryAppletId &) {
return true; return true;
} }
@ -536,7 +536,7 @@ namespace ams::ncm {
id == WebAppletId::WifiWebAuth; id == WebAppletId::WifiWebAuth;
} }
inline constexpr bool IsWebAppletId(const WebAppletId &id) { inline constexpr bool IsWebAppletId(const WebAppletId &) {
return true; return true;
} }

View file

@ -97,7 +97,7 @@ namespace ams::powctl::driver::impl {
const auto *rule = this->GetSelectedRule(); const auto *rule = this->GetSelectedRule();
AMS_ASSERT(rule != nullptr); 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 { const ChargeParametersRule *GetSelectedRule() const {

View file

@ -176,6 +176,7 @@ namespace ams::sf::hipc {
virtual Server *AllocateServer() = 0; virtual Server *AllocateServer() = 0;
virtual void DestroyServer(Server *server) = 0; virtual void DestroyServer(Server *server) = 0;
virtual Result OnNeedsToAccept(int port_index, Server *server) { virtual Result OnNeedsToAccept(int port_index, Server *server) {
AMS_UNUSED(port_index, server);
AMS_ABORT("OnNeedsToAccept must be overridden when using indexed ports"); AMS_ABORT("OnNeedsToAccept must be overridden when using indexed ports");
} }

View file

@ -173,6 +173,7 @@ namespace ams::sf::hipc {
virtual ServerSessionManager *GetSessionManagerByTag(u32 tag) { virtual ServerSessionManager *GetSessionManagerByTag(u32 tag) {
/* This is unused. */ /* This is unused. */
AMS_UNUSED(tag);
return this; return this;
} }
}; };

View file

@ -790,6 +790,7 @@ namespace ams::sf::impl {
virtual Result GetInObjects(cmif::ServiceObjectHolder *in_objects) const override final { virtual Result GetInObjects(cmif::ServiceObjectHolder *in_objects) const override final {
/* By default, InObjects aren't supported. */ /* By default, InObjects aren't supported. */
AMS_UNUSED(in_objects);
return sf::ResultNotSupported(); return sf::ResultNotSupported();
} }
}; };

View file

@ -31,7 +31,7 @@ namespace ams::sf {
} }
void Detach() { void Detach() {
this->_handle = 0; this->_handle = {};
} }
void *Allocate(size_t size) { void *Allocate(size_t size) {
@ -42,6 +42,8 @@ namespace ams::sf {
} }
void Deallocate(void *ptr, size_t size) { void Deallocate(void *ptr, size_t size) {
AMS_UNUSED(size);
os::LockSdkMutex(std::addressof(this->_mutex)); os::LockSdkMutex(std::addressof(this->_mutex));
lmem::FreeToExpHeap(this->_handle, ptr); lmem::FreeToExpHeap(this->_handle, ptr);
os::UnlockSdkMutex(std::addressof(this->_mutex)); os::UnlockSdkMutex(std::addressof(this->_mutex));

View file

@ -39,6 +39,7 @@ namespace ams::sf {
} }
virtual void DeallocateImpl(void *buffer, size_t size, size_t alignment) override { virtual void DeallocateImpl(void *buffer, size_t size, size_t alignment) override {
AMS_UNUSED(size, alignment);
return lmem::FreeToExpHeap(this->handle, buffer); return lmem::FreeToExpHeap(this->handle, buffer);
} }
@ -64,10 +65,14 @@ namespace ams::sf {
virtual void *AllocateImpl(size_t size, size_t alignment) override { virtual void *AllocateImpl(size_t size, size_t alignment) override {
AMS_ASSERT(size <= lmem::GetUnitHeapUnitSize(this->handle)); AMS_ASSERT(size <= lmem::GetUnitHeapUnitSize(this->handle));
AMS_ASSERT(alignment <= static_cast<size_t>(lmem::GetUnitHeapAlignment(this->handle))); AMS_ASSERT(alignment <= static_cast<size_t>(lmem::GetUnitHeapAlignment(this->handle)));
AMS_UNUSED(size, alignment);
return lmem::AllocateFromUnitHeap(this->handle); return lmem::AllocateFromUnitHeap(this->handle);
} }
virtual void DeallocateImpl(void *buffer, size_t size, size_t alignment) override { virtual void DeallocateImpl(void *buffer, size_t size, size_t alignment) override {
AMS_UNUSED(size, alignment);
return lmem::FreeToUnitHeap(this->handle, buffer); return lmem::FreeToUnitHeap(this->handle, buffer);
} }

View file

@ -33,6 +33,7 @@ namespace ams::sf {
} }
virtual void DeallocateImpl(void *buffer, size_t size, size_t alignment) override { virtual void DeallocateImpl(void *buffer, size_t size, size_t alignment) override {
AMS_UNUSED(size, alignment);
return this->standard_allocator->Free(buffer); return this->standard_allocator->Free(buffer);
} }

View file

@ -412,6 +412,9 @@ namespace ams::htc::server::rpc {
} }
s32 RpcClient::GetTaskHandle(u32 task_id) { 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. */ /* Check pre-conditions. */
AMS_ASSERT(m_task_active[task_id]); AMS_ASSERT(m_task_active[task_id]);
AMS_ASSERT(m_is_htcs_task[task_id]); AMS_ASSERT(m_is_htcs_task[task_id]);

View file

@ -40,7 +40,7 @@ namespace ams::lm {
/* Send libnx command. */ /* Send libnx command. */
::Service logger_srv; ::Service logger_srv;
{ {
u64 pid_placeholder; u64 pid_placeholder = 0;
#define NX_SERVICE_ASSUME_NON_DOMAIN #define NX_SERVICE_ASSUME_NON_DOMAIN
R_TRY(serviceDispatchIn(&m_srv, 0, pid_placeholder, R_TRY(serviceDispatchIn(&m_srv, 0, pid_placeholder,

View file

@ -70,15 +70,18 @@ namespace ams::mem::impl {
uintptr_t addr; uintptr_t addr;
if (IsVirtualAddressMemoryEnabled()) { if (IsVirtualAddressMemoryEnabled()) {
/* TODO: Support virtual address memory. */ /* TODO: Support virtual address memory. */
AMS_UNUSED(ptr);
AMS_ABORT("Virtual address memory not supported yet"); AMS_ABORT("Virtual address memory not supported yet");
} else { } else {
if (auto err = ConvertResult(os::AllocateMemoryBlock(std::addressof(addr), util::AlignUp(size, os::MemoryBlockUnitSize))); err != 0) { if (auto err = ConvertResult(os::AllocateMemoryBlock(std::addressof(addr), util::AlignUp(size, os::MemoryBlockUnitSize))); err != 0) {
return err; return err;
} }
os::SetMemoryPermission(addr, size, os::MemoryPermission_None); os::SetMemoryPermission(addr, size, os::MemoryPermission_None);
} }
/* Set the output pointer. */
*ptr = reinterpret_cast<void *>(addr);
return 0; return 0;
} }

View file

@ -648,7 +648,7 @@ namespace ams::ncm {
/* Automatically choose a suitable storage id. */ /* Automatically choose a suitable storage id. */
auto reader = content_meta.GetReader(); auto reader = content_meta.GetReader();
StorageId storage_id; StorageId storage_id = StorageId::None;
if (reader.GetStorageId() != StorageId::None) { if (reader.GetStorageId() != StorageId::None) {
storage_id = reader.GetStorageId(); storage_id = reader.GetStorageId();
} else { } else {

View file

@ -20,7 +20,7 @@
namespace ams::os::impl { namespace ams::os::impl {
template<std::unsigned_integral AddressType, std::unsigned_integral SizeType> template<std::unsigned_integral AddressType, std::unsigned_integral SizeType>
AddressSpaceAllocatorBase<AddressType, SizeType>::AddressSpaceAllocatorBase(u64 start_address, u64 end_address, SizeType guard_size, const AddressSpaceAllocatorForbiddenRegion *forbidden_regions, size_t num_forbidden_regions) : m_critical_section() { AddressSpaceAllocatorBase<AddressType, SizeType>::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. */ /* Check pre-conditions. */
AMS_ASSERT(start_address >= guard_size); AMS_ASSERT(start_address >= guard_size);
AMS_ASSERT(end_address + guard_size >= end_address); AMS_ASSERT(end_address + guard_size >= end_address);