Skip to content

Commit ffd757f

Browse files
committed
Fixed warnings of unhandled switch cases
This was unnoticed after moving code to `printcode`. This ensures safety if `printcode` called outside of `main`.
1 parent 6ece227 commit ffd757f

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ Code Name\ncode`), and raw (`code`).
1818
Simply run `./compile.sh` at root directory of project. This script uses GCC to compile the sources. It also computes
1919
the md5, sha1, and sha256 hash of the compiled result afterwards using `md5sum`, `sha1sum`, and `sha256sum`. You can
2020
pass `asan` as the first argument to the script to build a debug build with AddressSanitizer (this isn't supported on a
21-
Windows build). For building for Windows, run `./compile.sh` with MSYS2 MinGW x64 or run `.\compile.bat`.
21+
Windows build) with all warnings to be printed. For building for Windows, run `./compile.sh` with MSYS2 MinGW x64 or
22+
run `.\compile.bat`.
2223

2324
## Credits
2425
- Shio, SirMangler, and many others for their work on PrimeHack, a modification of Dolphin Emulator to allow for FPS

compile.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ] || [ "$(expr substr $(u
55
OUTEXT=".exe"
66
elif [ $# -gt 0 ]; then
77
if [ "$1" == "asan" ]; then
8-
ASAN="-fsanitize=address -g"
8+
ASAN="-fsanitize=address -g -Wall"
99
fi
1010
fi
1111
if [ ! -d "./dst" ]; then mkdir ./dst ; fi

src/makecode.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,9 @@ int printcode(Code code, Game game, GameRegion region, CodeFormat format, uint8_
359359
val_version_mp1 = 0x0002;
360360

361361
break;
362+
default:
363+
fprintf(stderr, "Invalid game specified.");
364+
return MCS_INVLDARG;
362365
}
363366
} else if (region == GMR_PAL) {
364367
val_id1 = 0x474D; // GM
@@ -387,6 +390,9 @@ int printcode(Code code, Game game, GameRegion region, CodeFormat format, uint8_
387390
}
388391

389392
break;
393+
default:
394+
fprintf(stderr, "Invalid game specified.");
395+
return MCS_INVLDARG;
390396
}
391397

392398
uint32_t addr_exception_hook = 0x80000048,
@@ -891,6 +897,9 @@ blr
891897
runppcasm(10, hm_ppcasm);
892898

893899
break;
900+
default:
901+
fprintf(stderr, "Invalid code specified.");
902+
return MCS_INVLDARG;
894903
}
895904

896905
endifv(0, (addr_memstart >> 16), (addr_memstart >> 16));

0 commit comments

Comments
 (0)