diff --git a/src/arm/decoder.c b/src/arm/decoder.c index 8fef6b18f..e75023ba1 100644 --- a/src/arm/decoder.c +++ b/src/arm/decoder.c @@ -190,6 +190,9 @@ static int _decodeMemory(struct ARMMemoryAccess memory, struct ARMCore* cpu, con case 4: value = cpu->memory.load32(cpu, addrBase, NULL); break; + default: + // Should never be reached + abort(); } const char* label = NULL; if (symbols) { diff --git a/src/core/core.c b/src/core/core.c index 0879f9254..931b7feda 100644 --- a/src/core/core.c +++ b/src/core/core.c @@ -357,6 +357,8 @@ bool mCoreTakeScreenshotVF(struct mCore* core, struct VFile* vf) { PNGWriteClose(png, info); return success; #else + UNUSED(core); + UNUSED(vf); return false; #endif } diff --git a/src/debugger/parser.c b/src/debugger/parser.c index 72eae1ed3..4af61a14e 100644 --- a/src/debugger/parser.c +++ b/src/debugger/parser.c @@ -782,7 +782,8 @@ bool mDebuggerEvaluateParseTree(struct mDebugger* debugger, struct ParseTree* tr struct IntList stack; int nextBranch; bool ok = true; - int32_t tmpVal, tmpSegment; + int32_t tmpVal = 0; + int32_t tmpSegment = -1; IntListInit(&stack, 0); while (ok) { diff --git a/src/gba/gba.c b/src/gba/gba.c index de79671c5..cee833c5b 100644 --- a/src/gba/gba.c +++ b/src/gba/gba.c @@ -583,6 +583,10 @@ void GBADebug(struct GBA* gba, uint16_t flags) { } bool GBAIsROM(struct VFile* vf) { + if (!vf) { + return false; + } + #ifdef USE_ELF struct ELF* elf = ELFOpen(vf); if (elf) { @@ -594,9 +598,6 @@ bool GBAIsROM(struct VFile* vf) { return isGBA; } #endif - if (!vf) { - return false; - } uint8_t signature[sizeof(GBA_ROM_MAGIC) + sizeof(GBA_ROM_MAGIC2)]; if (vf->seek(vf, GBA_ROM_MAGIC_OFFSET, SEEK_SET) < 0) { diff --git a/src/script/context.c b/src/script/context.c index ad4e445fc..84847983c 100644 --- a/src/script/context.c +++ b/src/script/context.c @@ -295,7 +295,7 @@ void mScriptContextExportNamespace(struct mScriptContext* context, const char* n } void mScriptContextSetDocstring(struct mScriptContext* context, const char* key, const char* docstring) { - HashTableInsert(&context->docstrings, key, docstring); + HashTableInsert(&context->docstrings, key, (char*) docstring); } const char* mScriptContextGetDocstring(struct mScriptContext* context, const char* key) { diff --git a/src/sm83/decoder.c b/src/sm83/decoder.c index 1240d5841..819576c26 100644 --- a/src/sm83/decoder.c +++ b/src/sm83/decoder.c @@ -413,6 +413,9 @@ size_t SM83Decode(uint8_t opcode, struct SM83InstructionInfo* info) { info->op1.immediate |= opcode << ((info->opcodeSize - 2) * 8); } return 0; + default: + // Should never be reached + abort(); } ++info->opcodeSize; return decoder(opcode, info);