diff --git a/CMakeLists.txt b/CMakeLists.txt index f49ffadf..6c53d776 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -305,11 +305,22 @@ if(COMPILER_MSVC) list(APPEND RELIB_FLAGS -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DWIN32_LEAN_AND_MEAN -DNOMINMAX /GR- /W3 /WX /wd4100 /wd4127 /wd4505 /wd4512 /wd4800 /wd4351) elseif(COMPILER_GCC OR COMPILER_CLANG) - list(APPEND RELIB_FLAGS -fms-extensions -Wall -Wextra -Werror -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -Wno-strict-aliasing -D_GNU_SOURCE) + list(APPEND RELIB_FLAGS + # used for unnamed structure fields + -fms-extensions + # enable most errors + -Wall -Wextra -Werror + # lax some of these common development warnings + -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -Wno-strict-aliasing + -D_GNU_SOURCE) if(COMPILER_GCC) list(APPEND RELIB_DEFS COMPILER_GCC=1) + # -format-truncation is too aggressive with snprintfs that are purposefully supposed + # to truncate on overflow + list(APPEND RELIB_FLAGS -Wno-format-truncation) + # some flavors of gcc require this to be defined for the PR* macros in inttypes.h list(APPEND RELIB_FLAGS -D__STDC_FORMAT_MACROS) elseif(COMPILER_CLANG) diff --git a/src/guest/arm7/arm7.c b/src/guest/arm7/arm7.c index 5f2d742b..515f7bab 100644 --- a/src/guest/arm7/arm7.c +++ b/src/guest/arm7/arm7.c @@ -181,9 +181,6 @@ void arm7_suspend(struct arm7 *arm) { static void arm7_run(struct device *dev, int64_t ns) { struct arm7 *arm = (struct arm7 *)dev; - struct armv3_context *ctx = &arm->ctx; - struct jit *jit = arm->jit; - static int64_t ARM7_CLOCK_FREQ = INT64_C(20000000); int cycles = (int)NANO_TO_CYCLES(ns, ARM7_CLOCK_FREQ); @@ -232,7 +229,6 @@ static struct jit_guest *arm7_guest_create(struct arm7 *arm) { static int arm7_init(struct device *dev) { struct arm7 *arm = (struct arm7 *)dev; - struct dreamcast *dc = arm->dc; /* initialize jit */ arm->guest = arm7_guest_create(arm); diff --git a/src/guest/bios/bios.c b/src/guest/bios/bios.c index a3c13c10..17f42f0e 100644 --- a/src/guest/bios/bios.c +++ b/src/guest/bios/bios.c @@ -67,7 +67,6 @@ static uint32_t bios_local_time() { static void bios_override_settings(struct bios *bios) { struct dreamcast *dc = bios->dc; struct flash *flash = dc->flash; - struct gdrom *gd = dc->gdrom; int region = 0; int lang = 0; diff --git a/src/guest/bios/syscalls.c b/src/guest/bios/syscalls.c index 00ef1690..02db5705 100644 --- a/src/guest/bios/syscalls.c +++ b/src/guest/bios/syscalls.c @@ -92,9 +92,6 @@ enum { static uint32_t bios_gdrom_send_cmd(struct bios *bios, uint32_t cmd_code, uint32_t params) { struct dreamcast *dc = bios->dc; - struct gdrom *gd = dc->gdrom; - struct holly *hl = dc->holly; - struct sh4 *sh4 = dc->sh4; if (bios->status != GDC_STATUS_NONE) { return 0; @@ -123,8 +120,6 @@ static uint32_t bios_gdrom_send_cmd(struct bios *bios, uint32_t cmd_code, static void bios_gdrom_mainloop(struct bios *bios) { struct dreamcast *dc = bios->dc; struct gdrom *gd = dc->gdrom; - struct holly *hl = dc->holly; - struct sh4_context *ctx = &dc->sh4->ctx; if (bios->status != GDC_STATUS_ACTIVE) { return; diff --git a/src/guest/gdrom/gdrom.c b/src/guest/gdrom/gdrom.c index e6326445..98808e5b 100644 --- a/src/guest/gdrom/gdrom.c +++ b/src/guest/gdrom/gdrom.c @@ -429,7 +429,7 @@ static void gdrom_spi_cmd(struct gdrom *gd, int arg) { out[4] = (ses.fad & 0x0000ff00) >> 8; out[5] = (ses.fad & 0x000000ff); - gdrom_spi_write(gd, out, sizeof(out)); + gdrom_spi_write(gd, out, size); } break; case GD_SPI_GET_SCD: { diff --git a/src/guest/maple/maple.c b/src/guest/maple/maple.c index 522c74bf..8d2109d6 100644 --- a/src/guest/maple/maple.c +++ b/src/guest/maple/maple.c @@ -24,8 +24,6 @@ static void maple_unregister_dev(struct maple *mp, int port, int unit) { static void maple_register_dev(struct maple *mp, const char *device_type, int port, int unit) { - struct dreamcast *dc = mp->dc; - CHECK(!mp->devs[port][unit], "maple_register_dev already registered for port=%d unit=%d", port, unit); diff --git a/src/guest/pvr/ta.c b/src/guest/pvr/ta.c index a2a56cce..9744284f 100644 --- a/src/guest/pvr/ta.c +++ b/src/guest/pvr/ta.c @@ -751,7 +751,6 @@ void ta_texture_write(struct ta *ta, uint32_t dst, const uint8_t *src, void ta_yuv_write(struct ta *ta, uint32_t dst, const uint8_t *src, int size) { struct holly *hl = ta->dc->holly; - struct pvr *pvr = ta->dc->pvr; CHECK(*hl->SB_LMMODE0 == 0); CHECK(size % ta->yuv_macroblock_size == 0); diff --git a/src/guest/sh4/sh4.c b/src/guest/sh4/sh4.c index 53ff8921..17625dc9 100644 --- a/src/guest/sh4/sh4.c +++ b/src/guest/sh4/sh4.c @@ -50,6 +50,8 @@ static void sh4_sr_updated(struct sh4 *sh4, uint32_t old_sr) { static void sh4_fpscr_updated(struct sh4 *sh4, uint32_t old_fpscr) { struct sh4_context *ctx = &sh4->ctx; + CHECK(!(ctx->fpscr & ENABLE_MASK), "FPU exceptions aren't supported"); + if ((ctx->fpscr & FR_MASK) != (old_fpscr & FR_MASK)) { sh4_swap_fpr_bank(ctx); }