libstrat: enable -Wextra, -Werror

This caught an embarrassingly large number of bugs.
This commit is contained in:
Michael Scire 2021-10-06 15:20:48 -07:00
parent e1fbf27398
commit 7ca83c9d3b
160 changed files with 691 additions and 152 deletions

View file

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

View file

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

View file

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

View file

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

View file

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