all repos — mgba @ 55977796f35735f606f301b20f4b09ec621cc0c1

mGBA Game Boy Advance Emulator

Move UNUSED macro to common.h
Jeffrey Pfau jeffrey@endrift.com
Thu, 10 Jul 2014 01:00:38 -0700
commit

55977796f35735f606f301b20f4b09ec621cc0c1

parent

0a48d4cc2f58423fa9fe91eaccca08cf080ca0cb

M src/arm/common.hsrc/arm/common.h

@@ -11,6 +11,8 @@ #include <stdlib.h>

#include <string.h> #include <unistd.h> +#define UNUSED(V) (void)(V) + #ifdef __POWERPC__ #define LOAD_32(DEST, ADDR, ARR) asm("lwbrx %0, %1, %2" : "=r"(DEST) : "r"(ADDR), "r"(ARR)) #define LOAD_16(DEST, ADDR, ARR) asm("lhbrx %0, %1, %2" : "=r"(DEST) : "r"(ADDR), "r"(ARR))
M src/arm/isa-inlines.hsrc/arm/isa-inlines.h

@@ -5,8 +5,6 @@ #include "common.h"

#include "arm.h" -#define UNUSED(V) (void)(V) - #define DO_4(DIRECTIVE) \ DIRECTIVE, \ DIRECTIVE, \
M src/debugger/cli-debugger.csrc/debugger/cli-debugger.c

@@ -83,13 +83,13 @@ psr.t ? 'T' : '-');

} static void _handleDeath(int sig) { - (void)(sig); + UNUSED(sig); printf("No debugger attached!\n"); } static void _breakInto(struct CLIDebugger* debugger, struct DebugVector* dv) { - (void)(debugger); - (void)(dv); + UNUSED(debugger); + UNUSED(dv); struct sigaction sa, osa; sa.sa_handler = _handleDeath; sigemptyset(&sa.sa_mask);

@@ -105,18 +105,18 @@ sigaction(SIGTRAP, &osa, 0);

} static void _continue(struct CLIDebugger* debugger, struct DebugVector* dv) { - (void)(dv); + UNUSED(dv); debugger->d.state = DEBUGGER_RUNNING; } static void _next(struct CLIDebugger* debugger, struct DebugVector* dv) { - (void)(dv); + UNUSED(dv); ARMRun(debugger->d.cpu); _printStatus(debugger, 0); } static void _print(struct CLIDebugger* debugger, struct DebugVector* dv) { - (void)(debugger); + UNUSED(debugger); for ( ; dv; dv = dv->next) { printf(" %u", dv->intValue); }

@@ -124,7 +124,7 @@ printf("\n");

} static void _printHex(struct CLIDebugger* debugger, struct DebugVector* dv) { - (void)(debugger); + UNUSED(debugger); for ( ; dv; dv = dv->next) { printf(" 0x%08X", dv->intValue); }

@@ -143,7 +143,7 @@ }

} static void _printStatus(struct CLIDebugger* debugger, struct DebugVector* dv) { - (void)(dv); + UNUSED(dv); int r; for (r = 0; r < 4; ++r) { printf("%08X %08X %08X %08X\n",

@@ -164,7 +164,7 @@ _printLine(debugger, debugger->d.cpu->gprs[ARM_PC] - instructionLength, mode);

} static void _quit(struct CLIDebugger* debugger, struct DebugVector* dv) { - (void)(dv); + UNUSED(dv); debugger->d.state = DEBUGGER_SHUTDOWN; }

@@ -226,7 +226,7 @@ ARMDebuggerSetWatchpoint(&debugger->d, address);

} static void _breakIntoDefault(int signal) { - (void)(signal); + UNUSED(signal); ARMDebuggerEnter(&_activeDebugger->d, DEBUGGER_ENTER_MANUAL); }

@@ -507,7 +507,7 @@ return 0;

} static char* _prompt(EditLine* el) { - (void)(el); + UNUSED(el); return "> "; }

@@ -536,7 +536,7 @@ }

} static void _reportEntry(struct ARMDebugger* debugger, enum DebuggerEntryReason reason) { - (void) (debugger); + UNUSED(debugger); switch (reason) { case DEBUGGER_ENTER_MANUAL: case DEBUGGER_ENTER_ATTACHED:

@@ -554,7 +554,7 @@ }

} static unsigned char _tabComplete(EditLine* elstate, int ch) { - (void)(ch); + UNUSED(ch); const LineInfo* li = el_line(elstate); const char* commandPtr; int cmd = 0, len = 0;
M src/debugger/gdb-stub.csrc/debugger/gdb-stub.c

@@ -172,7 +172,7 @@ return;

} } // TODO: parse message - (void) (message); + UNUSED(message); } static void _step(struct GDBStub* stub, const char* message) {

@@ -180,7 +180,7 @@ ARMRun(stub->d.cpu);

snprintf(stub->outgoing, GDB_STUB_MAX_LINE - 4, "S%02x", SIGINT); _sendMessage(stub); // TODO: parse message - (void) (message); + UNUSED(message); } static void _readMemory(struct GDBStub* stub, const char* message) {

@@ -204,7 +204,7 @@ _sendMessage(stub);

} static void _readGPRs(struct GDBStub* stub, const char* message) { - (void) (message); + UNUSED(message); int r; int i = 0; for (r = 0; r < 16; ++r) {

@@ -264,7 +264,7 @@ _sendMessage(stub);

} static void _processVWriteCommand(struct GDBStub* stub, const char* message) { - (void) (message); + UNUSED(message); stub->outgoing[0] = '\0'; _sendMessage(stub); }

@@ -287,7 +287,7 @@ unsigned i = 0;

uint32_t address = _readHex(readAddress, &i); readAddress += i + 1; uint32_t kind = _readHex(readAddress, &i); // We don't use this in hardware watchpoints - (void) (kind); + UNUSED(kind); ARMDebuggerSetBreakpoint(&stub->d, address); strncpy(stub->outgoing, "OK", GDB_STUB_MAX_LINE - 4); _sendMessage(stub);
M src/gba/gba-bios.csrc/gba/gba-bios.c

@@ -13,7 +13,7 @@ static void _unRl(struct GBA* gba, uint32_t source, uint8_t* dest);

static void _RegisterRamReset(struct GBA* gba) { uint32_t registers = gba->cpu->gprs[0]; - (void)(registers); + UNUSED(registers); GBALog(gba, GBA_LOG_STUB, "RegisterRamReset unimplemented"); }

@@ -27,7 +27,7 @@ float theta;

int offset = cpu->gprs[0]; int destination = cpu->gprs[1]; int diff = cpu->gprs[3]; - (void)(diff); // Are we supposed to use this? + UNUSED(diff); // Are we supposed to use this? float a, b, c, d; float rx, ry; while (i--) {
M src/gba/gba-thread.csrc/gba/gba-thread.c

@@ -22,9 +22,9 @@ static DWORD _contextKey;

static INIT_ONCE _contextOnce = INIT_ONCE_STATIC_INIT; static BOOL CALLBACK _createTLS(PINIT_ONCE once, PVOID param, PVOID* context) { - (void) (once); - (void) (param); - (void) (context); + UNUSED(once); + UNUSED(param); + UNUSED(context); _contextKey = TlsAlloc(); return TRUE; }
M src/gba/gba-video.csrc/gba/gba-video.c

@@ -155,29 +155,29 @@ }

} static void GBAVideoDummyRendererInit(struct GBAVideoRenderer* renderer) { - (void)(renderer); + UNUSED(renderer); // Nothing to do } static void GBAVideoDummyRendererDeinit(struct GBAVideoRenderer* renderer) { - (void)(renderer); + UNUSED(renderer); // Nothing to do } static uint16_t GBAVideoDummyRendererWriteVideoRegister(struct GBAVideoRenderer* renderer, uint32_t address, uint16_t value) { - (void)(renderer); - (void)(address); + UNUSED(renderer); + UNUSED(address); return value; } static void GBAVideoDummyRendererDrawScanline(struct GBAVideoRenderer* renderer, int y) { - (void)(renderer); - (void)(y); + UNUSED(renderer); + UNUSED(y); // Nothing to do } static void GBAVideoDummyRendererFinishFrame(struct GBAVideoRenderer* renderer) { - (void)(renderer); + UNUSED(renderer); // Nothing to do }
M src/gba/renderers/video-software.csrc/gba/renderers/video-software.c

@@ -3,8 +3,6 @@

#include "gba.h" #include "gba-io.h" -#define UNUSED(X) (void) (X) - static const int _objSizes[32] = { 8, 8, 16, 16,
M src/platform/commandline.csrc/platform/commandline.c

@@ -122,7 +122,7 @@ opts->height = 160;

} int _parseGraphicsArg(struct SubParser* parser, int option, const char* arg) { - (void) (arg); + UNUSED(arg); struct GraphicsOpts* graphicsOpts = parser->opts; switch (option) { case 'f':
M src/platform/perf-main.csrc/platform/perf-main.c

@@ -110,7 +110,7 @@ printf("\033[2K\r");

} static void _GBAPerfShutdown(int signal) { - (void) (signal); + UNUSED(signal); pthread_mutex_lock(&_thread->stateMutex); _thread->state = THREAD_EXITING; pthread_mutex_unlock(&_thread->stateMutex);
M src/platform/sdl/sdl-audio.csrc/platform/sdl/sdl-audio.c

@@ -31,7 +31,7 @@ return 1;

} void GBASDLDeinitAudio(struct GBASDLAudio* context) { - (void)(context); + UNUSED(context); SDL_PauseAudio(1); SDL_CloseAudio(); SDL_QuitSubSystem(SDL_INIT_AUDIO);
M src/platform/sdl/sdl-events.csrc/platform/sdl/sdl-events.c

@@ -208,7 +208,7 @@ }

#if SDL_VERSION_ATLEAST(2, 0, 0) static void _GBASDLHandleWindowEvent(struct GBAThread* context, struct GBASDLEvents* sdlContext, const struct SDL_WindowEvent* event) { - (void) (context); + UNUSED(context); switch (event->event) { case SDL_WINDOWEVENT_SIZE_CHANGED: sdlContext->windowUpdated = 1;
M src/util/patch-ips.csrc/util/patch-ips.c

@@ -2,9 +2,6 @@ #include "util/patch-ips.h"

#include "util/patch.h" -#include <stdint.h> -#include <unistd.h> - static size_t _IPSOutputSize(struct Patch* patch, size_t inSize); static int _IPSApplyPatch(struct Patch* patch, void* out, size_t outSize);

@@ -35,7 +32,7 @@ return 1;

} size_t _IPSOutputSize(struct Patch* patch, size_t inSize) { - (void) (patch); + UNUSED(patch); return inSize; }
M src/util/patch-ups.csrc/util/patch-ups.c

@@ -3,9 +3,6 @@

#include "util/crc32.h" #include "util/patch.h" -#include <stdint.h> -#include <unistd.h> - enum { IN_CHECKSUM = -12, OUT_CHECKSUM = -8,

@@ -65,7 +62,7 @@ return 1;

} size_t _UPSOutputSize(struct Patch* patch, size_t inSize) { - (void) (inSize); + UNUSED(inSize); lseek(patch->patchfd, 4, SEEK_SET); if (_UPSDecodeLength(patch->patchfd) != inSize) { return 0;
M src/util/patch.hsrc/util/patch.h

@@ -1,7 +1,7 @@

#ifndef PATCH_H #define PATCH_H -#include <string.h> +#include "common.h" struct Patch { int patchfd;
M src/util/threading.hsrc/util/threading.h

@@ -90,7 +90,7 @@ }

static inline int ConditionDeinit(Condition* cond) { // This is a no-op on Windows - (void)(cond); + UNUSED(cond); return 0; }