From 49a84cbc4c1318b2290688c5e798dcc63c0bf910 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Thu, 2 Feb 2023 14:59:25 -0800 Subject: [PATCH] Resolve various "no previous declaration" warnings --- Source/Core/Common/Debug/CodeTrace.cpp | 30 +++++++++---------- Source/Core/Common/FatFsUtil.cpp | 4 +++ .../Core/Core/IOS/USB/Emulated/Skylander.cpp | 4 +-- Source/Core/InputCommon/GCAdapter.cpp | 2 +- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/Source/Core/Common/Debug/CodeTrace.cpp b/Source/Core/Common/Debug/CodeTrace.cpp index 09939bdf96..65b7826770 100644 --- a/Source/Core/Common/Debug/CodeTrace.cpp +++ b/Source/Core/Common/Debug/CodeTrace.cpp @@ -48,6 +48,21 @@ u32 GetMemoryTargetSize(std::string_view instr) return 4; } + +bool CompareMemoryTargetToTracked(const std::string& instr, const u32 mem_target, + const std::set& mem_tracked) +{ + // This function is hit often and should be optimized. + auto it_lower = std::lower_bound(mem_tracked.begin(), mem_tracked.end(), mem_target); + + if (it_lower == mem_tracked.end()) + return false; + else if (*it_lower == mem_target) + return true; + + // If the base value doesn't hit, still need to check if longer values overlap. + return *it_lower < mem_target + GetMemoryTargetSize(instr); +} } // namespace void CodeTrace::SetRegTracked(const std::string& reg) @@ -124,21 +139,6 @@ TraceOutput CodeTrace::SaveCurrentInstruction() const return output; } -bool CompareMemoryTargetToTracked(const std::string& instr, const u32 mem_target, - const std::set& mem_tracked) -{ - // This function is hit often and should be optimized. - auto it_lower = std::lower_bound(mem_tracked.begin(), mem_tracked.end(), mem_target); - - if (it_lower == mem_tracked.end()) - return false; - else if (*it_lower == mem_target) - return true; - - // If the base value doesn't hit, still need to check if longer values overlap. - return *it_lower < mem_target + GetMemoryTargetSize(instr); -} - AutoStepResults CodeTrace::AutoStepping(bool continue_previous, AutoStop stop_on) { AutoStepResults results; diff --git a/Source/Core/Common/FatFsUtil.cpp b/Source/Core/Common/FatFsUtil.cpp index b003e48f5b..c03e16e4a6 100644 --- a/Source/Core/Common/FatFsUtil.cpp +++ b/Source/Core/Common/FatFsUtil.cpp @@ -195,6 +195,7 @@ extern "C" DWORD get_fattime(void) return static_cast(s_callbacks->GetCurrentTimeFAT()); } +#if FF_USE_LFN == 3 // match ff.h; currently unused by Dolphin extern "C" void* ff_memalloc(UINT msize) { return std::malloc(msize); @@ -204,7 +205,9 @@ extern "C" void ff_memfree(void* mblock) { return std::free(mblock); } +#endif +#if FF_FS_REENTRANT extern "C" int ff_cre_syncobj(BYTE vol, FF_SYNC_t* sobj) { *sobj = new std::recursive_mutex(); @@ -229,6 +232,7 @@ extern "C" int ff_del_syncobj(FF_SYNC_t sobj) delete reinterpret_cast(sobj); return 1; } +#endif static const char* FatFsErrorToString(FRESULT error_code) { diff --git a/Source/Core/Core/IOS/USB/Emulated/Skylander.cpp b/Source/Core/Core/IOS/USB/Emulated/Skylander.cpp index 2980b38d0c..7f9fb2203c 100644 --- a/Source/Core/Core/IOS/USB/Emulated/Skylander.cpp +++ b/Source/Core/Core/IOS/USB/Emulated/Skylander.cpp @@ -1144,9 +1144,9 @@ void SkylanderPortal::WriteBlock(u8 sky_num, u8 block, const u8* to_write_buf, u } } -u16 SkylanderCRC16(u16 init_value, const u8* buffer, u32 size) +static u16 SkylanderCRC16(u16 init_value, const u8* buffer, u32 size) { - const unsigned short CRC_CCITT_TABLE[256] = { + static constexpr std::array CRC_CCITT_TABLE{ 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7, 0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF, 0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6, 0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE, 0x2462, diff --git a/Source/Core/InputCommon/GCAdapter.cpp b/Source/Core/InputCommon/GCAdapter.cpp index 1ff134551c..a3853e9e6c 100644 --- a/Source/Core/InputCommon/GCAdapter.cpp +++ b/Source/Core/InputCommon/GCAdapter.cpp @@ -752,7 +752,7 @@ GCPadStatus Input(int chan) } // Get ControllerType from first byte in input payload. -ControllerType IdentifyControllerType(u8 data) +static ControllerType IdentifyControllerType(u8 data) { if (Common::ExtractBit<4>(data)) return ControllerType::Wired;