Skip to content

Commit

Permalink
Fixed warnings of unhandled switch cases
Browse files Browse the repository at this point in the history
This was unnoticed after moving code to `printcode`. This ensures safety if `printcode` called outside of `main`.
  • Loading branch information
xchellx committed Aug 29, 2022
1 parent 6ece227 commit ffd757f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Code Name\ncode`), and raw (`code`).
Simply run `./compile.sh` at root directory of project. This script uses GCC to compile the sources. It also computes
the md5, sha1, and sha256 hash of the compiled result afterwards using `md5sum`, `sha1sum`, and `sha256sum`. You can
pass `asan` as the first argument to the script to build a debug build with AddressSanitizer (this isn't supported on a
Windows build). For building for Windows, run `./compile.sh` with MSYS2 MinGW x64 or run `.\compile.bat`.
Windows build) with all warnings to be printed. For building for Windows, run `./compile.sh` with MSYS2 MinGW x64 or
run `.\compile.bat`.

## Credits
- Shio, SirMangler, and many others for their work on PrimeHack, a modification of Dolphin Emulator to allow for FPS
Expand Down
2 changes: 1 addition & 1 deletion compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ] || [ "$(expr substr $(u
OUTEXT=".exe"
elif [ $# -gt 0 ]; then
if [ "$1" == "asan" ]; then
ASAN="-fsanitize=address -g"
ASAN="-fsanitize=address -g -Wall"
fi
fi
if [ ! -d "./dst" ]; then mkdir ./dst ; fi
Expand Down
9 changes: 9 additions & 0 deletions src/makecode.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,9 @@ int printcode(Code code, Game game, GameRegion region, CodeFormat format, uint8_
val_version_mp1 = 0x0002;

break;
default:
fprintf(stderr, "Invalid game specified.");
return MCS_INVLDARG;
}
} else if (region == GMR_PAL) {
val_id1 = 0x474D; // GM
Expand Down Expand Up @@ -387,6 +390,9 @@ int printcode(Code code, Game game, GameRegion region, CodeFormat format, uint8_
}

break;
default:
fprintf(stderr, "Invalid game specified.");
return MCS_INVLDARG;
}

uint32_t addr_exception_hook = 0x80000048,
Expand Down Expand Up @@ -891,6 +897,9 @@ blr
runppcasm(10, hm_ppcasm);

break;
default:
fprintf(stderr, "Invalid code specified.");
return MCS_INVLDARG;
}

endifv(0, (addr_memstart >> 16), (addr_memstart >> 16));
Expand Down

0 comments on commit ffd757f

Please sign in to comment.