Fix C23 introduced warnings

This commit is contained in:
a
2025-06-24 23:49:02 -04:00
parent 640633651e
commit 221c63e659
8 changed files with 14 additions and 51 deletions

View File

@@ -304,7 +304,7 @@ endif
# C compiler options
CFLAGS = -G 0 $(TARGET_CFLAGS) $(DEF_INC_CFLAGS) $(foreach i,$(INCLUDE_DIRS),--embed-dir=$(i))
CFLAGS += -std=gnu23 -Wno-unused-variable -mno-shared -march=vr4300 -mfix4300 -mabi=32 -mhard-float -mdivide-breaks -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-PIC -mno-abicalls -fno-strict-aliasing -fno-inline-functions -ffreestanding -fwrapv -Wall -Wextra
CFLAGS += -Wno-missing-braces
CFLAGS += -Wno-missing-braces -Wno-maybe-uninitialized
ASFLAGS := -march=vr4300 -mabi=32 $(foreach i,$(INCLUDE_DIRS),-I$(i)) $(foreach d,$(DEFINES),--defsym $(d))
ASMFLAGS := -G 0 $(OPT_FLAGS) $(TARGET_CFLAGS) -mips3 $(DEF_INC_CFLAGS) -mno-shared -march=vr4300 -mfix4300 -mabi=32 -mhard-float -mdivide-breaks -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-PIC -mno-abicalls -fno-strict-aliasing -fno-inline-functions -ffreestanding -fwrapv -Wall -Wextra

View File

@@ -102,10 +102,9 @@ s8 get_vibrato_pitch_change(struct VibratoState *vib) {
switch (index & 0x30) {
case 0x10:
index = 31 - index;
// fall through
case 0x00:
return vib->curve[index];
case 0x20:
index -= 0x20;
break;
@@ -239,15 +238,15 @@ s32 adsr_update(struct AdsrState *adsr) {
adsr->state = ADSR_STATE_HANG;
break;
}
// fallthrough
}
// fallthrough
case ADSR_STATE_START_LOOP:
adsr->envIndex = 0;
adsr->currentHiRes = adsr->current << 0x10;
adsr->state = ADSR_STATE_LOOP;
// fallthrough
// fallthrough
case ADSR_STATE_LOOP:
adsr->delay = BSWAP16(adsr->envelope[adsr->envIndex].delay);
switch (adsr->delay) {

View File

@@ -124,17 +124,20 @@ struct Object *spawn_star(struct Object *star, f32 homeX, f32 homeY, f32 homeZ)
}
void spawn_default_star(f32 homeX, f32 homeY, f32 homeZ) {
struct Object *star = spawn_star(star, homeX, homeY, homeZ);
struct Object *star = NULL;
spawn_star(star, homeX, homeY, homeZ);
star->oBhvParams2ndByte = 0;
}
void spawn_red_coin_cutscene_star(f32 homeX, f32 homeY, f32 homeZ) {
struct Object *star = spawn_star(star, homeX, homeY, homeZ);
struct Object *star = NULL;
spawn_star(star, homeX, homeY, homeZ);
star->oBhvParams2ndByte = 1;
}
void spawn_no_exit_star(f32 homeX, f32 homeY, f32 homeZ) {
struct Object *star = spawn_star(star, homeX, homeY, homeZ);
struct Object *star = NULL;
spawn_star(star, homeX, homeY, homeZ);
star->oBhvParams2ndByte = 1;
star->oInteractionSubtype |= INT_SUBTYPE_NO_EXIT;
}

View File

@@ -161,6 +161,7 @@ void bhv_unagi_loop(void) {
break;
case 2:
unagi_act_2();
// fall through
case 3:
unagi_act_3();
break;

View File

@@ -1605,6 +1605,7 @@ s32 update_boss_fight_camera(struct Camera *c, Vec3f focus, Vec3f pos) {
case AREA_BOB:
pos[1] += 125.f;
//! fall through, makes the BoB boss fight camera move up twice as high as it should
// fall through
case AREA_WF:
pos[1] += 125.f;
}

View File

@@ -1285,7 +1285,7 @@ s32 act_crawling(struct MarioState *m) {
mario_set_forward_vel(m, 10.0f);
}
//! Possibly unintended missing break
// fall through
case GROUND_STEP_NONE:
align_with_floor(m);
break;

View File

@@ -1895,47 +1895,6 @@ void d_set_att_offset(const struct GdVec3f *off) {
}
}
/**
* An incorrectly-coded recursive function that was presumably supposed to
* set the offset of an attached object. Now, it will only call itself
* until it encounters a NULL pointer, which will trigger a `fatal_printf()`
* call.
*
* @note Not called
*/
void d_set_att_to_offset(UNUSED u32 a) {
struct GdObj *dynobj; // sp3c
UNUSED u8 filler[24];
if (sDynListCurObj == NULL) {
fatal_printf("proc_dynlist(): No current object");
}
dynobj = sDynListCurObj;
d_stash_dynobj();
switch (sDynListCurObj->type) {
case OBJ_TYPE_JOINTS:
set_cur_dynobj(((struct ObjJoint *) dynobj)->attachedToObj);
break;
case OBJ_TYPE_NETS:
set_cur_dynobj(((struct ObjNet *) dynobj)->attachedToObj);
break;
case OBJ_TYPE_PARTICLES:
set_cur_dynobj(((struct ObjParticle *) dynobj)->attachedToObj);
break;
default:
fatal_printf("%s: Object '%s'(%x) does not support this function.", "dSetAttToOffset()",
sDynListCurInfo->name, sDynListCurObj->type);
}
if (sDynListCurObj == NULL) {
fatal_printf("dSetAttOffset(): Object '%s' isnt attached to anything",
sStashedDynObjInfo->name);
}
d_set_att_to_offset(a);
d_unstash_dynobj();
}
/**
* Store the offset of the attached object into `dst`.
*

View File

@@ -17,7 +17,7 @@ u8 gCrashScreenCharToGlyph[128] = {
};
// A height of seven pixels for each Character * nine rows of characters + one row unused.
u32 gCrashScreenFont[7 * 9 + 1] = {
u32 gCrashScreenFont[] = {
#embed "textures/crash_screen/crash_screen_font.ia1.bin"
};