Fix some clang errors/warnings

This commit is contained in:
LagoLunatic
2025-04-30 16:44:08 -04:00
parent f2c603a499
commit 0237004eb3
14 changed files with 61 additions and 10 deletions
+1
View File
@@ -1,5 +1,6 @@
#ifndef DVDFATAL_H
#define DVDFATAL_H
void __DVDPrintFatalMessage(void);
#endif /* DVDFATAL_H */
+15 -1
View File
@@ -4,13 +4,27 @@
#include "dolphin/dvd/dvd.h" // IWYU pragma: export
#include "dolphin/types.h"
#include "dolphin/os/OSUtil.h"
#include "dolphin/os/OSContext.h"
typedef void (*DVDLowCallback)(u32 intType);
vu32 __DIRegs[16] AT_ADDRESS(0xCC006000);
void __DVDInitWA(void);
void __DVDInterruptHandler(short unused, struct OSContext * context);
void __DVDInterruptHandler(short unused, OSContext * context);
void __DVDLowSetWAType(u32 type, u32 location);
BOOL DVDLowRead(void* addr, u32 length, u32 offset, DVDLowCallback callback);
BOOL DVDLowSeek(u32 offset, DVDLowCallback callback);
BOOL DVDLowWaitCoverClose(DVDLowCallback callback);
BOOL DVDLowReadDiskID(DVDDiskID* diskID, DVDLowCallback callback);
BOOL DVDLowStopMotor(DVDLowCallback callback);
BOOL DVDLowRequestError(DVDLowCallback callback);
BOOL DVDLowInquiry(DVDDriveInfo* info, DVDLowCallback callback);
BOOL DVDLowAudioStream(u32 subcmd, u32 length, u32 offset, DVDLowCallback callback);
BOOL DVDLowRequestAudioStatus(u32 subcmd, DVDLowCallback callback);
BOOL DVDLowAudioBufferConfig(BOOL enable, u32 size, DVDLowCallback callback);
void DVDLowReset();
BOOL DVDLowBreak();
DVDLowCallback DVDLowClearCallback(void);
#endif /* DVDLOW_H */
+5 -3
View File
@@ -1,11 +1,13 @@
#ifndef DVDQUEUE_H
#define DVDQUEUE_H
#include "dolphin/dvd/dvd.h"
void __DVDClearWaitingQueue();
int __DVDPushWaitingQueue(long prio, struct DVDCommandBlock * block);
int __DVDPushWaitingQueue(long prio, DVDCommandBlock * block);
struct DVDCommandBlock * __DVDPopWaitingQueue();
int __DVDCheckWaitingQueue();
int __DVDDequeueWaitingQueue(struct DVDCommandBlock * block);
int __DVDIsBlockInWaitingQueue(struct DVDCommandBlock * block);
int __DVDDequeueWaitingQueue(DVDCommandBlock * block);
int __DVDIsBlockInWaitingQueue(DVDCommandBlock * block);
#endif /* DVDQUEUE_H */
+1
View File
@@ -2,6 +2,7 @@
#define OS_H_
#include "stdarg.h"
#include "dolphin/base/PPCArch.h" // IWYU pragma: export
#include "dolphin/dvd/dvd.h"
#include "dolphin/os/OSAlarm.h" // IWYU pragma: export
+2 -1
View File
@@ -2,6 +2,7 @@
#define OSCACHE_H
#include "dolphin/types.h"
#include "dolphin/exi/EXIBios.h"
#ifdef __cplusplus
extern "C" {
@@ -24,7 +25,7 @@ static void LCStoreBlocks(void* destAddr, void* srcAddr, u32 blockNum);
u32 LCStoreData(void* destAddr, void* srcAddr, u32 nBytes);
void LCQueueWait(u32 len);
static void L2GlobalInvalidate(void);
static void DMAErrorHandler(u16 error, struct OSContext* context, ...);
static void DMAErrorHandler(u16 error, OSContext* context, ...);
void __OSCacheInit(void);
#ifdef __cplusplus
+2 -2
View File
@@ -180,7 +180,7 @@ cPhs_State daAgbsw0_c::create() {
}
else if(type == daAgbsw0Type_B_e) {
if(((paramNo == 1 || paramNo == 3) && sw0 != 0xFF && fopAcM_isSwitch(this, sw0)) ||
paramNo == 2 && sw0 < 0x20 && dComIfGs_isTbox(sw0)) {
(paramNo == 2 && sw0 < 0x20 && dComIfGs_isTbox(sw0))) {
return cPhs_ERROR_e;
}
}
@@ -215,7 +215,7 @@ cPhs_State daAgbsw0_c::create() {
if(type == daAgbsw0Type_B_e && getMsgNo() == 0xFFFF) {
u16 msgNo = 0xE;
// Debug map indicates fpcM_SetParam was used here instead of fopAcM_SetParam.
fpcM_SetParam(this, fopAcM_GetParam(this) & 0xFFFF0000 | msgNo);
fpcM_SetParam(this, (fopAcM_GetParam(this) & 0xFFFF0000) | msgNo);
}
if(type != daAgbsw0Type_MW_e && type != daAgbsw0Type_T_e && type != daAgbsw0Type_S_e && type != daAgbsw0Type_UNK_0xE_e && getMsgNo() == 0xFFFF) {
+2
View File
@@ -2,6 +2,8 @@
#include "dolphin/dvd/dvderror.h"
#include "dolphin/dvd/dvdfs.h"
#include "dolphin/dvd/dvdlow.h"
#include "dolphin/dvd/dvdqueue.h"
#include "dolphin/dvd/dvdFatal.h"
#include "dolphin/os/OS.h"
const char* __DVDVersion = "<< Dolphin SDK - DVD\trelease build: Sep 5 2002 05:34:06 (0x2301) >>";
+2
View File
@@ -177,6 +177,8 @@ BOOL DVDFastOpen(s32 entrynum, DVDFileInfo* fileInfo) {
return TRUE;
}
BOOL DVDGetCurrentDir(char* path, u32 maxlen);
BOOL DVDOpen(const char* fileName, DVDFileInfo* fileInfo) {
s32 entry;
char currentDir[128];
+1
View File
@@ -1,5 +1,6 @@
#include "dolphin/dvd/dvdidutils.h"
#include "dolphin/os/OS.h"
#include <string.h>
static u32 strnlen(const char* str, u32 maxlen) {
u32 i;
+15 -3
View File
@@ -7,6 +7,8 @@
#include "dolphin/db/db.h"
#include "dolphin/pad/Pad.h"
#include "dolphin/dvd/dvdfs.h"
#include "dolphin/si/SIBios.h"
#include <string.h>
// #include "TRK_MINNOW_DOLPHIN/Os/dolphin/dolphin_trk.h"
#define OS_BI2_DEBUG_ADDRESS 0x800000F4
@@ -45,6 +47,7 @@ extern f64 ZeroF;
f64 ZeroF;
ASM void __OSFPRInit(void) {
#ifdef __MWERKS__
// clang-format off
nofralloc
@@ -128,6 +131,7 @@ skip_ps_init:
mtfsf 0xff, f0
blr
// clang-format on
#endif
}
static void DisableWriteGatherPipe(void)
@@ -173,15 +177,15 @@ static void ClearArena(void) {
if ((u32)OSGetArenaLo() < *(u32*)&__OSSavedRegionStart) {
if ((u32)OSGetArenaHi() <= *(u32*)&__OSSavedRegionStart) {
memset((u32)OSGetArenaLo(), 0U, (u32)OSGetArenaHi() - (u32)OSGetArenaLo());
memset(OSGetArenaLo(), 0U, (u32)OSGetArenaHi() - (u32)OSGetArenaLo());
return;
}
memset(OSGetArenaLo(), 0U, *(u32*)&__OSSavedRegionStart - (u32)OSGetArenaLo());
if ((u32)OSGetArenaHi() > *(u32*)&__OSSavedRegionEnd) {
memset(*(u32*)&__OSSavedRegionEnd, 0,
(u32)OSGetArenaHi() - *(u32*)&__OSSavedRegionEnd);
memset(__OSSavedRegionEnd, 0,
(u8*)OSGetArenaHi() - (u8*)__OSSavedRegionEnd);
}
}
}
@@ -452,6 +456,7 @@ static void OSExceptionInit(void) {
}
ASM void __OSDBIntegrator(void) {
#ifdef __MWERKS__
// clang-format off
nofralloc
@@ -477,6 +482,7 @@ entry __OSDBJUMPSTART
bla 0x60
entry __OSDBJUMPEND
// clang-format on
#endif
}
OSExceptionHandler __OSSetExceptionHandler(__OSException exception, OSExceptionHandler handler) {
@@ -490,6 +496,7 @@ OSExceptionHandler __OSGetExceptionHandler(__OSException exception) {
}
static ASM void OSExceptionVector(void) {
#ifdef __MWERKS__
// clang-format off
nofralloc
@@ -571,10 +578,12 @@ recoverable:
entry __OSEVEnd
nop
// clang-format on
#endif
}
static ASM void OSDefaultExceptionHandler(register __OSException exception,
register OSContext* context) {
#ifdef __MWERKS__
// clang-format off
nofralloc
@@ -603,9 +612,11 @@ static ASM void OSDefaultExceptionHandler(register __OSException exception,
stwu r1, -8(r1)
b __OSUnhandledException
// clang-format on
#endif
}
ASM void __OSPSInit(void){
#ifdef __MWERKS__
// clang-format off
nofralloc
@@ -626,6 +637,7 @@ ASM void __OSPSInit(void){
mtlr r0
blr
// clang-format on
#endif
}
vu32 __DIRegs[16] AT_ADDRESS(0xCC006000);
+2
View File
@@ -179,6 +179,7 @@ static void DecrementerExceptionCallback(register __OSException exception,
static ASM void DecrementerExceptionHandler(register __OSException exception,
register OSContext* context) {
#ifdef __MWERKS__
// clang-format off
nofralloc
@@ -203,6 +204,7 @@ static ASM void DecrementerExceptionHandler(register __OSException exception,
stwu r1, -8(r1)
b DecrementerExceptionCallback
// clang-format on
#endif
}
static BOOL OnReset(BOOL final) {
+9
View File
@@ -2,11 +2,13 @@
#include "dolphin/dsp.h"
#include "dolphin/exi/EXIBios.h"
#include "dolphin/os/OS.h"
#include <string.h>
vu32 __PIRegs[12] AT_ADDRESS(0xCC003000);
vu16 __MEMRegs[64] AT_ADDRESS(0xCC004000);
ASM BOOL OSDisableInterrupts(void) {
#ifdef __MWERKS__
// clang-format off
nofralloc
@@ -23,9 +25,11 @@ ASM BOOL OSDisableInterrupts(void) {
rlwinm r3, r3, 17, 31, 31
blr
// clang-format on
#endif
}
ASM BOOL OSEnableInterrupts(void) {
#ifdef __MWERKS__
// clang-format off
nofralloc
@@ -38,9 +42,11 @@ ASM BOOL OSEnableInterrupts(void) {
rlwinm r3, r3, 17, 31, 31
blr
// clang-format on
#endif
}
ASM BOOL OSRestoreInterrupts(register BOOL status) {
#ifdef __MWERKS__
// clang-format off
nofralloc
@@ -62,6 +68,7 @@ set_msr:
rlwinm r3, r4, 17, 31, 31
blr
// clang-format on
#endif
}
static __OSInterruptHandler* InterruptHandlerTable;
@@ -401,6 +408,7 @@ void __OSDispatchInterrupt(__OSException exception, OSContext* context) {
}
static ASM void ExternalInterruptHandler(register __OSInterrupt type, register OSContext* context) {
#ifdef __MWERKS__
// clang-format off
nofralloc
@@ -427,4 +435,5 @@ static ASM void ExternalInterruptHandler(register __OSInterrupt type, register O
stwu r1, -8(r1)
b __OSDispatchInterrupt
// clang-format on
#endif
}
+1
View File
@@ -1,5 +1,6 @@
#include "dolphin/os/OSReset.h"
#include "dolphin/os/OS.h"
#include <string.h>
vu16 __VIRegs[59] AT_ADDRESS(0xCC002000);
OSThreadQueue __OSActiveThreadQueue AT_ADDRESS(OS_BASE_CACHED | 0x00DC);
+3
View File
@@ -1,6 +1,7 @@
#include "stdlib.h"
#include "global.h"
#include "dolphin/os/OS.h"
#include <string.h>
#include "dolphin/os/__start.h"
void DBInit();
@@ -13,6 +14,7 @@ SECTION_INIT void __check_pad3(void) {
}
SECTION_INIT ASM void __start(void) {
#ifdef __MWERKS__
// clang-format off
nofralloc
@@ -113,6 +115,7 @@ lbl_8000329C:
bl main
b exit
// clang-format on
#endif
}
ASM static void __init_registers(void)