From 4caa048bd04359a8cfc8d346878b7864530d685d Mon Sep 17 00:00:00 2001 From: Tharo <17233964+Thar0@users.noreply.github.com> Date: Thu, 4 Jul 2024 19:48:16 +0100 Subject: [PATCH 1/2] Promote the warnings implicit-function-declaration, incompatible-pointer-types, int-conversion to errors (#144) --- Makefile | 1 + include/compression.h | 1 + src/code/sys_math3d_draw.c | 1 + 3 files changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 015fae11a..0deebbff8 100644 --- a/Makefile +++ b/Makefile @@ -210,6 +210,7 @@ INC := -Iinclude -Iinclude/libc -Isrc -I$(BUILD_DIR) -I. -I$(EXTRACTED_DIR) # Check code syntax with host compiler CHECK_WARNINGS := -Wall -Wextra -Wno-format-security -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-variable -Wno-missing-braces +CHECK_WARNINGS += -Werror=implicit-function-declaration -Werror=incompatible-pointer-types -Werror=int-conversion # The `cpp` command behaves differently on macOS (it behaves as if # `-traditional-cpp` was passed) so we use `gcc -E` instead. diff --git a/include/compression.h b/include/compression.h index 3a068285b..a530646da 100644 --- a/include/compression.h +++ b/include/compression.h @@ -2,6 +2,7 @@ #define COMPRESSION_H #include "ultra64.h" +#include "z64dma.h" void* Yaz0_FirstDMA(void); void* Yaz0_NextDMA(u8* curSrcPos); diff --git a/src/code/sys_math3d_draw.c b/src/code/sys_math3d_draw.c index 8b1d42b83..4c31d6500 100644 --- a/src/code/sys_math3d_draw.c +++ b/src/code/sys_math3d_draw.c @@ -1,4 +1,5 @@ #include "z64.h" +#include "functions.h" #if IS_DEBUG void Math3D_VtxF2L(Vtx* r, Vec3f* v) { From 441252137d066d9d65749af3c48c9800bb1a1850 Mon Sep 17 00:00:00 2001 From: Tharo <17233964+Thar0@users.noreply.github.com> Date: Thu, 18 Jul 2024 01:10:34 +0100 Subject: [PATCH 2/2] Fix f3dex2 crash caused by using gDPNoOp disp macros when GBI_DEBUG was not defined (#145) --- Makefile | 1 + src/code/graph.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 0deebbff8..faf363850 100644 --- a/Makefile +++ b/Makefile @@ -95,6 +95,7 @@ else ifeq ($(VERSION),gc-eu-mq-dbg) CPP_DEFINES += -DOOT_MQ HACKEROOT := 0 else ifeq ($(VERSION),hackeroot-mq) + DEBUG := 1 CPP_DEFINES += -DOOT_MQ HACKEROOT := 1 else diff --git a/src/code/graph.c b/src/code/graph.c index 483bc3ffd..42c150a75 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -498,6 +498,7 @@ void* Graph_Alloc2(GraphicsContext* gfxCtx, size_t size) { #if IS_DEBUG void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, int line) { +#if GBI_DEBUG dispRefs[0] = gfxCtx->polyOpa.p; dispRefs[1] = gfxCtx->polyXlu.p; dispRefs[2] = gfxCtx->overlay.p; @@ -505,9 +506,11 @@ void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, gDPNoOpOpenDisp(gfxCtx->polyOpa.p++, file, line); gDPNoOpOpenDisp(gfxCtx->polyXlu.p++, file, line); gDPNoOpOpenDisp(gfxCtx->overlay.p++, file, line); +#endif } void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, int line) { +#if GBI_DEBUG if (dispRefs[0] + 1 == gfxCtx->polyOpa.p) { gfxCtx->polyOpa.p = dispRefs[0]; } else { @@ -525,5 +528,6 @@ void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, } else { gDPNoOpCloseDisp(gfxCtx->overlay.p++, file, line); } +#endif } #endif