core: Resolve misc cases of variable shadowing

Resolves shadowing warnings that aren't in a particularly large
subsection of core. Brings us closer to turning -Wshadow into an error.

All that remains now is for cases in the kernel (left untouched for now
since a big change by bunnei is pending), and a few left over in the
service code (will be tackled next).
This commit is contained in:
Lioncash 2021-05-02 22:14:15 -04:00
parent c17a59b58e
commit ebb64d5bf4
10 changed files with 27 additions and 25 deletions

View File

@ -94,12 +94,11 @@ CallbackOrAccessOneWord DynarmicCP15::CompileGetOneWord(bool two, unsigned opc1,
CallbackOrAccessTwoWords DynarmicCP15::CompileGetTwoWords(bool two, unsigned opc, CoprocReg CRm) { CallbackOrAccessTwoWords DynarmicCP15::CompileGetTwoWords(bool two, unsigned opc, CoprocReg CRm) {
if (!two && opc == 0 && CRm == CoprocReg::C14) { if (!two && opc == 0 && CRm == CoprocReg::C14) {
// CNTPCT // CNTPCT
const auto callback = static_cast<u64 (*)(Dynarmic::A32::Jit*, void*, u32, u32)>( const auto callback = [](Dynarmic::A32::Jit*, void* arg, u32, u32) -> u64 {
[](Dynarmic::A32::Jit*, void* arg, u32, u32) -> u64 { const auto& parent_arg = *static_cast<ARM_Dynarmic_32*>(arg);
ARM_Dynarmic_32& parent = *(ARM_Dynarmic_32*)arg; return parent_arg.system.CoreTiming().GetClockTicks();
return parent.system.CoreTiming().GetClockTicks(); };
}); return Callback{callback, &parent};
return Dynarmic::A32::Coprocessor::Callback{callback, (void*)&parent};
} }
LOG_CRITICAL(Core_ARM, "CP15: mrrc{} p15, {}, <Rt>, <Rt2>, {}", two ? "2" : "", opc, CRm); LOG_CRITICAL(Core_ARM, "CP15: mrrc{} p15, {}, <Rt>, <Rt2>, {}", two ? "2" : "", opc, CRm);

View File

@ -133,8 +133,8 @@ void CoreTiming::UnscheduleEvent(const std::shared_ptr<EventType>& event_type,
} }
} }
void CoreTiming::AddTicks(u64 ticks) { void CoreTiming::AddTicks(u64 ticks_to_add) {
this->ticks += ticks; ticks += ticks_to_add;
downcount -= static_cast<s64>(ticks); downcount -= static_cast<s64>(ticks);
} }

View File

@ -102,7 +102,7 @@ public:
/// We only permit one event of each type in the queue at a time. /// We only permit one event of each type in the queue at a time.
void RemoveEvent(const std::shared_ptr<EventType>& event_type); void RemoveEvent(const std::shared_ptr<EventType>& event_type);
void AddTicks(u64 ticks); void AddTicks(u64 ticks_to_add);
void ResetTicks(); void ResetTicks();

View File

@ -35,13 +35,13 @@ public:
CpuManager& operator=(CpuManager&&) = delete; CpuManager& operator=(CpuManager&&) = delete;
/// Sets if emulation is multicore or single core, must be set before Initialize /// Sets if emulation is multicore or single core, must be set before Initialize
void SetMulticore(bool is_multicore) { void SetMulticore(bool is_multi) {
this->is_multicore = is_multicore; is_multicore = is_multi;
} }
/// Sets if emulation is using an asynchronous GPU. /// Sets if emulation is using an asynchronous GPU.
void SetAsyncGpu(bool is_async_gpu) { void SetAsyncGpu(bool is_async) {
this->is_async_gpu = is_async_gpu; is_async_gpu = is_async;
} }
void Initialize(); void Initialize();

View File

@ -79,8 +79,8 @@ AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(
: AppLoader(directory->GetFile("main")), dir(std::move(directory)), : AppLoader(directory->GetFile("main")), dir(std::move(directory)),
override_update(override_update) {} override_update(override_update) {}
FileType AppLoader_DeconstructedRomDirectory::IdentifyType(const FileSys::VirtualFile& file) { FileType AppLoader_DeconstructedRomDirectory::IdentifyType(const FileSys::VirtualFile& dir_file) {
if (FileSys::IsDirectoryExeFS(file->GetContainingDirectory())) { if (FileSys::IsDirectoryExeFS(dir_file->GetContainingDirectory())) {
return FileType::DeconstructedRomDirectory; return FileType::DeconstructedRomDirectory;
} }

View File

@ -31,11 +31,14 @@ public:
bool override_update = false); bool override_update = false);
/** /**
* Returns the type of the file * Identifies whether or not the given file is a deconstructed ROM directory.
* @param file open file *
* @return FileType found, or FileType::Error if this loader doesn't know it * @param dir_file The file to verify.
*
* @return FileType::DeconstructedRomDirectory, or FileType::Error
* if the file is not a deconstructed ROM directory.
*/ */
static FileType IdentifyType(const FileSys::VirtualFile& file); static FileType IdentifyType(const FileSys::VirtualFile& dir_file);
FileType GetFileType() const override { FileType GetFileType() const override {
return IdentifyType(file); return IdentifyType(file);

View File

@ -222,8 +222,8 @@ void CheatEngine::SetMainMemoryParameters(VAddr main_region_begin, u64 main_regi
}; };
} }
void CheatEngine::Reload(std::vector<CheatEntry> cheats) { void CheatEngine::Reload(std::vector<CheatEntry> reload_cheats) {
this->cheats = std::move(cheats); cheats = std::move(reload_cheats);
is_pending_reload.exchange(true); is_pending_reload.exchange(true);
} }

View File

@ -68,7 +68,7 @@ public:
void Initialize(); void Initialize();
void SetMainMemoryParameters(VAddr main_region_begin, u64 main_region_size); void SetMainMemoryParameters(VAddr main_region_begin, u64 main_region_size);
void Reload(std::vector<CheatEntry> cheats); void Reload(std::vector<CheatEntry> reload_cheats);
private: private:
void FrameCallback(std::uintptr_t user_data, std::chrono::nanoseconds ns_late); void FrameCallback(std::uintptr_t user_data, std::chrono::nanoseconds ns_late);

View File

@ -67,8 +67,8 @@ Freezer::~Freezer() {
core_timing.UnscheduleEvent(event, 0); core_timing.UnscheduleEvent(event, 0);
} }
void Freezer::SetActive(bool active) { void Freezer::SetActive(bool is_active) {
if (!this->active.exchange(active)) { if (!active.exchange(is_active)) {
FillEntryReads(); FillEntryReads();
core_timing.ScheduleEvent(memory_freezer_ns, event); core_timing.ScheduleEvent(memory_freezer_ns, event);
LOG_DEBUG(Common_Memory, "Memory freezer activated!"); LOG_DEBUG(Common_Memory, "Memory freezer activated!");

View File

@ -43,7 +43,7 @@ public:
~Freezer(); ~Freezer();
// Enables or disables the entire memory freezer. // Enables or disables the entire memory freezer.
void SetActive(bool active); void SetActive(bool is_active);
// Returns whether or not the freezer is active. // Returns whether or not the freezer is active.
bool IsActive() const; bool IsActive() const;