From d27f2908002a38d9b06a4298fa4beb15e62c9240 Mon Sep 17 00:00:00 2001 From: Themaister Date: Mon, 7 Feb 2011 13:10:31 +0100 Subject: [PATCH] Fix compile for Clang++. --- nall/string/base.hpp | 32 +++++++++++++-------------- nall/string/utility.hpp | 12 +++++----- snes/chip/bsx/cartridge/cartridge.cpp | 2 ++ snes/chip/sa1/memory/memory.cpp | 4 ++++ snes/chip/superfx/memory/memory.cpp | 2 ++ snes/input/input.cpp | 5 +++++ 6 files changed, 35 insertions(+), 22 deletions(-) diff --git a/nall/string/base.hpp b/nall/string/base.hpp index 794e807..3fbad0e 100644 --- a/nall/string/base.hpp +++ b/nall/string/base.hpp @@ -167,23 +167,23 @@ namespace nall { static inline string substr(const char *src, unsigned start = 0, unsigned length = 0); static inline string& strtr(string &dest, const char *before, const char *after); - inline string integer(intmax_t value); - template inline string linteger(intmax_t value); - template inline string rinteger(intmax_t value); - inline string decimal(uintmax_t value); - template inline string ldecimal(uintmax_t value); - template inline string rdecimal(uintmax_t value); - template inline string hex(uintmax_t value); - template inline string binary(uintmax_t value); - inline unsigned fp(char *str, double value); - inline string fp(double value); + static inline string integer(intmax_t value); + template static inline string linteger(intmax_t value); + template static inline string rinteger(intmax_t value); + static inline string decimal(uintmax_t value); + template static inline string ldecimal(uintmax_t value); + template static inline string rdecimal(uintmax_t value); + template static inline string hex(uintmax_t value); + template static inline string binary(uintmax_t value); + static inline unsigned fp(char *str, double value); + static inline string fp(double value); - inline string linteger(intmax_t value) { return linteger<0>(value); } - inline string rinteger(intmax_t value) { return rinteger<0>(value); } - inline string ldecimal(uintmax_t value) { return ldecimal<0>(value); } - inline string rdecimal(uintmax_t value) { return rdecimal<0>(value); } - inline string hex(uintmax_t value) { return hex<0>(value); } - inline string binary(uintmax_t value) { return binary<0>(value); } + static inline string linteger(intmax_t value) { return linteger<0>(value); } + static inline string rinteger(intmax_t value) { return rinteger<0>(value); } + static inline string ldecimal(uintmax_t value) { return ldecimal<0>(value); } + static inline string rdecimal(uintmax_t value) { return rdecimal<0>(value); } + static inline string hex(uintmax_t value) { return hex<0>(value); } + static inline string binary(uintmax_t value) { return binary<0>(value); } //variadic.hpp template diff --git a/nall/string/utility.hpp b/nall/string/utility.hpp index ade0472..56e1e53 100644 --- a/nall/string/utility.hpp +++ b/nall/string/utility.hpp @@ -50,7 +50,7 @@ string integer(intmax_t value) { result[x] = buffer[y]; } - return result; + return &result[0]; } template string linteger(intmax_t value) { @@ -124,7 +124,7 @@ string decimal(uintmax_t value) { result[x] = buffer[y]; } - return result; + return &result[0]; } template string ldecimal(uintmax_t value) { @@ -146,7 +146,7 @@ template string ldecimal(uintmax_t value) { result[x] = buffer[y]; } - return result; + return &result[0]; } template string rdecimal(uintmax_t value) { @@ -168,7 +168,7 @@ template string rdecimal(uintmax_t value) { result[x] = buffer[y]; } - return result; + return &result[0]; } template string hex(uintmax_t value) { @@ -192,7 +192,7 @@ template string hex(uintmax_t value) { output[offset - i] = temp; } - return output; + return &output[0]; } template string binary(uintmax_t value) { @@ -214,7 +214,7 @@ template string binary(uintmax_t value) { output[offset - i] = temp; } - return output; + return &output[0]; } //using sprintf is certainly not the most ideal method to convert diff --git a/snes/chip/bsx/cartridge/cartridge.cpp b/snes/chip/bsx/cartridge/cartridge.cpp index 7f55116..e721729 100644 --- a/snes/chip/bsx/cartridge/cartridge.cpp +++ b/snes/chip/bsx/cartridge/cartridge.cpp @@ -32,6 +32,8 @@ void BSXCartridge::reset() { uint8 BSXCartridge::memory_access(bool write, Memory &memory, unsigned addr, uint8 data) { if(write == 0) return memory_read(memory, addr); memory_write(memory, addr, data); + + return 0; // FIXME: Can it reach here? } uint8 BSXCartridge::memory_read(Memory &memory, unsigned addr) { diff --git a/snes/chip/sa1/memory/memory.cpp b/snes/chip/sa1/memory/memory.cpp index 8ab012a..7210bf6 100644 --- a/snes/chip/sa1/memory/memory.cpp +++ b/snes/chip/sa1/memory/memory.cpp @@ -36,6 +36,8 @@ uint8 SA1::bus_read(unsigned addr) { synchronize_cpu(); return bitmap_read(addr & 0x0fffff); } + + return 0; // FIXME: Can it reach here? } void SA1::bus_write(unsigned addr, uint8 data) { @@ -96,6 +98,8 @@ uint8 SA1::vbr_read(unsigned addr) { if((addr & 0x40f800) == 0x003000) { //$00-3f|80-bf:3000-37ff return iram.read(addr & 0x2047); } + + return 0; // FIXME: Can it reach here? } //ROM, I-RAM and MMIO registers are accessed at ~10.74MHz (2 clock ticks) diff --git a/snes/chip/superfx/memory/memory.cpp b/snes/chip/superfx/memory/memory.cpp index b0dbba5..6cac020 100644 --- a/snes/chip/superfx/memory/memory.cpp +++ b/snes/chip/superfx/memory/memory.cpp @@ -24,6 +24,8 @@ uint8 SuperFX::bus_read(unsigned addr) { } return cartridge.ram.read(addr & ram_mask); } + + return 0; // FIXME: Can it reach here? } void SuperFX::bus_write(unsigned addr, uint8 data) { diff --git a/snes/input/input.cpp b/snes/input/input.cpp index 074eced..40a9df7 100644 --- a/snes/input/input.cpp +++ b/snes/input/input.cpp @@ -214,6 +214,9 @@ uint8 Input::port_read(bool portnumber) { case 30: return 0; case 31: return 0; } + + default: + break; } //case Device::Justifier(s) } //switch(p.device.i) @@ -263,6 +266,8 @@ void Input::update() { latchy = (p.device.i == Device::Justifiers ? p.justifier.y2 : -1); } } break; + default: + break; } if(latchy < 0 || latchy >= (ppu.overscan() ? 240 : 225) || latchx < 0 || latchx >= 256) {