All: MSVS2015 fixes (via zeromus)
Jeffrey Pfau jeffrey@endrift.com
Sat, 06 Jun 2015 21:08:13 -0700
6 files changed,
49 insertions(+),
12 deletions(-)
M
src/debugger/debugger.h
→
src/debugger/debugger.h
@@ -91,7 +91,7 @@
bool (*setSoftwareBreakpoint)(struct ARMDebugger*, uint32_t address, enum ExecutionMode mode, uint32_t* opcode); bool (*clearSoftwareBreakpoint)(struct ARMDebugger*, uint32_t address, enum ExecutionMode mode, uint32_t opcode); - __attribute__((format (printf, 3, 4))) + ATTRIBUTE_FORMAT(printf, 3, 4) void (*log)(struct ARMDebugger*, enum DebuggerLogLevel, const char* format, ...); };
M
src/gba/gba.h
→
src/gba/gba.h
@@ -216,10 +216,10 @@
void GBAFrameStarted(struct GBA* gba); void GBAFrameEnded(struct GBA* gba); -__attribute__((format (printf, 3, 4))) +ATTRIBUTE_FORMAT(printf,3,4) void GBALog(struct GBA* gba, enum GBALogLevel level, const char* format, ...); -__attribute__((format (printf, 3, 4))) +ATTRIBUTE_FORMAT(printf, 3, 4) void GBADebuggerLogShim(struct ARMDebugger* debugger, enum DebuggerLogLevel level, const char* format, ...); #endif
M
src/gba/hardware.h
→
src/gba/hardware.h
@@ -74,6 +74,9 @@ DECL_BITS(RTCCommandData, Magic, 0, 4);
DECL_BITS(RTCCommandData, Command, 4, 3); DECL_BIT(RTCCommandData, Reading, 7); +#ifdef _MSC_VER +#pragma pack(push,1) +#endif struct GBARTC { int bytesRemaining; int transferStep;@@ -83,7 +86,10 @@ int commandActive;
RTCCommandData command; RTCControl control; uint8_t time[7]; -} __attribute__((packed)); +} ATTRIBUTE_PACKED; +#ifdef _MSC_VER +#pragma pack(pop) +#endif struct GBARumble { void (*setRumble)(struct GBARumble*, int enable);
M
src/gba/supervisor/thread.c
→
src/gba/supervisor/thread.c
@@ -118,7 +118,7 @@ struct ARMCore cpu;
struct Patch patch; struct GBACheatDevice cheatDevice; struct GBAThread* threadContext = context; - struct ARMComponent* components[GBA_COMPONENT_MAX] = {}; + struct ARMComponent* components[GBA_COMPONENT_MAX] = {0}; struct GBARRContext* movie = 0; int numComponents = GBA_COMPONENT_MAX;
M
src/util/common.h
→
src/util/common.h
@@ -18,8 +18,24 @@ #include <stdint.h>
#include <stdio.h> #include <stdlib.h> #include <string.h> + +#ifdef _MSC_VER +#ifdef _WIN64 +typedef int64_t off_t; +typedef int64_t ssize_t; +#else +typedef int32_t off_t; +typedef int32_t ssize_t; +#endif +#define restrict __restrict +#define SSIZE_MAX ((ssize_t) SIZE_MAX) +#define strcasecmp _stricmp +#define strncasecmp _strnicmp +#define ftruncate _chsize +#else #include <strings.h> #include <unistd.h> +#endif #include "version.h"@@ -67,29 +83,44 @@ #define INS_BITS(SRC, START, END, BITS) (CLEAR_BITS(SRC, START, END) | (((BITS) << (START)) & MAKE_MASK(START, END)))
#define CLEAR_BITS(SRC, START, END) ((SRC) & ~MAKE_MASK(START, END)) #define FILL_BITS(SRC, START, END) ((SRC) | MAKE_MASK(START, END)) +#ifdef _MSC_VER +#define ATTRIBUTE_UNUSED +#define ATTRIBUTE_FORMAT(X, Y, Z) +#define ATTRIBUTE_PACKED +#else +#define ATTRIBUTE_UNUSED __attribute__((unused)) +#define ATTRIBUTE_FORMAT(X, Y, Z) __attribute__((format(X, Y, Z))) +#define ATTRIBUTE_PACKED __attribute__((packed)) +#endif + #define DECL_BITFIELD(NAME, TYPE) typedef TYPE NAME #define DECL_BITS(TYPE, FIELD, START, SIZE) \ - __attribute__((unused)) static inline TYPE TYPE ## Is ## FIELD (TYPE src) { \ + ATTRIBUTE_UNUSED static inline TYPE TYPE ## Is ## FIELD (TYPE src) { \ return CHECK_BITS(src, (START), (START) + (SIZE)); \ } \ - __attribute__((unused)) static inline TYPE TYPE ## Get ## FIELD (TYPE src) { \ + ATTRIBUTE_UNUSED static inline TYPE TYPE ## Get ## FIELD (TYPE src) { \ return EXT_BITS(src, (START), (START) + (SIZE)); \ } \ - __attribute__((unused)) static inline TYPE TYPE ## Clear ## FIELD (TYPE src) { \ + ATTRIBUTE_UNUSED static inline TYPE TYPE ## Clear ## FIELD (TYPE src) { \ return CLEAR_BITS(src, (START), (START) + (SIZE)); \ } \ - __attribute__((unused)) static inline TYPE TYPE ## Fill ## FIELD (TYPE src) { \ + ATTRIBUTE_UNUSED static inline TYPE TYPE ## Fill ## FIELD (TYPE src) { \ return FILL_BITS(src, (START), (START) + (SIZE)); \ } \ - __attribute__((unused)) static inline TYPE TYPE ## Set ## FIELD (TYPE src, TYPE bits) { \ + ATTRIBUTE_UNUSED static inline TYPE TYPE ## Set ## FIELD (TYPE src, TYPE bits) { \ return INS_BITS(src, (START), (START) + (SIZE), bits); \ } #define DECL_BIT(TYPE, FIELD, BIT) DECL_BITS(TYPE, FIELD, BIT, 1) +#ifdef _MSC_VER #define LIKELY(X) __builtin_expect(!!(X), 1) #define UNLIKELY(X) __builtin_expect(!!(X), 0) +#else +#define LIKELY(X) (!!(X)) +#define UNLIKELY(X) (!!(X)) +#endif #define ROR(I, ROTATE) ((((uint32_t) (I)) >> ROTATE) | ((uint32_t) (I) << ((-ROTATE) & 31)))
M
src/util/vfs/vfs-mem.c
→
src/util/vfs/vfs-mem.c
@@ -93,7 +93,7 @@ if (size + vfm->offset >= vfm->size) {
size = vfm->size - vfm->offset; } - memcpy(buffer, vfm->mem + vfm->offset, size); + memcpy(buffer, (void*) ((uintptr_t) vfm->mem + vfm->offset), size); vfm->offset += size; return size; }@@ -105,7 +105,7 @@ if (size + vfm->offset >= vfm->size) {
size = vfm->size - vfm->offset; } - memcpy(vfm->mem + vfm->offset, buffer, size); + memcpy((void*) ((uintptr_t) vfm->mem + vfm->offset), buffer, size); vfm->offset += size; return size; }