From 8af44daa2e75195d7dd596cc36128bb4ec2a9c8b Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Thu, 18 Sep 2025 21:55:48 -0400 Subject: [PATCH] Enable more clangd warnings, minor cleanup --- .clangd | 7 ++----- src/d/actor/d_a_bmd.cpp | 4 ++-- src/d/actor/d_a_bmdfoot.cpp | 2 -- src/d/actor/d_a_bpw.cpp | 7 ++++--- src/d/actor/d_a_bst.cpp | 6 ++++-- src/d/actor/d_a_btd.cpp | 4 ---- src/d/actor/d_a_bwd.cpp | 6 ------ src/d/actor/d_a_player_main.cpp | 1 - 8 files changed, 12 insertions(+), 25 deletions(-) diff --git a/.clangd b/.clangd index 4975d5c64..2426bef5b 100644 --- a/.clangd +++ b/.clangd @@ -6,6 +6,7 @@ CompileFlags: "-Wno-undefined-inline", "-Wno-multichar", "-Wno-c++11-extensions", + "-Wuninitialized", "-Wsometimes-uninitialized", "-Wlogical-op-parentheses", "-Wbitwise-op-parentheses", @@ -13,13 +14,9 @@ CompileFlags: # "-Wunused-but-set-variable", # "-Wunused-parameter", "-Wunused-but-set-parameter", + "-Wself-assign", ] --- -If: - PathMatch: .*\.inc -CompileFlags: - Add: ["-Wno-return-type"] ---- If: PathMatch: src/PowerPC_EABI_Support/MSL/MSL_C\+\+/.*\.h CompileFlags: diff --git a/src/d/actor/d_a_bmd.cpp b/src/d/actor/d_a_bmd.cpp index 3cc467277..9bf2a93b9 100644 --- a/src/d/actor/d_a_bmd.cpp +++ b/src/d/actor/d_a_bmd.cpp @@ -1704,7 +1704,7 @@ static BOOL daBmd_Delete(bmd_class* i_this) { } /* 00005CF4-000064C0 .text useHeapInit__FP9bmd_class */ -s32 useHeapInit(bmd_class* i_this) { +BOOL useHeapInit(bmd_class* i_this) { J3DModelData* pJVar2; mDoExt_McaMorf* morf; J3DAnmTevRegKey* pJVar5; @@ -1861,7 +1861,7 @@ s32 useHeapInit(bmd_class* i_this) { /* 00006508-00006528 .text solidHeapCB__FP10fopAc_ac_c */ static BOOL solidHeapCB(fopAc_ac_c* a_this) { bmd_class* i_this = (bmd_class*)a_this; - useHeapInit(i_this); + return useHeapInit(i_this); } /* 00006528-00006908 .text daBmd_Create__FP10fopAc_ac_c */ diff --git a/src/d/actor/d_a_bmdfoot.cpp b/src/d/actor/d_a_bmdfoot.cpp index 9bcfe3c2b..b5245c903 100644 --- a/src/d/actor/d_a_bmdfoot.cpp +++ b/src/d/actor/d_a_bmdfoot.cpp @@ -347,7 +347,6 @@ s32 ug_move(bmdfoot_class* i_this) { /* 00001180-00001B00 .text attack_2__FP13bmdfoot_class */ void attack_2(bmdfoot_class* i_this) { fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; - bool bVar1; J3DAnmTransform* pJVar2; cXyz local_3c; cXyz local_48; @@ -402,7 +401,6 @@ void attack_2(bmdfoot_class* i_this) { mDoAud_seStart(JA_SE_CM_BKM_ATKVINE_OUT_G, &i_this->mBAC, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } ug_move(i_this); - bVar1 = true; if (i_this->mAF4->isStop()) { pJVar2 = (J3DAnmTransform*)dComIfG_getObjectRes("Bmdfoot", BMDFOOT_BCK_ASI_DATTACK2); i_this->mAF4->setAnm(pJVar2, J3DFrameCtrl::EMode_LOOP, 1.0f, 1.0f, 0.0f, -1.0f, NULL); diff --git a/src/d/actor/d_a_bpw.cpp b/src/d/actor/d_a_bpw.cpp index da5efc06b..5f9bd10ed 100644 --- a/src/d/actor/d_a_bpw.cpp +++ b/src/d/actor/d_a_bpw.cpp @@ -15,9 +15,10 @@ #include "d/d_cc_d.h" #include "d/d_s_play.h" #include "f_op/f_op_camera.h" -#include "m_Do/m_Do_graphic.h" #if VERSION == VERSION_DEMO #include "m_Do/m_Do_controller_pad.h" +#else +#include "m_Do/m_Do_graphic.h" #endif static bool GOUEN_FIRE_HIT; @@ -297,7 +298,7 @@ void kantera_draw(bpw_class* i_this) { } /* 00000B64-00000C20 .text damage_ball_draw__FP9bpw_class */ -static BOOL damage_ball_draw(bpw_class* i_this) { +static void damage_ball_draw(bpw_class* i_this) { fopAc_ac_c* actor = &i_this->actor; MtxTrans(actor->current.pos.x, actor->current.pos.y, actor->current.pos.z, false); MtxScale(0.8f, 0.8f, 0.8f, true); @@ -3749,7 +3750,7 @@ void action_b_fire_2_dousa(bpw_class* i_this) { } /* 0000BD18-0000BE50 .text damage_ball_execute__FP9bpw_class */ -static BOOL damage_ball_execute(bpw_class* i_this) { +static void damage_ball_execute(bpw_class* i_this) { fopAc_ac_c* actor = &i_this->actor; daPy_py_c* player; fopAc_ac_c* pdVar4; diff --git a/src/d/actor/d_a_bst.cpp b/src/d/actor/d_a_bst.cpp index 227df9153..470297ad1 100644 --- a/src/d/actor/d_a_bst.cpp +++ b/src/d/actor/d_a_bst.cpp @@ -2701,6 +2701,7 @@ static BOOL daBst_Execute(bst_class* i_this) { } } } + return TRUE; } /* 0000A9C8-0000A9D0 .text daBst_IsDelete__FP9bst_class */ @@ -2794,8 +2795,9 @@ static BOOL useHeapInit(fopAc_ac_c* a_this) { if (res == 0) { return FALSE; } + J3DModelData* modelData; if (i_this->mBstPartType == bst_class::Type_HEAD_e) { - J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Bst", BST_BDL_TAMA); + modelData = (J3DModelData*)dComIfG_getObjectRes("Bst", BST_BDL_TAMA); for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m0390); i++) { i_this->m0390[i] = mDoExt_J3DModel__create(modelData, 0, 0x11020203); if (i_this->m0390[i] == NULL) { @@ -2843,7 +2845,7 @@ static BOOL useHeapInit(fopAc_ac_c* a_this) { return FALSE; } } - J3DModelData* modelData = static_cast(dComIfG_getObjectRes("Bst", set_za_bdl[i_this->mBstPartType])); + modelData = static_cast(dComIfG_getObjectRes("Bst", set_za_bdl[i_this->mBstPartType])); i_this->m02C8 = mDoExt_J3DModel__create(modelData, 0, 0x11020203); if (i_this->m02C8 == NULL) { return FALSE; diff --git a/src/d/actor/d_a_btd.cpp b/src/d/actor/d_a_btd.cpp index 0394c23bf..8274b781e 100644 --- a/src/d/actor/d_a_btd.cpp +++ b/src/d/actor/d_a_btd.cpp @@ -1486,7 +1486,6 @@ void fire_attack(btd_class* i_this) { /* 00004FE4-000053E4 .text up_fire_attack__FP9btd_class */ void up_fire_attack(btd_class* i_this) { - bool bVar2; daPy_py_c* apdVar4; mDoExt_McaMorf* iVar5; cXyz local_2c; @@ -1494,7 +1493,6 @@ void up_fire_attack(btd_class* i_this) { apdVar4 = daPy_getPlayerActorClass(); iVar5 = get_anm(i_this); - bVar2 = true; i_this->m5E86 = 3; switch (i_this->mGohmaState) { case 0: @@ -1559,7 +1557,6 @@ void up_fire_attack(btd_class* i_this) { /* 000053E4-000058A4 .text yoko_fire_attack__FP9btd_class */ void yoko_fire_attack(btd_class* i_this) { - bool bVar2; daPy_py_c* apdVar4; mDoExt_McaMorf* iVar5; float fVar8; @@ -1568,7 +1565,6 @@ void yoko_fire_attack(btd_class* i_this) { apdVar4 = daPy_getPlayerActorClass(); iVar5 = get_anm(i_this); - bVar2 = true; i_this->m5E86 = 1; switch (i_this->mGohmaState) { case 0: diff --git a/src/d/actor/d_a_bwd.cpp b/src/d/actor/d_a_bwd.cpp index 5a9ade908..91de730c9 100644 --- a/src/d/actor/d_a_bwd.cpp +++ b/src/d/actor/d_a_bwd.cpp @@ -686,7 +686,6 @@ void eat_attack(bwd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; f32 fVar1; s8 bVar2; - bool bVar3; s16 sVar6; int iVar8; s8 cVar10; @@ -701,7 +700,6 @@ void eat_attack(bwd_class* i_this) { cLib_addCalcAngleS2(&actor->current.angle.y, sVar6, 10, 0x800); } i_this->m18D6 = 5; - bVar3 = true; i_this->m1BB6 = 1; bVar2 = false; switch (i_this->m18B0) { @@ -1028,7 +1026,6 @@ void s_fly(bwd_class* i_this) { void end(bwd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; bool bVar2; - bool bVar3; mDoExt_McaMorf* pmVar7; JPABaseEmitter* pJVar8; s16 uVar9; @@ -1099,7 +1096,6 @@ void end(bwd_class* i_this) { g_eff_off(i_this); } bVar2 = false; - bVar3 = true; i_this->m1BB6 = 1; if (i_this->m02C0->isStop()) { #if VERSION == VERSION_USA @@ -1490,7 +1486,6 @@ void demo_camera(bwd_class* i_this) { camera_class* pcVar4; fopAc_ac_c* pfVar7; camera_class* pcVar11; - f32 dVar13; cXyz local_98; cXyz local_a4; cXyz local_b0; @@ -1840,7 +1835,6 @@ void demo_camera(bwd_class* i_this) { local_a4.y = i_this->m3C28.y + i_this->m3C4C * cM_scos(i_this->m3C20 * 0x3000); local_a4.z = i_this->m3C28.z; local_b0.x = i_this->m3C34.x + i_this->m3C4C * cM_ssin(i_this->m3C20 * 0x3300); - dVar13 = local_b0.x; local_b0.y = i_this->m3C34.y + i_this->m3C4C * cM_scos(i_this->m3C20 * 0x3000); local_b0.z = i_this->m3C34.z; sVar3 = (i_this->m3C4C * cM_scos(i_this->m18AC * 0x1c00) * 7.5f); diff --git a/src/d/actor/d_a_player_main.cpp b/src/d/actor/d_a_player_main.cpp index 89d34c1dd..f5b86ab50 100644 --- a/src/d/actor/d_a_player_main.cpp +++ b/src/d/actor/d_a_player_main.cpp @@ -7636,7 +7636,6 @@ BOOL daPy_lk_c::procDamage() { uVar4 = (16384.0f * (1.0f - (dVar6 / (mFrameCtrlUnder[UNDER_MOVE0_e].getEnd() - daPy_HIO_damage_c0::m.field_0x28)))); fVar1 = 1.0f - cM_scos(uVar4); - uVar4 = uVar4; fVar2 = 1.0f - cM_scos(uVar4 < 0x2000 ? 0 : (s16)((uVar4 - 0x2000) * 2)); } m3564 = m34D4 * fVar1;