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 {
/* 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();
}
};

View file

@ -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();

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 {
AMS_UNUSED(offset, buffer, size, option);
return fs::ResultUnsupportedOperationInReadOnlyFileA();
}
virtual Result DoSetSize(s64 size) override final {
AMS_UNUSED(size);
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 {
AMS_UNUSED(src, src_size);
R_UNLESS(op_id == OperationId::QueryRange, fs::ResultUnsupportedOperationInFileServiceObjectAdapterA());
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 {
/* TODO: How to deal with this? */
AMS_UNUSED(dst, dst_size, op_id, offset, size, src, src_size);
return fs::ResultUnsupportedOperation();
};
};

View file

@ -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());

View file

@ -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();
}

View file

@ -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;
}

View file

@ -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;
}
};

View file

@ -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;
}
};

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

View file

@ -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;
}
};

View file

@ -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:

View file

@ -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:

View file

@ -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);

View file

@ -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();
}
};

View file

@ -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);
}
};

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;
}

View file

@ -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);
}

View file

@ -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;
}

View file

@ -164,7 +164,7 @@ namespace ams::ncm {
Result VerifyAllNotCommitted(const StorageContentMetaKey *keys, s32 num_keys);
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(); }

View file

@ -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;
}

View file

@ -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 {

View file

@ -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");
}

View file

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

View file

@ -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();
}
};

View file

@ -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));

View file

@ -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<size_t>(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);
}

View file

@ -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);
}

View file

@ -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]);

View file

@ -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,

View file

@ -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<void *>(addr);
return 0;
}

View file

@ -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 {

View file

@ -20,7 +20,7 @@
namespace ams::os::impl {
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. */
AMS_ASSERT(start_address >= guard_size);
AMS_ASSERT(end_address + guard_size >= end_address);