Linux: Fixed compilation warnings/errors with GCC/clang

This commit is contained in:
Sour 2019-11-13 18:30:05 -05:00
parent 48d96eafc0
commit 7041ec7682
16 changed files with 47 additions and 43 deletions

View file

@ -99,7 +99,7 @@ void BaseControlDevice::SetTextState(string textState)
try {
pos.X = (int16_t)std::stol(data[0]);
pos.Y = (int16_t)std::stol(data[1]);
} catch(std::exception ex) {
} catch(std::exception&) {
pos.X = -1;
pos.Y = -1;
}

View file

@ -151,6 +151,8 @@ protected:
void SetMirroringType(MirroringType type);
MirroringType GetMirroringType();
__forceinline uint8_t InternalReadVRAM(uint16_t addr);
public:
static constexpr uint32_t NametableCount = 0x10;
static constexpr uint32_t NametableSize = 0x400;
@ -178,15 +180,14 @@ public:
RomInfo GetRomInfo();
uint32_t GetMapperDipSwitchCount();
__forceinline uint8_t ReadRAM(uint16_t addr) override;
uint8_t ReadRAM(uint16_t addr) override;
uint8_t PeekRAM(uint16_t addr) override;
uint8_t DebugReadRAM(uint16_t addr);
virtual void WriteRAM(uint16_t addr, uint8_t value) override;
void WriteRAM(uint16_t addr, uint8_t value) override;
void DebugWriteRAM(uint16_t addr, uint8_t value);
void WritePrgRam(uint16_t addr, uint8_t value);
__forceinline uint8_t InternalReadVRAM(uint16_t addr);
__forceinline virtual uint8_t MapperReadVRAM(uint16_t addr, MemoryOperationType operationType);
virtual uint8_t MapperReadVRAM(uint16_t addr, MemoryOperationType operationType);
__forceinline uint8_t ReadVRAM(uint16_t addr, MemoryOperationType type = MemoryOperationType::PpuRenderingRead)
{

View file

@ -437,6 +437,7 @@ uint32_t CPU::GetClockRate(NesModel model)
void CPU::SetMasterClockDivider(NesModel region)
{
switch(region) {
default:
case NesModel::NTSC:
_startClockCount = 6;
_endClockCount = 6;

View file

@ -181,7 +181,7 @@ public:
void GetInstructionProgress(InstructionProgress &state);
void GetApuState(ApuState *state);
__forceinline void GetState(DebugState *state, bool includeMapperInfo = true);
void GetState(DebugState *state, bool includeMapperInfo = true);
void SetState(DebugState state);
void Suspend();

View file

@ -524,7 +524,7 @@ int32_t ExpressionEvaluator::Evaluate(string expression, DebugState &state, Eval
if(success) {
return result;
}
} catch(std::exception e) {
} catch(std::exception&) {
}
resultType = EvalResultType::Invalid;
return 0;
@ -539,7 +539,7 @@ bool ExpressionEvaluator::Validate(string expression)
bool success;
PrivateEvaluate(expression, state, type, operationInfo, success);
return success;
} catch(std::exception e) {
} catch(std::exception&) {
return false;
}
}

View file

@ -43,7 +43,7 @@ bool FceuxMovie::InitializeData(stringstream &filestream)
uint32_t systemAction = 0;
try {
systemAction = (uint32_t)std::atol(lineData[0].c_str());
} catch(std::exception ex) {
} catch(std::exception&) {
}
_systemActionByFrame.push_back(systemAction);

View file

@ -197,7 +197,7 @@ bool HdPackLoader::LoadPack()
InitializeHdPack();
return true;
} catch(std::exception ex) {
} catch(std::exception &ex) {
MessageManager::Log(string("[HDPack] Error loading HDPack: ") + ex.what() + " on line: " + currentLine);
return false;
}

View file

@ -198,7 +198,7 @@ void MemoryAccessCounter::GetNametableChangedData(bool ntChangedData[])
NesModel model = _debugger->GetConsole()->GetModel();
double frameRate = model == NesModel::NTSC ? 60.1 : 50.01;
double overclockRate = _debugger->GetConsole()->GetPpu()->GetOverclockRate() * 100;
int32_t cyclesPerFrame = (int32_t)(_debugger->GetConsole()->GetCpu()->GetClockRate(model) / frameRate * overclockRate);
uint32_t cyclesPerFrame = (uint32_t)(_debugger->GetConsole()->GetCpu()->GetClockRate(model) / frameRate * overclockRate);
for(int i = 0; i < 0x1000; i++) {
_debugger->GetPpuAbsoluteAddressAndType(0x2000+i, &addressInfo);

View file

@ -270,7 +270,7 @@ uint32_t MesenMovie::LoadInt(std::unordered_map<string, string> &settings, strin
if(result != settings.end()) {
try {
return (uint32_t)std::stoul(result->second);
} catch(std::exception ex) {
} catch(std::exception&) {
MessageManager::Log("[Movies] Invalid value for tag: " + name);
return defaultValue;
}

View file

@ -142,7 +142,7 @@ class PPU : public IMemoryHandler, public Snapshotable
void UpdateMinimumDrawCycles();
__forceinline uint8_t GetPixelColor();
uint8_t GetPixelColor();
__forceinline virtual void DrawPixel();
void UpdateGrayscaleAndIntensifyBits();
virtual void SendFrame();
@ -191,7 +191,7 @@ class PPU : public IMemoryHandler, public Snapshotable
ranges.AddHandler(MemoryOperation::Write, 0x4014);
}
__forceinline uint8_t ReadPaletteRAM(uint16_t addr);
uint8_t ReadPaletteRAM(uint16_t addr);
void WritePaletteRAM(uint16_t addr, uint8_t value);
uint8_t ReadRAM(uint16_t addr) override;

View file

@ -260,7 +260,7 @@ void SaveStateManager::LoadRecentGame(string filename, bool resetGame)
SaveStateManager::LoadState(stateStream, false);
}
}
} catch(std::exception ex) {
} catch(std::exception&) {
_console->Stop();
}
_console->Resume();

View file

@ -121,7 +121,7 @@ void TraceLogger::SetOptions(TraceLoggerOptions options)
if(!match.str(4).empty()) {
try {
part.MinWidth = std::stoi(match.str(4));
} catch(std::exception) {
} catch(std::exception &) {
}
}
part.DisplayInHex = match.str(5) == "h";

View file

@ -31,7 +31,7 @@ VirtualFile::VirtualFile(const string & file)
if(tokens.size() > 2) {
try {
_innerFileIndex = std::stoi(tokens[2]);
} catch(std::exception) {}
} catch(std::exception &) {}
}
}
}

View file

@ -19,11 +19,13 @@
#include "../Utilities/UTF8Util.h"
#ifdef __clang__
#define __forceinline __attribute__((always_inline))
#else
#ifdef __GNUC__
#define __forceinline
#ifndef __MINGW32__
#ifdef __clang__
#define __forceinline __attribute__((always_inline)) inline
#else
#ifdef __GNUC__
#define __forceinline __attribute__((always_inline)) inline
#endif
#endif
#endif

View file

@ -56,26 +56,26 @@ static std::unique_ptr<LibretroSoundManager> _soundManager;
static std::unique_ptr<LibretroKeyManager> _keyManager;
static std::unique_ptr<LibretroMessageManager> _messageManager;
static constexpr char* MesenNtscFilter = "mesen_ntsc_filter";
static constexpr char* MesenPalette = "mesen_palette";
static constexpr char* MesenNoSpriteLimit = "mesen_nospritelimit";
static constexpr char* MesenOverclock = "mesen_overclock";
static constexpr char* MesenOverclockType = "mesen_overclock_type";
static constexpr char* MesenOverscanVertical = "mesen_overscan_vertical";
static constexpr char* MesenOverscanHorizontal = "mesen_overscan_horizontal";
static constexpr char* MesenAspectRatio = "mesen_aspect_ratio";
static constexpr char* MesenRegion = "mesen_region";
static constexpr char* MesenRamState = "mesen_ramstate";
static constexpr char* MesenControllerTurboSpeed = "mesen_controllerturbospeed";
static constexpr char* MesenFdsAutoSelectDisk = "mesen_fdsautoinsertdisk";
static constexpr char* MesenFdsFastForwardLoad = "mesen_fdsfastforwardload";
static constexpr char* MesenHdPacks = "mesen_hdpacks";
static constexpr char* MesenScreenRotation = "mesen_screenrotation";
static constexpr char* MesenFakeStereo = "mesen_fake_stereo";
static constexpr char* MesenMuteTriangleUltrasonic = "mesen_mute_triangle_ultrasonic";
static constexpr char* MesenReduceDmcPopping = "mesen_reduce_dmc_popping";
static constexpr char* MesenSwapDutyCycle = "mesen_swap_duty_cycle";
static constexpr char* MesenDisableNoiseModeFlag = "mesen_disable_noise_mode_flag";
static constexpr const char* MesenNtscFilter = "mesen_ntsc_filter";
static constexpr const char* MesenPalette = "mesen_palette";
static constexpr const char* MesenNoSpriteLimit = "mesen_nospritelimit";
static constexpr const char* MesenOverclock = "mesen_overclock";
static constexpr const char* MesenOverclockType = "mesen_overclock_type";
static constexpr const char* MesenOverscanVertical = "mesen_overscan_vertical";
static constexpr const char* MesenOverscanHorizontal = "mesen_overscan_horizontal";
static constexpr const char* MesenAspectRatio = "mesen_aspect_ratio";
static constexpr const char* MesenRegion = "mesen_region";
static constexpr const char* MesenRamState = "mesen_ramstate";
static constexpr const char* MesenControllerTurboSpeed = "mesen_controllerturbospeed";
static constexpr const char* MesenFdsAutoSelectDisk = "mesen_fdsautoinsertdisk";
static constexpr const char* MesenFdsFastForwardLoad = "mesen_fdsfastforwardload";
static constexpr const char* MesenHdPacks = "mesen_hdpacks";
static constexpr const char* MesenScreenRotation = "mesen_screenrotation";
static constexpr const char* MesenFakeStereo = "mesen_fake_stereo";
static constexpr const char* MesenMuteTriangleUltrasonic = "mesen_mute_triangle_ultrasonic";
static constexpr const char* MesenReduceDmcPopping = "mesen_reduce_dmc_popping";
static constexpr const char* MesenSwapDutyCycle = "mesen_swap_duty_cycle";
static constexpr const char* MesenDisableNoiseModeFlag = "mesen_disable_noise_mode_flag";
uint32_t defaultPalette[0x40] { 0xFF666666, 0xFF002A88, 0xFF1412A7, 0xFF3B00A4, 0xFF5C007E, 0xFF6E0040, 0xFF6C0600, 0xFF561D00, 0xFF333500, 0xFF0B4800, 0xFF005200, 0xFF004F08, 0xFF00404D, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFADADAD, 0xFF155FD9, 0xFF4240FF, 0xFF7527FE, 0xFFA01ACC, 0xFFB71E7B, 0xFFB53120, 0xFF994E00, 0xFF6B6D00, 0xFF388700, 0xFF0C9300, 0xFF008F32, 0xFF007C8D, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFEFF, 0xFF64B0FF, 0xFF9290FF, 0xFFC676FF, 0xFFF36AFF, 0xFFFE6ECC, 0xFFFE8170, 0xFFEA9E22, 0xFFBCBE00, 0xFF88D800, 0xFF5CE430, 0xFF45E082, 0xFF48CDDE, 0xFF4F4F4F, 0xFF000000, 0xFF000000, 0xFFFFFEFF, 0xFFC0DFFF, 0xFFD3D2FF, 0xFFE8C8FF, 0xFFFBC2FF, 0xFFFEC4EA, 0xFFFECCC5, 0xFFF7D8A5, 0xFFE4E594, 0xFFCFEF96, 0xFFBDF4AB, 0xFFB3F3CC, 0xFFB5EBF2, 0xFFB8B8B8, 0xFF000000, 0xFF000000 };
uint32_t unsaturatedPalette[0x40] { 0xFF6B6B6B, 0xFF001E87, 0xFF1F0B96, 0xFF3B0C87, 0xFF590D61, 0xFF5E0528, 0xFF551100, 0xFF461B00, 0xFF303200, 0xFF0A4800, 0xFF004E00, 0xFF004619, 0xFF003A58, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFB2B2B2, 0xFF1A53D1, 0xFF4835EE, 0xFF7123EC, 0xFF9A1EB7, 0xFFA51E62, 0xFFA52D19, 0xFF874B00, 0xFF676900, 0xFF298400, 0xFF038B00, 0xFF008240, 0xFF007891, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFF63ADFD, 0xFF908AFE, 0xFFB977FC, 0xFFE771FE, 0xFFF76FC9, 0xFFF5836A, 0xFFDD9C29, 0xFFBDB807, 0xFF84D107, 0xFF5BDC3B, 0xFF48D77D, 0xFF48CCCE, 0xFF555555, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFC4E3FE, 0xFFD7D5FE, 0xFFE6CDFE, 0xFFF9CAFE, 0xFFFEC9F0, 0xFFFED1C7, 0xFFF7DCAC, 0xFFE8E89C, 0xFFD1F29D, 0xFFBFF4B1, 0xFFB7F5CD, 0xFFB7F0EE, 0xFFBEBEBE, 0xFF000000, 0xFF000000 };

View file

@ -54,7 +54,7 @@ void RunEmu()
{
try {
Run();
} catch(std::exception ex) {
} catch(std::exception&) {
}
}