Skip to content

Commit

Permalink
Compile with all warnings, warnings as errors
Browse files Browse the repository at this point in the history
  • Loading branch information
visrealm committed Sep 4, 2023
1 parent 5da7ac8 commit 612b821
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ if (NOT BUILD_SHARED_LIBS)
add_definitions(-DVR_EMU_TMS9918_STATIC)
endif()

if (PROJECT_IS_TOP_LEVEL)
if(MSVC)
add_compile_options(/W4 /WX)
add_compile_options(/arch:AVX2 /Ox)
else()
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
add_compile_options(-march=native)
endif()
endif()

include(CTest)

add_subdirectory(src)
8 changes: 5 additions & 3 deletions src/vrEmuTms9918.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,10 @@ static void __time_critical_func(vrEmuTms9918OutputSprites)(VrEmuTms9918* tms991

if (spritesShown == 0)
{
int *rsbInt = (int*)tms9918->rowSpriteBits;
for (int i = 0; i < sizeof(tms9918->rowSpriteBits) / sizeof(int); ++i)
int* rsbInt = (int*)tms9918->rowSpriteBits;
int* end = rsbInt + sizeof(tms9918->rowSpriteBits) / sizeof(int);

while (rsbInt < end)
{
*rsbInt++ = 0;
}
Expand Down Expand Up @@ -571,7 +573,7 @@ static void __time_critical_func(vrEmuTms9918GraphicsIIScanLine)(VrEmuTms9918* t
const uint8_t nameMask = ((tms9918->registers[TMS_REG_COLOR_TABLE] & 0x7f) << 3) | 0x07;

const uint16_t pageThird = ((tileY & 0x18) >> 3)
& (tms9918->registers[TMS_REG_PATTERN_TABLE] & 0x03); /* which page? 0-2 */
& (tms9918->registers[TMS_REG_PATTERN_TABLE] & 0x03); /* which page? 0-2 */
const uint16_t pageOffset = pageThird << 11; /* offset (0, 0x800 or 0x1000) */

const uint8_t* patternTable = tms9918->vram + tmsPatternTableAddr(tms9918) + pageOffset;
Expand Down
2 changes: 1 addition & 1 deletion src/vrEmuTms9918Util.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,4 @@ void vrEmuTms9918InitialiseGfxII(VrEmuTms9918* tms9918)
vrEmuTms9918WriteData(tms9918, i & 0xff);
}

}
}

0 comments on commit 612b821

Please sign in to comment.