From c46adebdb9d06e870ce2a27fa61646c2797fe990 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Fri, 22 Nov 2024 19:04:56 -0500 Subject: [PATCH] Fix more clangd errors This also seems to fix the problem where clangd failed to index most header files, which was due to the typo in JGeometry.h. --- .vscode/settings.json | 1 + include/JSystem/JGeometry.h | 2 +- include/dolphin/os/OSTime.h | 2 +- src/JSystem/JKernel/JKRThread.cpp | 4 ++-- src/dolphin/os/OSReset.c | 2 ++ src/dolphin/os/OSTime.c | 4 ++++ src/f_pc/f_pc_deletor.cpp | 2 +- src/m_Do/m_Do_DVDError.cpp | 2 +- 8 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 01bb1bcf6..fea8c2367 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -33,5 +33,6 @@ }, "clangd.arguments": [ "--function-arg-placeholders=0", + // "--log=verbose", ], } diff --git a/include/JSystem/JGeometry.h b/include/JSystem/JGeometry.h index 7d581d29d..be331fa8d 100644 --- a/include/JSystem/JGeometry.h +++ b/include/JSystem/JGeometry.h @@ -320,7 +320,7 @@ struct TVec2 { template struct TBox { TBox() : i(), f() {} - TBox(const TBox& other) : i(other.f), f(other.y) {} + TBox(const TBox& other) : i(other.i), f(other.f) {} T i, f; }; diff --git a/include/dolphin/os/OSTime.h b/include/dolphin/os/OSTime.h index 36f106a5e..319792704 100644 --- a/include/dolphin/os/OSTime.h +++ b/include/dolphin/os/OSTime.h @@ -30,7 +30,7 @@ OSTime OSGetTime(void); OSTick OSGetTick(void); OSTime __OSGetSystemTime(void); OSTime __OSTimeToSystemTime(OSTime time); -void GetDates(s32 days, OSCalendarTime* ct); +static void GetDates(s32 days, OSCalendarTime* ct); void OSTicksToCalendarTime(OSTime ticks, OSCalendarTime* ct); extern u32 __OSBusClock AT_ADDRESS(0x800000F8); diff --git a/src/JSystem/JKernel/JKRThread.cpp b/src/JSystem/JKernel/JKRThread.cpp index cc9c78405..9b7d1dc07 100644 --- a/src/JSystem/JKernel/JKRThread.cpp +++ b/src/JSystem/JKernel/JKRThread.cpp @@ -25,7 +25,7 @@ JKRThread::JKRThread(u32 stack_size, int message_count, int param_3) : mThreadLi mThreadRecord = (OSThread*)JKRAllocFromHeap(mHeap, sizeof(OSThread), 0x20); void* stackBase = (void*)((int)mStackMemory + mStackSize); - OSCreateThread(mThreadRecord, start, this, stackBase, mStackSize, param_3, 1); + OSCreateThread(mThreadRecord, (void*)start, this, stackBase, mStackSize, param_3, 1); mMessageCount = message_count; mMessages = (OSMessage*)JKRAllocFromHeap(mHeap, mMessageCount * sizeof(OSMessage), 0); @@ -135,4 +135,4 @@ void JKRThreadSwitch::callback(OSThread* current, OSThread* next) { static void dummy() { OSReport("Cannot create JKRTask Manager."); OSReport("sManager != 0"); -} \ No newline at end of file +} diff --git a/src/dolphin/os/OSReset.c b/src/dolphin/os/OSReset.c index 4f131b1a5..4606713b7 100644 --- a/src/dolphin/os/OSReset.c +++ b/src/dolphin/os/OSReset.c @@ -55,6 +55,7 @@ inline BOOL __OSCallResetFunctions(u32 arg0) { return 1; } +#ifdef __MWERKS__ static asm void Reset(register s32 param_0) { // clang-format off nofralloc @@ -107,6 +108,7 @@ static asm void Reset(register s32 param_0) { b lbl_8033F790 // clang-format on } +#endif inline static void KillThreads(void) { OSThread* thread; diff --git a/src/dolphin/os/OSTime.c b/src/dolphin/os/OSTime.c index 4ce6151c0..cd622f5e2 100644 --- a/src/dolphin/os/OSTime.c +++ b/src/dolphin/os/OSTime.c @@ -5,6 +5,7 @@ #define OS_TIME_WEEK_DAY_MAX 7 #define OS_TIME_YEAR_DAY_MAX 365 +#ifdef __MWERKS__ asm OSTime OSGetTime(void) { // clang-format off nofralloc @@ -19,7 +20,9 @@ asm OSTime OSGetTime(void) { blr // clang-format on } +#endif +#ifdef __MWERKS__ asm OSTick OSGetTick(void) { // clang-format off nofralloc @@ -28,6 +31,7 @@ asm OSTick OSGetTick(void) { blr // clang-format on } +#endif #define OS_SYSTEMTIME_BASE 0x30D8 diff --git a/src/f_pc/f_pc_deletor.cpp b/src/f_pc/f_pc_deletor.cpp index 4de48c51a..cdffc4345 100644 --- a/src/f_pc/f_pc_deletor.cpp +++ b/src/f_pc/f_pc_deletor.cpp @@ -34,7 +34,7 @@ s32 fpcDt_deleteMethod(base_process_class* i_proc) { /* 8003D314-8003D34C .text fpcDt_Handler__Fv */ void fpcDt_Handler(void) { - cLsIt_Method(&g_fpcDtTg_Queue, (cNdIt_MethodFunc)fpcDtTg_Do, fpcDt_deleteMethod); + cLsIt_Method(&g_fpcDtTg_Queue, (cNdIt_MethodFunc)fpcDtTg_Do, (void*)fpcDt_deleteMethod); } /* 8003D34C-8003D3C8 .text fpcDt_ToQueue__FP18base_process_class */ diff --git a/src/m_Do/m_Do_DVDError.cpp b/src/m_Do/m_Do_DVDError.cpp index 060e33687..04f28e34b 100644 --- a/src/m_Do/m_Do_DVDError.cpp +++ b/src/m_Do/m_Do_DVDError.cpp @@ -26,7 +26,7 @@ void mDoDvdErr_ThdInit() { OSThread* curThread = OSGetCurrentThread(); s32 priority = OSGetThreadPriority(curThread); - OSCreateThread(&DvdErr_thread, mDoDvdErr_Watch, NULL, DvdErr_stack + sizeof(DvdErr_stack), + OSCreateThread(&DvdErr_thread, (void*)mDoDvdErr_Watch, NULL, DvdErr_stack + sizeof(DvdErr_stack), sizeof(DvdErr_stack), priority - 3, 1); OSResumeThread(&DvdErr_thread); OSCreateAlarm(&Alarm);