From 2988883a12d6016ff43203b7a8426355cb4fc6fa Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Mon, 29 Jan 2024 12:52:03 -0300 Subject: [PATCH 1/4] Unused warnings are not treated as errrors by default --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index d899015225..df402f96ad 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,7 @@ REVISION := 0 MODERN ?= 1 TEST ?= 0 ANALYZE ?= 0 +UNUSED_ERROR?= 0 ifeq (agbcc,$(MAKECMDGOALS)) MODERN := 0 @@ -127,6 +128,9 @@ override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi ifeq ($(ANALYZE),1) override CFLAGS += -fanalyzer endif +ifeq ($(UNUSED_ERROR),0) +override CFLAGS += -Wno-error=unused-variable -Wno-error=unused-variable -Wno-error=unused-const-variable -Wno-error=unused-parameter -Wno-error=unused-function -Wno-error=unused-but-set-parameter -Wno-error=unused-but-set-variable -Wno-error=unused-value -Wno-error=unused-local-typedefs +endif ROM := $(MODERN_ROM_NAME) OBJ_DIR := $(MODERN_OBJ_DIR_NAME) LIBPATH := -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libnosys.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libc.a))" From e8a6c463915fcb4186c8ff2da4faaca61534eaf6 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Mon, 29 Jan 2024 13:19:01 -0300 Subject: [PATCH 2/4] Only do unused error under RHH's repo + workflow test --- .github/workflows/build.yml | 1 + Makefile | 3 +++ src/battle_interface.c | 9 +++++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8c5bcb7ed8..0322cbe11f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,6 +17,7 @@ jobs: GAME_LANGUAGE: ENGLISH MODERN: 0 COMPARE: 0 + UNUSED_ERROR: 1 steps: - name: Checkout uses: actions/checkout@v2 diff --git a/Makefile b/Makefile index df402f96ad..88376cddef 100644 --- a/Makefile +++ b/Makefile @@ -128,9 +128,12 @@ override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi ifeq ($(ANALYZE),1) override CFLAGS += -fanalyzer endif +# Only throw an error for unused elements if its RH-Hideout's repo ifeq ($(UNUSED_ERROR),0) +ifneq ($(GITHUB_REPOSITORY_OWNER),rh-hideout) override CFLAGS += -Wno-error=unused-variable -Wno-error=unused-variable -Wno-error=unused-const-variable -Wno-error=unused-parameter -Wno-error=unused-function -Wno-error=unused-but-set-parameter -Wno-error=unused-but-set-variable -Wno-error=unused-value -Wno-error=unused-local-typedefs endif +endif ROM := $(MODERN_ROM_NAME) OBJ_DIR := $(MODERN_OBJ_DIR_NAME) LIBPATH := -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libnosys.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libc.a))" diff --git a/src/battle_interface.c b/src/battle_interface.c index d3751f702f..b8bde1b25d 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -3070,14 +3070,19 @@ static void ClearAbilityName(u8 spriteId1, u8 spriteId2) 7, 9, 1); } -static void PrintBattlerOnAbilityPopUp(u8 battlerId, u8 spriteId1, u8 spriteId2) +static void PrintBattlerOnAbilityPopUp(u8 battlerId, u8 spriteId1, u8 spriteId2, u8 prueba4) { + u8 prueba1; + u8 prueba2 = 2; + const u8 prueba3 = 3; + u8 prueba5; int i; u8 lastChar; u8* textPtr; u8 monName[POKEMON_NAME_LENGTH + 3] = {0}; u8* nick = gBattleMons[battlerId].nickname; // This needs to be updated for Illusion support + prueba5 = 5; for (i = 0; i < POKEMON_NAME_LENGTH; ++i) { monName[i] = nick[i]; @@ -3309,7 +3314,7 @@ void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle) StartSpriteAnim(&gSprites[spriteId1], 0); StartSpriteAnim(&gSprites[spriteId2], 0); - PrintBattlerOnAbilityPopUp(battlerId, spriteId1, spriteId2); + PrintBattlerOnAbilityPopUp(battlerId, spriteId1, spriteId2, 0); PrintAbilityOnAbilityPopUp(ability, spriteId1, spriteId2); RestoreOverwrittenPixels((void*)(OBJ_VRAM0) + (gSprites[spriteId1].oam.tileNum * 32)); } From a0bcdbff42c3597ae3b9901852015195bc6d1a50 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Mon, 29 Jan 2024 13:31:42 -0300 Subject: [PATCH 3/4] Workflow test worked, undoing changes --- src/battle_interface.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/battle_interface.c b/src/battle_interface.c index b8bde1b25d..d3751f702f 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -3070,19 +3070,14 @@ static void ClearAbilityName(u8 spriteId1, u8 spriteId2) 7, 9, 1); } -static void PrintBattlerOnAbilityPopUp(u8 battlerId, u8 spriteId1, u8 spriteId2, u8 prueba4) +static void PrintBattlerOnAbilityPopUp(u8 battlerId, u8 spriteId1, u8 spriteId2) { - u8 prueba1; - u8 prueba2 = 2; - const u8 prueba3 = 3; - u8 prueba5; int i; u8 lastChar; u8* textPtr; u8 monName[POKEMON_NAME_LENGTH + 3] = {0}; u8* nick = gBattleMons[battlerId].nickname; // This needs to be updated for Illusion support - prueba5 = 5; for (i = 0; i < POKEMON_NAME_LENGTH; ++i) { monName[i] = nick[i]; @@ -3314,7 +3309,7 @@ void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle) StartSpriteAnim(&gSprites[spriteId1], 0); StartSpriteAnim(&gSprites[spriteId2], 0); - PrintBattlerOnAbilityPopUp(battlerId, spriteId1, spriteId2, 0); + PrintBattlerOnAbilityPopUp(battlerId, spriteId1, spriteId2); PrintAbilityOnAbilityPopUp(ability, spriteId1, spriteId2); RestoreOverwrittenPixels((void*)(OBJ_VRAM0) + (gSprites[spriteId1].oam.tileNum * 32)); } From f7e5709745d6dc313b131330d1131eef7169e3f9 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Wed, 31 Jan 2024 08:18:43 -0300 Subject: [PATCH 4/4] Review changes --- Makefile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 88376cddef..5632b3570e 100644 --- a/Makefile +++ b/Makefile @@ -36,14 +36,14 @@ else EXE := endif -TITLE := POKEMON EMER -GAME_CODE := BPEE -MAKER_CODE := 01 -REVISION := 0 -MODERN ?= 1 -TEST ?= 0 -ANALYZE ?= 0 -UNUSED_ERROR?= 0 +TITLE := POKEMON EMER +GAME_CODE := BPEE +MAKER_CODE := 01 +REVISION := 0 +MODERN ?= 1 +TEST ?= 0 +ANALYZE ?= 0 +UNUSED_ERROR ?= 0 ifeq (agbcc,$(MAKECMDGOALS)) MODERN := 0 @@ -130,8 +130,8 @@ override CFLAGS += -fanalyzer endif # Only throw an error for unused elements if its RH-Hideout's repo ifeq ($(UNUSED_ERROR),0) -ifneq ($(GITHUB_REPOSITORY_OWNER),rh-hideout) -override CFLAGS += -Wno-error=unused-variable -Wno-error=unused-variable -Wno-error=unused-const-variable -Wno-error=unused-parameter -Wno-error=unused-function -Wno-error=unused-but-set-parameter -Wno-error=unused-but-set-variable -Wno-error=unused-value -Wno-error=unused-local-typedefs +ifneq ($(GITHUB_REPOSITORY_OWNER),rh-hideout) +override CFLAGS += -Wno-error=unused-variable -Wno-error=unused-const-variable -Wno-error=unused-parameter -Wno-error=unused-function -Wno-error=unused-but-set-parameter -Wno-error=unused-but-set-variable -Wno-error=unused-value -Wno-error=unused-local-typedefs endif endif ROM := $(MODERN_ROM_NAME)