libstrat: enable -Wextra, -Werror
This caught an embarrassingly large number of bugs.
This commit is contained in:
@@ -142,6 +142,7 @@ namespace ams::os::impl {
|
||||
for (MultiWaitHolderBase &holder_base : this->multi_wait_list) {
|
||||
if (auto handle = holder_base.GetHandle(); handle != os::InvalidNativeHandle) {
|
||||
AMS_ASSERT(count < num);
|
||||
AMS_UNUSED(num);
|
||||
|
||||
out_handles[count] = handle;
|
||||
out_objects[count] = &holder_base;
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
namespace ams::os::impl {
|
||||
|
||||
Result MultiWaitHorizonImpl::WaitSynchronizationN(s32 *out_index, s32 num, NativeHandle arr[], s32 array_size, s64 ns) {
|
||||
AMS_UNUSED(array_size);
|
||||
|
||||
AMS_ASSERT(!(num == 0 && ns == 0));
|
||||
s32 index = MultiWaitImpl::WaitInvalid;
|
||||
|
||||
@@ -38,6 +40,8 @@ namespace ams::os::impl {
|
||||
}
|
||||
|
||||
Result MultiWaitHorizonImpl::ReplyAndReceiveN(s32 *out_index, s32 num, NativeHandle arr[], s32 array_size, s64 ns, NativeHandle reply_target) {
|
||||
AMS_UNUSED(array_size);
|
||||
|
||||
/* NOTE: Nintendo does not initialize this value, which seems like it can cause incorrect behavior. */
|
||||
s32 index = MultiWaitImpl::WaitInvalid;
|
||||
static_assert(MultiWaitImpl::WaitInvalid != -1);
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace ams::os::impl {
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE Result GetProgramId(ncm::ProgramId *out, NativeHandle handle) {
|
||||
return svc::GetInfo(std::addressof(out->value), svc::InfoType_ProgramId, svc::PseudoHandle::CurrentProcess, 0);
|
||||
return svc::GetInfo(std::addressof(out->value), svc::InfoType_ProgramId, handle, 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace ams::os::impl {
|
||||
|
||||
s32 count = 0;
|
||||
while (true) {
|
||||
R_TRY_CATCH(::threadCreate(thread->thread_impl, reinterpret_cast<::ThreadFunc>(&InvokeThread), thread, thread->stack, thread->stack_size, ConvertToHorizonPriority(thread->base_priority), ideal_core)) {
|
||||
R_TRY_CATCH(::threadCreate(thread->thread_impl, reinterpret_cast<::ThreadFunc>(reinterpret_cast<void *>(&InvokeThread)), thread, thread->stack, thread->stack_size, ConvertToHorizonPriority(thread->base_priority), ideal_core)) {
|
||||
R_CATCH(svc::ResultOutOfResource) {
|
||||
if ((++count) < 10) {
|
||||
os::SleepThread(TimeSpan::FromMilliSeconds(10));
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace ams::os::impl {
|
||||
|
||||
/* TODO: void GetThreadContextUnsafe(ThreadContextInfo *out_context, const ThreadType *thread); */
|
||||
|
||||
void NotifyThreadNameChangedImpl(const ThreadType *thread) const { /* ... */ }
|
||||
void NotifyThreadNameChangedImpl(const ThreadType *thread) const { AMS_UNUSED(thread); }
|
||||
|
||||
void SetCurrentThread(ThreadType *thread) const {
|
||||
g_current_thread_pointer = thread;
|
||||
|
||||
@@ -18,10 +18,12 @@
|
||||
namespace ams::os {
|
||||
|
||||
Result AllocateMemoryBlock(uintptr_t *out_address, size_t size) {
|
||||
AMS_UNUSED(out_address, size);
|
||||
AMS_ABORT("Not implemented yet");
|
||||
}
|
||||
|
||||
void FreeMemoryBlock(uintptr_t address, size_t size) {
|
||||
AMS_UNUSED(address, size);
|
||||
AMS_ABORT("Not implemented yet");
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace ams::os {
|
||||
|
||||
#ifdef ATMOSPHERE_BUILD_FOR_AUDITING
|
||||
|
||||
void PushAndCheckLockLevel(MutexType *mutex) {
|
||||
void PushAndCheckLockLevel(const MutexType *mutex) {
|
||||
/* If auditing isn't specified, don't bother. */
|
||||
if (mutex->lock_level == 0) {
|
||||
return;
|
||||
@@ -32,7 +32,7 @@ namespace ams::os {
|
||||
/* TODO: Implement mutex level auditing. */
|
||||
}
|
||||
|
||||
void PopAndCheckLockLevel(MutexType *mutex) {
|
||||
void PopAndCheckLockLevel(const MutexType *mutex) {
|
||||
/* If auditing isn't specified, don't bother. */
|
||||
if (mutex->lock_level == 0) {
|
||||
return;
|
||||
@@ -43,12 +43,12 @@ namespace ams::os {
|
||||
|
||||
#else
|
||||
|
||||
void PushAndCheckLockLevel(MutexType *mutex) {
|
||||
/* ... */
|
||||
void PushAndCheckLockLevel(const MutexType *mutex) {
|
||||
AMS_UNUSED(mutex);
|
||||
}
|
||||
|
||||
void PopAndCheckLockLevel(MutexType *mutex) {
|
||||
/* ... */
|
||||
void PopAndCheckLockLevel(const MutexType *mutex) {
|
||||
AMS_UNUSED(mutex);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -38,6 +38,8 @@ namespace ams::os {
|
||||
AMS_ASSERT(util::IsAligned(reinterpret_cast<uintptr_t>(stack), ThreadStackAlignment));
|
||||
AMS_ASSERT(stack_size > 0);
|
||||
AMS_ASSERT(util::IsAligned(stack_size, ThreadStackAlignment));
|
||||
|
||||
AMS_UNUSED(thread, stack, stack_size, priority);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace ams::os {
|
||||
}
|
||||
|
||||
Result AllocateTlsSlot(TlsSlot *out, TlsDestructor destructor) {
|
||||
s32 slot = ::threadTlsAlloc(reinterpret_cast<LibnxTlsDestructor>(destructor));
|
||||
s32 slot = ::threadTlsAlloc(reinterpret_cast<LibnxTlsDestructor>(reinterpret_cast<void *>(destructor)));
|
||||
R_UNLESS(slot >= 0, os::ResultOutOfResource());
|
||||
|
||||
*out = { static_cast<u32>(slot) };
|
||||
|
||||
Reference in New Issue
Block a user