Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solved a bunch of -Wall errors on modern #1926

Merged
merged 5 commits into from
Oct 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gflib/string_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ u8 *ConvertIntToHexStringN(u8 *dest, s32 value, enum StringConvertMode mode, u8

if (state == WRITING_DIGITS)
{
char *out = dest++;
u8 *out = dest++;

if (digit <= 0xF)
c = sDigits[digit];
Expand All @@ -309,7 +309,7 @@ u8 *ConvertIntToHexStringN(u8 *dest, s32 value, enum StringConvertMode mode, u8
}
else if (digit != 0 || powerOfSixteen == 1)
{
char *out;
u8 *out;
state = WRITING_DIGITS;
out = dest++;

Expand Down
6 changes: 2 additions & 4 deletions gflib/text.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,8 +554,7 @@ void DecompressGlyphTile(const void *src_, void *dest_)
*(dest++) = ((sFontHalfRowLookupTable[sFontHalfRowOffsets[temp & 0xFF]]) << 16) | (sFontHalfRowLookupTable[sFontHalfRowOffsets[temp >> 8]]);
}

// Unused
static u8 GetLastTextColor(u8 colorType)
static u8 UNUSED GetLastTextColor(u8 colorType)
{
switch (colorType)
{
Expand Down Expand Up @@ -1224,8 +1223,7 @@ static u16 RenderText(struct TextPrinter *textPrinter)
return RENDER_FINISH;
}

// Unused
static u32 GetStringWidthFixedWidthFont(const u8 *str, u8 fontId, u8 letterSpacing)
static u32 UNUSED GetStringWidthFixedWidthFont(const u8 *str, u8 fontId, u8 letterSpacing)
{
int i;
u8 width;
Expand Down
2 changes: 1 addition & 1 deletion gflib/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ void BlitBitmapRectToWindow(u8 windowId, const u8 *pixels, u16 srcX, u16 srcY, u
BlitBitmapRect4Bit(&sourceRect, &destRect, srcX, srcY, destX, destY, rectWidth, rectHeight, 0);
}

static void BlitBitmapRectToWindowWithColorKey(u8 windowId, const u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight, u8 colorKey)
static void UNUSED BlitBitmapRectToWindowWithColorKey(u8 windowId, const u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight, u8 colorKey)
{
struct Bitmap sourceRect;
struct Bitmap destRect;
Expand Down
8 changes: 4 additions & 4 deletions src/AgbRfu_LinkManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ u8 rfu_LMAN_CHILD_connectParent(u16 parentId, u16 connect_period)
return 0;
}

static void rfu_LMAN_PARENT_stopWaitLinkRecoveryAndDisconnect(u8 bm_targetSlot)
static void UNUSED rfu_LMAN_PARENT_stopWaitLinkRecoveryAndDisconnect(u8 bm_targetSlot)
{
u8 i;

Expand Down Expand Up @@ -1295,7 +1295,7 @@ void rfu_LMAN_setMSCCallback(void (*MSC_callback_p)(u16))
rfu_setMSCCallback(rfu_LMAN_MSC_callback);
}

static void rfu_LMAN_setLMANCallback(void (*func)(u8, u8))
static void UNUSED rfu_LMAN_setLMANCallback(void (*func)(u8, u8))
{
lman.LMAN_callback = func;
}
Expand All @@ -1315,7 +1315,7 @@ u8 rfu_LMAN_setLinkRecovery(u8 enable_flag, u16 recovery_period)
return 0;
}

static u8 rfu_LMAN_setNIFailCounterLimit(u16 NI_failCounter_limit)
static u8 UNUSED rfu_LMAN_setNIFailCounterLimit(u16 NI_failCounter_limit)
{
if (gRfuLinkStatus->sendSlotNIFlag | gRfuLinkStatus->recvSlotNIFlag)
{
Expand All @@ -1327,7 +1327,7 @@ static u8 rfu_LMAN_setNIFailCounterLimit(u16 NI_failCounter_limit)
return 0;
}

static u8 rfu_LMAN_setFastSearchParent(u8 enable_flag)
static u8 UNUSED rfu_LMAN_setFastSearchParent(u8 enable_flag)
{
if (lman.state == LMAN_STATE_START_SEARCH_PARENT || lman.state == LMAN_STATE_POLL_SEARCH_PARENT || lman.state == LMAN_STATE_END_SEARCH_PARENT)
{
Expand Down
9 changes: 5 additions & 4 deletions src/apprentice.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,9 @@ static void CreateApprenticeMenu(u8 menu)
default:
left = 0;
top = 0;
#ifdef UBFIX
return;
#endif
break;
}

Expand Down Expand Up @@ -1278,8 +1281,7 @@ const u8 *GetApprenticeNameInLanguage(u32 apprenticeId, s32 language)
}
}

// Functionally unused
static void Task_SwitchToFollowupFuncAfterButtonPress(u8 taskId)
static void UNUSED Task_SwitchToFollowupFuncAfterButtonPress(u8 taskId)
{
if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON))
SwitchTaskToFollowupFunc(taskId);
Expand All @@ -1302,8 +1304,7 @@ static void ExecuteFuncAfterButtonPress(void (*func)(void))
gTasks[taskId].data[1] = (u32)(func) >> 16;
}

// Unused
static void ExecuteFollowupFuncAfterButtonPress(TaskFunc task)
static void UNUSED ExecuteFollowupFuncAfterButtonPress(TaskFunc task)
{
u8 taskId = CreateTask(Task_SwitchToFollowupFuncAfterButtonPress, 1);
SetTaskFuncWithFollowupFunc(taskId, Task_SwitchToFollowupFuncAfterButtonPress, task);
Expand Down
2 changes: 1 addition & 1 deletion src/battle_ai_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -2252,7 +2252,7 @@ static void AIStackPushVar(const u8 *var)
gBattleResources->AI_ScriptsStack->ptr[gBattleResources->AI_ScriptsStack->size++] = var;
}

static void AIStackPushVar_cursor(void)
static void UNUSED AIStackPushVar_cursor(void)
{
gBattleResources->AI_ScriptsStack->ptr[gBattleResources->AI_ScriptsStack->size++] = gAIScriptPtr;
}
Expand Down
2 changes: 1 addition & 1 deletion src/battle_anim_bug.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ static void AnimMissileArc_Step(struct Sprite *sprite)
else
{
s16 tempData[8];
u16 *data = sprite->data;
s16 *data = sprite->data;
u16 x1 = sprite->x;
s16 x2 = sprite->x2;
u16 y1 = sprite->y;
Expand Down
14 changes: 6 additions & 8 deletions src/battle_anim_effects_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -2765,7 +2765,7 @@ static void AnimConstrictBinding(struct Sprite *sprite)

static void AnimConstrictBinding_Step1(struct Sprite *sprite)
{
u8 spriteId;
u8 UNUSED spriteId;

if ((u16)gBattleAnimArgs[7] == 0xFFFF)
{
Expand All @@ -2778,7 +2778,7 @@ static void AnimConstrictBinding_Step1(struct Sprite *sprite)

static void AnimConstrictBinding_Step2(struct Sprite *sprite)
{
u8 spriteId = GetAnimBattlerSpriteId(ANIM_TARGET);
u8 UNUSED spriteId = GetAnimBattlerSpriteId(ANIM_TARGET);
if (!sprite->data[2])
sprite->data[0] += 11;
else
Expand Down Expand Up @@ -3884,7 +3884,7 @@ static void AnimSlice_Step(struct Sprite *sprite)
}
}

static void UnusedFlickerAnim(struct Sprite *sprite)
static void UNUSED UnusedFlickerAnim(struct Sprite *sprite)
{
if (sprite->data[2] > 1)
{
Expand Down Expand Up @@ -4734,7 +4734,7 @@ static void AnimFalseSwipeSlice(struct Sprite *sprite)

static void AnimFalseSwipePositionedSlice(struct Sprite *sprite)
{
sprite->x = sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + 0xFFD0 + gBattleAnimArgs[0];
sprite->x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) - 48 + gBattleAnimArgs[0];
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
StartSpriteAnim(sprite, 1);
sprite->data[0] = 0;
Expand Down Expand Up @@ -4917,8 +4917,7 @@ void AnimTask_Conversion2AlphaBlend(u8 taskId)
}
}

// Unused
static void AnimTask_HideBattlersHealthbox(u8 taskId)
static void UNUSED AnimTask_HideBattlersHealthbox(u8 taskId)
{
u8 i;
for (i = 0; i < gBattlersCount; i++)
Expand All @@ -4933,8 +4932,7 @@ static void AnimTask_HideBattlersHealthbox(u8 taskId)
DestroyAnimVisualTask(taskId);
}

// Unused
static void AnimTask_ShowBattlersHealthbox(u8 taskId)
static void UNUSED AnimTask_ShowBattlersHealthbox(u8 taskId)
{
u8 i;
for (i = 0; i < gBattlersCount; i++)
Expand Down
10 changes: 5 additions & 5 deletions src/battle_anim_effects_2.c
Original file line number Diff line number Diff line change
Expand Up @@ -2551,8 +2551,8 @@ static void AnimPencil_Step(struct Sprite *sprite)
static void AnimBlendThinRing(struct Sprite *sprite)
{
u8 battler = 0;
u16 sp0 = 0;
u16 sp1 = 0;
s16 x = 0;
s16 y = 0;
u8 r4;

if (gBattleAnimArgs[2] == 0)
Expand All @@ -2563,16 +2563,16 @@ static void AnimBlendThinRing(struct Sprite *sprite)
r4 = gBattleAnimArgs[3] ^ 1;
if (IsDoubleBattle() && IsBattlerSpriteVisible(BATTLE_PARTNER(battler)))
{
SetAverageBattlerPositions(battler, r4, &sp0, &sp1);
SetAverageBattlerPositions(battler, r4, &x, &y);
if (r4 == 0)
r4 = GetBattlerSpriteCoord(battler, BATTLER_COORD_X);
else
r4 = GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2);

if (GetBattlerSide(battler) != B_SIDE_PLAYER)
gBattleAnimArgs[0] -= (sp0 - r4) - gBattleAnimArgs[0]; // This is weird.
gBattleAnimArgs[0] -= (x - r4) - gBattleAnimArgs[0]; // This is weird.
else
gBattleAnimArgs[0] = sp0 - r4;
gBattleAnimArgs[0] = x - r4;
}

sprite->callback = AnimSpriteOnMonPos;
Expand Down
7 changes: 3 additions & 4 deletions src/battle_anim_effects_3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1428,8 +1428,7 @@ static void FadeScreenToWhite_Step(u8 taskId)

static void AnimSpikes(struct Sprite *sprite)
{
u16 x;
u16 y;
s16 x, y;

InitSpritePosToAnimAttacker(sprite, TRUE);
SetAverageBattlerPositions(gBattleAnimTarget, FALSE, &x, &y);
Expand Down Expand Up @@ -4758,8 +4757,8 @@ static void AnimMeteorMashStar_Step(struct Sprite *sprite)
// arg 4: duration
static void AnimMeteorMashStar(struct Sprite *sprite)
{
s16 y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2); // unused local variable
s16 x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); // unused local variable
s16 UNUSED y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
s16 UNUSED x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);

if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER || IsContest())
{
Expand Down
3 changes: 1 addition & 2 deletions src/battle_anim_flying.c
Original file line number Diff line number Diff line change
Expand Up @@ -1220,8 +1220,7 @@ void AnimSkyAttackBird_Step(struct Sprite *sprite)
DestroySpriteAndMatrix(sprite);
}

// Unused
static void AnimTask_SetAttackerVisibility(u8 taskId)
static void UNUSED AnimTask_SetAttackerVisibility(u8 taskId)
{
if (gBattleAnimArgs[0] == 0)
{
Expand Down
21 changes: 7 additions & 14 deletions src/battle_anim_mons.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,8 @@ void TranslateSpriteInGrowingCircle(struct Sprite *sprite)
}
}

// Unused
// Exact shape depends on arguments. Can move in a figure-8-like pattern, or circular, etc.
static void TranslateSpriteInLissajousCurve(struct Sprite *sprite)
static void UNUSED TranslateSpriteInLissajousCurve(struct Sprite *sprite)
{
if (sprite->sDuration)
{
Expand Down Expand Up @@ -639,8 +638,7 @@ static void TranslateSpriteLinearFixedPointIconFrame(struct Sprite *sprite)
UpdateMonIconFrame(sprite);
}

// Unused
static void TranslateSpriteToBattleTargetPos(struct Sprite *sprite)
static void UNUSED TranslateSpriteToBattleTargetPos(struct Sprite *sprite)
{
sprite->sStartX = sprite->x + sprite->x2;
sprite->sStartY = sprite->y + sprite->y2;
Expand Down Expand Up @@ -707,8 +705,7 @@ void DestroySpriteAndMatrix(struct Sprite *sprite)
DestroyAnimSprite(sprite);
}

// Unused
static void TranslateSpriteToBattleAttackerPos(struct Sprite *sprite)
static void UNUSED TranslateSpriteToBattleAttackerPos(struct Sprite *sprite)
{
sprite->sStartX = sprite->x + sprite->x2;
sprite->sStartY = sprite->y + sprite->y2;
Expand All @@ -723,8 +720,7 @@ static void TranslateSpriteToBattleAttackerPos(struct Sprite *sprite)
#undef sStartY
#undef sTargetY

// Unused
static void EndUnkPaletteAnim(struct Sprite *sprite)
static void UNUSED EndUnkPaletteAnim(struct Sprite *sprite)
{
PaletteStruct_ResetById(sprite->data[5]);
DestroySpriteAndMatrix(sprite);
Expand Down Expand Up @@ -1103,8 +1099,7 @@ void StartAnimLinearTranslation(struct Sprite *sprite)
sprite->callback(sprite);
}

// Unused
static void StartAnimLinearTranslation_SetCornerVecX(struct Sprite *sprite)
static void UNUSED StartAnimLinearTranslation_SetCornerVecX(struct Sprite *sprite)
{
sprite->data[1] = sprite->x;
sprite->data[3] = sprite->y;
Expand Down Expand Up @@ -1512,8 +1507,7 @@ u8 GetSpritePalIdxByBattler(u8 battler)
return battler;
}

// Unused
static u8 GetSpritePalIdxByPosition(u8 position)
static u8 UNUSED GetSpritePalIdxByPosition(u8 position)
{
return GetBattlerAtPosition(position);
}
Expand Down Expand Up @@ -2012,8 +2006,7 @@ void AnimTask_GetFrustrationPowerLevel(u8 taskId)
DestroyAnimVisualTask(taskId);
}

// Unused
static void SetPriorityForVisibleBattlers(u8 priority)
static void UNUSED SetPriorityForVisibleBattlers(u8 priority)
{
if (IsBattlerSpriteVisible(gBattleAnimTarget))
gSprites[gBattlerSpriteIds[gBattleAnimTarget]].oam.priority = priority;
Expand Down
3 changes: 1 addition & 2 deletions src/battle_anim_status_effects.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,7 @@ static const struct SpriteTemplate sFlashingCircleImpactSpriteTemplate =
.callback = AnimFlashingCircleImpact,
};

// Unused
static u8 Task_FlashingCircleImpacts(u8 battlerId, bool8 red)
static u8 UNUSED Task_FlashingCircleImpacts(u8 battlerId, bool8 red)
{
u8 battlerSpriteId = gBattlerSpriteIds[battlerId];
u8 taskId = CreateTask(Task_UpdateFlashingCircleImpacts, 10);
Expand Down
4 changes: 2 additions & 2 deletions src/battle_anim_throw.c
Original file line number Diff line number Diff line change
Expand Up @@ -2386,11 +2386,11 @@ static void SpriteCB_ShinyStars_Diagonal(struct Sprite *sprite)

void AnimTask_LoadPokeblockGfx(u8 taskId)
{
u8 paletteIndex;
u8 UNUSED paletteIndex;

LoadCompressedSpriteSheetUsingHeap(&gBattleAnimPicTable[ANIM_TAG_POKEBLOCK - ANIM_SPRITES_START]);
LoadCompressedSpritePaletteUsingHeap(&gBattleAnimPaletteTable[ANIM_TAG_POKEBLOCK - ANIM_SPRITES_START]);
paletteIndex = IndexOfSpritePaletteTag(ANIM_TAG_POKEBLOCK); // unused
paletteIndex = IndexOfSpritePaletteTag(ANIM_TAG_POKEBLOCK);
DestroyAnimVisualTask(taskId);
}

Expand Down
5 changes: 4 additions & 1 deletion src/battle_anim_utility_funcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ void AnimTask_BlendBattleAnimPalExclude(u8 taskId)
selectedPalettes = 0;
// fall through
case ANIM_ATTACKER:
#ifdef UBFIX
default:
#endif
animBattlers[0] = gBattleAnimAttacker;
break;
case 3:
Expand Down Expand Up @@ -806,7 +809,7 @@ void AnimTask_SetAllNonAttackersInvisiblity(u8 taskId)
DestroyAnimVisualTask(taskId);
}

void StartMonScrollingBgMask(u8 taskId, int unused, u16 scrollSpeed, u8 battler, bool8 includePartner, u8 numFadeSteps, u8 fadeStepDelay, u8 duration, const u32 *gfx, const u32 *tilemap, const u32 *palette)
void StartMonScrollingBgMask(u8 taskId, int UNUSED unused, u16 scrollSpeed, u8 battler, bool8 includePartner, u8 numFadeSteps, u8 fadeStepDelay, u8 duration, const u32 *gfx, const u32 *tilemap, const u32 *palette)
{
u16 species;
u8 spriteId, spriteId2;
Expand Down
3 changes: 1 addition & 2 deletions src/battle_arena.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,7 @@ void BattleArena_DeductSkillPoints(u8 battler, u16 stringId)
}
}

// Unused
static void UpdateHPAtStart(u8 battler)
static void UNUSED UpdateHPAtStart(u8 battler)
{
u16 *hpAtStart = gBattleStruct->arenaStartHp;

Expand Down
6 changes: 3 additions & 3 deletions src/battle_bg.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,9 +692,9 @@ static const struct BattleBackground sBattleTerrainTable[] =
},
};

static void CB2_UnusedBattleInit(void);
static void UNUSED CB2_UnusedBattleInit(void);

static void UnusedBattleInit(void)
static void UNUSED UnusedBattleInit(void)
{
u8 spriteId;

Expand All @@ -704,7 +704,7 @@ static void UnusedBattleInit(void)
SetMainCallback2(CB2_UnusedBattleInit);
}

static void CB2_UnusedBattleInit(void)
static void UNUSED CB2_UnusedBattleInit(void)
{
AnimateSprites();
BuildOamBuffer();
Expand Down
Loading