From ea73a9c5fea05c77d0d64cff4a7270f27f07af70 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Sat, 17 May 2025 14:29:33 -0400 Subject: [PATCH] Fix more clangd warnings/errors --- .clangd | 1 + include/global.h | 1 + .../Math/Double_precision/e_atan2.c | 3 +- .../Math/Double_precision/s_atan.c | 3 +- src/dolphin/os/OSCache.c | 32 ++++++++++++++++++- src/dolphin/os/OSLink.c | 1 + src/dolphin/os/__start.c | 2 +- 7 files changed, 39 insertions(+), 4 deletions(-) diff --git a/.clangd b/.clangd index 893158290..aed8f88e8 100644 --- a/.clangd +++ b/.clangd @@ -1,6 +1,7 @@ # https://clangd.llvm.org/config CompileFlags: Add: [ + "-fdeclspec", "-Wno-c++11-compat-deprecated-writable-strings", "-Wno-undefined-inline", "-Wno-multichar", diff --git a/include/global.h b/include/global.h index a9b9932b3..42687f340 100644 --- a/include/global.h +++ b/include/global.h @@ -44,6 +44,7 @@ extern int __cntlzw(uint); extern int __rlwimi(int, int, int, int, int); extern void __dcbz(void*, int); +extern void __sync(); #define VERSION_JPN 0 #define VERSION_USA 1 diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_atan2.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_atan2.c index 5a7863be0..81d812560 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_atan2.c +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_atan2.c @@ -40,6 +40,7 @@ */ #include "fdlibm.h" +#include "math.h" #ifdef __STDC__ static const double @@ -140,4 +141,4 @@ double __ieee754_atan2(y, x) double y, x; default: /* case 3 */ return (z - pi_lo) - pi; /* atan(-,-) */ } -} \ No newline at end of file +} diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_atan.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_atan.c index 0f88ef2fc..e771307b9 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_atan.c +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_atan.c @@ -33,6 +33,7 @@ */ #include "fdlibm.h" +#include "math.h" #ifdef __STDC__ static const double atanhi[] = { @@ -140,4 +141,4 @@ double atan(x) double x; z = atanhi[id] - ((x * (s1 + s2) - atanlo[id]) - x); return (hx < 0) ? -z : z; } -} \ No newline at end of file +} diff --git a/src/dolphin/os/OSCache.c b/src/dolphin/os/OSCache.c index d39e8b143..99a41efb2 100644 --- a/src/dolphin/os/OSCache.c +++ b/src/dolphin/os/OSCache.c @@ -5,6 +5,7 @@ static ASM void DCEnable(void) { // clang-format off +#ifdef __MWERKS__ nofralloc sync @@ -13,11 +14,13 @@ static ASM void DCEnable(void) { mtspr 0x3F0, r3 blr +#endif // clang-format on } ASM void DCInvalidateRange(register void* start, register u32 nBytes) { // clang-format off +#ifdef __MWERKS__ nofralloc cmplwi nBytes, 0 @@ -35,11 +38,13 @@ do_invalidate: bdnz do_invalidate blr +#endif // clang-format on } ASM void DCFlushRange(register void* start, register u32 nBytes) { // clang-format off +#ifdef __MWERKS__ nofralloc cmplwi nBytes, 0 @@ -58,11 +63,13 @@ do_flush: sc blr +#endif // clang-format on } ASM void DCStoreRange(register void* start, register u32 nBytes) { // clang-format off +#ifdef __MWERKS__ nofralloc cmplwi nBytes, 0 @@ -81,11 +88,13 @@ do_store: sc blr +#endif // clang-format on } ASM void DCFlushRangeNoSync(register void* start, register u32 nBytes) { // clang-format off +#ifdef __MWERKS__ nofralloc cmplwi nBytes, 0 @@ -103,11 +112,13 @@ do_flush: bdnz do_flush blr +#endif // clang-format on } ASM void DCStoreRangeNoSync(register void* start, register u32 nBytes) { // clang-format off +#ifdef __MWERKS__ nofralloc cmplwi nBytes, 0 @@ -125,11 +136,13 @@ do_store: bdnz do_store blr +#endif // clang-format on } ASM void DCZeroRange(register void* start, register u32 nBytes) { // clang-format off +#ifdef __MWERKS__ nofralloc cmplwi nBytes, 0 @@ -147,11 +160,13 @@ do_zero: bdnz do_zero blr +#endif // clang-format on } ASM void ICInvalidateRange(register void* start, register u32 nBytes) { // clang-format off +#ifdef __MWERKS__ nofralloc cmplwi nBytes, 0 @@ -172,11 +187,13 @@ do_invalidate: isync blr +#endif // clang-format on } ASM void ICFlashInvalidate(void) { // clang-format off +#ifdef __MWERKS__ nofralloc mfspr r3, 0x3F0 @@ -184,11 +201,13 @@ ASM void ICFlashInvalidate(void) { mtspr 0x3F0, r3 blr +#endif // clang-format on } static ASM void ICEnable(void) { // clang-format off +#ifdef __MWERKS__ nofralloc isync @@ -197,11 +216,13 @@ static ASM void ICEnable(void) { mtspr 0x3F0, r3 blr +#endif // clang-format on } ASM void __LCEnable(void) { // clang-format off +#ifdef __MWERKS__ nofralloc mfmsr r5 @@ -265,6 +286,7 @@ do_load: nop blr +#endif // clang-format on } @@ -276,6 +298,7 @@ void LCEnable(void) { ASM void LCDisable(void) { // clang-format off +#ifdef __MWERKS__ nofralloc lis r3, 0xE000 @@ -291,12 +314,14 @@ do_invalidate: mtspr 0x398, r4 blr +#endif // clang-format on } static ASM void LCStoreBlocks(register void* destAddr, register void* srcAddr, register u32 blockNum){ // clang-format off +#ifdef __MWERKS__ nofralloc rlwinm r6, blockNum, 0x1E, 0x1B, 0x1F @@ -309,8 +334,11 @@ static ASM void LCStoreBlocks(register void* destAddr, register void* srcAddr, mtspr 0x39B, r6 blr +#endif // clang-format on -} /* 8033B838-8033B8E4 336178 00AC+00 0/0 0/0 3/3 .text LCStoreData */ +} + +/* 8033B838-8033B8E4 336178 00AC+00 0/0 0/0 3/3 .text LCStoreData */ u32 LCStoreData(void* destAddr, void* srcAddr, u32 nBytes) { u32 blocks = (nBytes + 31) / 32; u32 ret = (blocks + 127) / 128; @@ -333,6 +361,7 @@ u32 LCStoreData(void* destAddr, void* srcAddr, u32 nBytes) { ASM void LCQueueWait(register u32 len) { // clang-format off +#ifdef __MWERKS__ nofralloc addi len, len, 1 @@ -343,6 +372,7 @@ LCQueueWait_04: bge cr2, LCQueueWait_04 blr +#endif // clang-format on } diff --git a/src/dolphin/os/OSLink.c b/src/dolphin/os/OSLink.c index 6acb67921..86480fa86 100644 --- a/src/dolphin/os/OSLink.c +++ b/src/dolphin/os/OSLink.c @@ -1,4 +1,5 @@ #include "dolphin/os/OS.h" +#include #define SHN_UNDEF 0 #define SHN_LORESERVE 0xff00 diff --git a/src/dolphin/os/__start.c b/src/dolphin/os/__start.c index b029387c3..b1187aa53 100644 --- a/src/dolphin/os/__start.c +++ b/src/dolphin/os/__start.c @@ -5,7 +5,7 @@ #include "dolphin/os/__start.h" void DBInit(); -static void __init_registers(void); +void __init_registers(void); SECTION_INIT void __check_pad3(void) { if ((*(u16*)0x800030E4 & 0xEEF) == 0xEEF) {