Merge pull request #10085 from Pokechu22/C26495

Fix all uninitialized variable warnings (C26495)
This commit is contained in:
Léo Lam
2021-10-13 21:52:22 +02:00
committed by GitHub
114 changed files with 783 additions and 784 deletions
+1 -1
View File
@@ -99,7 +99,7 @@ private:
bool m_is_stretching = false;
AudioCommon::AudioStretcher m_stretcher;
AudioCommon::SurroundDecoder m_surround_decoder;
std::array<short, MAX_SAMPLES * 2> m_scratch_buffer;
std::array<short, MAX_SAMPLES * 2> m_scratch_buffer{};
WaveFileWriter m_wave_writer_dtk;
WaveFileWriter m_wave_writer_dsp;
+4 -4
View File
@@ -53,7 +53,7 @@ class OpenALStream final : public SoundStream
{
#ifdef _WIN32
public:
OpenALStream() : m_source(0) {}
OpenALStream() = default;
~OpenALStream() override;
bool Init() override;
void SetVolume(int volume) override;
@@ -68,9 +68,9 @@ private:
Common::Flag m_run_thread;
std::vector<short> m_realtime_buffer;
std::array<ALuint, OAL_BUFFERS> m_buffers;
ALuint m_source;
ALfloat m_volume;
std::array<ALuint, OAL_BUFFERS> m_buffers{};
ALuint m_source = 0;
ALfloat m_volume = 1;
#endif // _WIN32
};
+1 -1
View File
@@ -23,7 +23,7 @@ using UnderlyingType = typename std::enable_if_t<std::is_enum<T>{}, std::underly
struct Location
{
System system;
System system{};
std::string section;
std::string key;
+3 -3
View File
@@ -85,11 +85,11 @@ enum
namespace File
{
// FileSystem tree node/
// FileSystem tree node
struct FSTEntry
{
bool isDirectory;
u64 size; // File length, or for directories, recursive count of children
bool isDirectory = false;
u64 size = 0; // File length, or for directories, recursive count of children
std::string physicalName; // Name on disk
std::string virtualName; // Name in FST names table
std::vector<FSTEntry> children;
+1 -1
View File
@@ -78,7 +78,7 @@ public:
bool empty() const noexcept { return size() == 0; }
private:
std::array<T, N> storage;
std::array<T, N> storage{};
int head = 0;
int tail = 0;
// Sacrifice 4 bytes for a simpler implementation. may optimize away in the future.
+13
View File
@@ -3,6 +3,7 @@
#pragma once
#include <array>
#include <cstddef>
#include <cstdio>
#include <string>
@@ -57,6 +58,18 @@ public:
return m_good;
}
template <typename T, std::size_t N>
bool ReadArray(std::array<T, N>* elements, size_t* num_read = nullptr)
{
return ReadArray(elements->data(), elements->size(), num_read);
}
template <typename T, std::size_t N>
bool WriteArray(const std::array<T, N>& elements)
{
return WriteArray(elements.data(), elements.size());
}
bool ReadBytes(void* data, size_t length)
{
return ReadArray(reinterpret_cast<char*>(data), length);
+2 -2
View File
@@ -153,7 +153,7 @@ private:
std::min(Common::scm_rev_git_str.size(), sizeof(ver)));
}
u32 id;
u32 id = 0;
const u16 key_t_size = sizeof(K);
const u16 value_t_size = sizeof(V);
char ver[40] = {};
@@ -161,5 +161,5 @@ private:
} m_header;
File::IOFile m_file;
u32 m_num_entries;
u32 m_num_entries = 0;
};
+1 -1
View File
@@ -14,5 +14,5 @@ public:
void Log(Common::Log::LOG_LEVELS level, const char* text) override;
private:
bool m_use_color;
bool m_use_color = false;
};
+1 -1
View File
@@ -98,7 +98,7 @@ private:
delete next_ptr;
}
T current;
T current{};
std::atomic<ElementPtr*> next;
};
+3 -3
View File
@@ -16,10 +16,10 @@ namespace ActionReplay
{
struct AREntry
{
AREntry() {}
AREntry() = default;
AREntry(u32 _addr, u32 _value) : cmd_addr(_addr), value(_value) {}
u32 cmd_addr;
u32 value;
u32 cmd_addr = 0;
u32 value = 0;
};
constexpr bool operator==(const AREntry& left, const AREntry& right)
{
+34 -34
View File
@@ -64,44 +64,44 @@ public:
// These store if the relevant setting should be reset back later (true) or if it should be left
// alone on restore (false)
bool bSetEmulationSpeed;
bool bSetVolume;
std::array<bool, MAX_BBMOTES> bSetWiimoteSource;
std::array<bool, SerialInterface::MAX_SI_CHANNELS> bSetPads;
std::array<bool, ExpansionInterface::MAX_EXI_CHANNELS> bSetEXIDevice;
bool bSetEmulationSpeed = false;
bool bSetVolume = false;
std::array<bool, MAX_BBMOTES> bSetWiimoteSource{};
std::array<bool, SerialInterface::MAX_SI_CHANNELS> bSetPads{};
std::array<bool, ExpansionInterface::MAX_EXI_CHANNELS> bSetEXIDevice{};
private:
bool valid;
bool bCPUThread;
bool bJITFollowBranch;
bool bSyncGPUOnSkipIdleHack;
bool bFloatExceptions;
bool bDivideByZeroExceptions;
bool bFPRF;
bool bAccurateNaNs;
bool bMMU;
bool bLowDCBZHack;
bool bDisableICache;
bool m_EnableJIT;
bool bSyncGPU;
int iSyncGpuMaxDistance;
int iSyncGpuMinDistance;
float fSyncGpuOverclock;
bool bFastDiscSpeed;
bool bDSPHLE;
bool bHLE_BS2;
int iSelectedLanguage;
PowerPC::CPUCore cpu_core;
int Volume;
float m_EmulationSpeed;
float m_OCFactor;
bool m_OCEnable;
bool m_bt_passthrough_enabled;
bool valid = false;
bool bCPUThread = false;
bool bJITFollowBranch = false;
bool bSyncGPUOnSkipIdleHack = false;
bool bFloatExceptions = false;
bool bDivideByZeroExceptions = false;
bool bFPRF = false;
bool bAccurateNaNs = false;
bool bMMU = false;
bool bLowDCBZHack = false;
bool bDisableICache = false;
bool m_EnableJIT = false;
bool bSyncGPU = false;
int iSyncGpuMaxDistance = 0;
int iSyncGpuMinDistance = 0;
float fSyncGpuOverclock = 0;
bool bFastDiscSpeed = false;
bool bDSPHLE = false;
bool bHLE_BS2 = false;
int iSelectedLanguage = 0;
PowerPC::CPUCore cpu_core = PowerPC::CPUCore::Interpreter;
int Volume = 0;
float m_EmulationSpeed = 0;
float m_OCFactor = 0;
bool m_OCEnable = false;
bool m_bt_passthrough_enabled = false;
std::string sBackend;
std::string m_strGPUDeterminismMode;
std::array<WiimoteSource, MAX_BBMOTES> iWiimoteSource;
std::array<SerialInterface::SIDevices, SerialInterface::MAX_SI_CHANNELS> Pads;
std::array<ExpansionInterface::TEXIDevices, ExpansionInterface::MAX_EXI_CHANNELS> m_EXIDevice;
std::array<WiimoteSource, MAX_BBMOTES> iWiimoteSource{};
std::array<SerialInterface::SIDevices, SerialInterface::MAX_SI_CHANNELS> Pads{};
std::array<ExpansionInterface::TEXIDevices, ExpansionInterface::MAX_EXI_CHANNELS> m_EXIDevice{};
};
void ConfigCache::SaveConfig(const SConfig& config)
+35 -35
View File
@@ -101,87 +101,87 @@ std::vector<u8> Cheats::GetValueAsByteVector(const Cheats::SearchValue& value)
namespace
{
template <typename T>
static PowerPC::TryReadResult<T>
static std::optional<PowerPC::ReadResult<T>>
TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space);
template <>
PowerPC::TryReadResult<u8> TryReadValueFromEmulatedMemory(u32 addr,
PowerPC::RequestedAddressSpace space)
std::optional<PowerPC::ReadResult<u8>>
TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{
return PowerPC::HostTryReadU8(addr, space);
}
template <>
PowerPC::TryReadResult<u16> TryReadValueFromEmulatedMemory(u32 addr,
PowerPC::RequestedAddressSpace space)
std::optional<PowerPC::ReadResult<u16>>
TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{
return PowerPC::HostTryReadU16(addr, space);
}
template <>
PowerPC::TryReadResult<u32> TryReadValueFromEmulatedMemory(u32 addr,
PowerPC::RequestedAddressSpace space)
std::optional<PowerPC::ReadResult<u32>>
TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{
return PowerPC::HostTryReadU32(addr, space);
}
template <>
PowerPC::TryReadResult<u64> TryReadValueFromEmulatedMemory(u32 addr,
PowerPC::RequestedAddressSpace space)
std::optional<PowerPC::ReadResult<u64>>
TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{
return PowerPC::HostTryReadU64(addr, space);
}
template <>
PowerPC::TryReadResult<s8> TryReadValueFromEmulatedMemory(u32 addr,
PowerPC::RequestedAddressSpace space)
std::optional<PowerPC::ReadResult<s8>>
TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{
auto tmp = PowerPC::HostTryReadU8(addr, space);
if (!tmp)
return PowerPC::TryReadResult<s8>();
return PowerPC::TryReadResult<s8>(tmp.translated, Common::BitCast<s8>(tmp.value));
return std::nullopt;
return PowerPC::ReadResult<s8>(tmp->translated, Common::BitCast<s8>(tmp->value));
}
template <>
PowerPC::TryReadResult<s16> TryReadValueFromEmulatedMemory(u32 addr,
PowerPC::RequestedAddressSpace space)
std::optional<PowerPC::ReadResult<s16>>
TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{
auto tmp = PowerPC::HostTryReadU16(addr, space);
if (!tmp)
return PowerPC::TryReadResult<s16>();
return PowerPC::TryReadResult<s16>(tmp.translated, Common::BitCast<s16>(tmp.value));
return std::nullopt;
return PowerPC::ReadResult<s16>(tmp->translated, Common::BitCast<s16>(tmp->value));
}
template <>
PowerPC::TryReadResult<s32> TryReadValueFromEmulatedMemory(u32 addr,
PowerPC::RequestedAddressSpace space)
std::optional<PowerPC::ReadResult<s32>>
TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{
auto tmp = PowerPC::HostTryReadU32(addr, space);
if (!tmp)
return PowerPC::TryReadResult<s32>();
return PowerPC::TryReadResult<s32>(tmp.translated, Common::BitCast<s32>(tmp.value));
return std::nullopt;
return PowerPC::ReadResult<s32>(tmp->translated, Common::BitCast<s32>(tmp->value));
}
template <>
PowerPC::TryReadResult<s64> TryReadValueFromEmulatedMemory(u32 addr,
PowerPC::RequestedAddressSpace space)
std::optional<PowerPC::ReadResult<s64>>
TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{
auto tmp = PowerPC::HostTryReadU64(addr, space);
if (!tmp)
return PowerPC::TryReadResult<s64>();
return PowerPC::TryReadResult<s64>(tmp.translated, Common::BitCast<s64>(tmp.value));
return std::nullopt;
return PowerPC::ReadResult<s64>(tmp->translated, Common::BitCast<s64>(tmp->value));
}
template <>
PowerPC::TryReadResult<float> TryReadValueFromEmulatedMemory(u32 addr,
PowerPC::RequestedAddressSpace space)
std::optional<PowerPC::ReadResult<float>>
TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{
return PowerPC::HostTryReadF32(addr, space);
}
template <>
PowerPC::TryReadResult<double> TryReadValueFromEmulatedMemory(u32 addr,
PowerPC::RequestedAddressSpace space)
std::optional<PowerPC::ReadResult<double>>
TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{
return PowerPC::HostTryReadF64(addr, space);
}
@@ -230,11 +230,11 @@ Cheats::NewSearch(const std::vector<Cheats::MemoryRange>& memory_ranges,
if (!current_value)
continue;
if (validator(current_value.value))
if (validator(current_value->value))
{
auto& r = results.emplace_back();
r.m_value = current_value.value;
r.m_value_state = current_value.translated ?
r.m_value = current_value->value;
r.m_value_state = current_value->translated ?
Cheats::SearchResultValueState::ValueFromVirtualMemory :
Cheats::SearchResultValueState::ValueFromPhysicalMemory;
r.m_address = addr;
@@ -284,11 +284,11 @@ Cheats::NextSearch(const std::vector<Cheats::SearchResult<T>>& previous_results,
// if the previous state was invalid we always update the value to avoid getting stuck in an
// invalid state
if (!previous_result.IsValueValid() ||
validator(current_value.value, previous_result.m_value))
validator(current_value->value, previous_result.m_value))
{
auto& r = results.emplace_back();
r.m_value = current_value.value;
r.m_value_state = current_value.translated ?
r.m_value = current_value->value;
r.m_value_state = current_value->translated ?
Cheats::SearchResultValueState::ValueFromVirtualMemory :
Cheats::SearchResultValueState::ValueFromPhysicalMemory;
r.m_address = addr;
+2 -2
View File
@@ -279,10 +279,10 @@ struct DSP_Regs
struct DSPInitOptions
{
// DSP IROM blob, which is where the DSP boots from. Embedded into the DSP.
std::array<u16, DSP_IROM_SIZE> irom_contents;
std::array<u16, DSP_IROM_SIZE> irom_contents{};
// DSP DROM blob, which contains resampling coefficients.
std::array<u16, DSP_COEF_SIZE> coef_contents;
std::array<u16, DSP_COEF_SIZE> coef_contents{};
// Core used to emulate the DSP.
// Default: JIT64.
@@ -100,8 +100,7 @@ static Gen::OpArg GetRegisterPointer(size_t reg)
#define STATIC_REG_ACCS
//#undef STATIC_REG_ACCS
DSPJitRegCache::DSPJitRegCache(DSPEmitter& emitter)
: m_emitter(emitter), m_is_temporary(false), m_is_merged(false)
DSPJitRegCache::DSPJitRegCache(DSPEmitter& emitter) : m_emitter(emitter), m_is_temporary(false)
{
for (X64CachedReg& xreg : m_xregs)
{
@@ -188,13 +187,10 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter& emitter)
m_regs[i + DSP_REG_AXL0].shift = 0;
m_regs[i + DSP_REG_AXH0].shift = 16;
}
m_use_ctr = 0;
}
DSPJitRegCache::DSPJitRegCache(const DSPJitRegCache& cache)
: m_regs(cache.m_regs), m_xregs(cache.m_xregs), m_emitter(cache.m_emitter),
m_is_temporary(true), m_is_merged(false)
: m_regs(cache.m_regs), m_xregs(cache.m_xregs), m_emitter(cache.m_emitter), m_is_temporary(true)
{
}
@@ -170,14 +170,14 @@ private:
void MovToMemory(size_t reg);
void FlushMemBackedRegs();
std::array<DynamicReg, 37> m_regs;
std::array<X64CachedReg, 16> m_xregs;
std::array<DynamicReg, 37> m_regs{};
std::array<X64CachedReg, 16> m_xregs{};
DSPEmitter& m_emitter;
bool m_is_temporary;
bool m_is_merged;
bool m_is_merged = false;
int m_use_ctr;
int m_use_ctr = 0;
};
} // namespace DSP::JIT::x64
@@ -15,7 +15,7 @@ namespace Dolphin_Debugger
struct CallstackEntry
{
std::string Name;
u32 vAddress;
u32 vAddress = 0;
};
bool GetCallstack(std::vector<CallstackEntry>& output);
+1 -1
View File
@@ -9,7 +9,7 @@
#include "Common/CommonTypes.h"
#include "Common/IOFile.h"
CDump::CDump(const std::string& filename) : m_pData(nullptr)
CDump::CDump(const std::string& filename)
{
File::IOFile pStream(filename, "rb");
if (pStream)
+2 -2
View File
@@ -27,9 +27,9 @@ private:
STRUCTUR_SIZE = 0x2BC
};
u8* m_pData;
u8* m_pData = nullptr;
size_t m_size;
size_t m_size = 0;
u32 Read32(u32 _pos);
};
+1 -1
View File
@@ -131,7 +131,7 @@ public:
u32 GetImportsNameTable() const;
private:
RSOHeader m_header;
RSOHeader m_header{};
std::string m_name;
u32 m_address = 0;
};
+2 -2
View File
@@ -22,8 +22,8 @@ struct CPMemory
{
TVtxDesc vtxDesc;
std::array<VAT, CP_NUM_VAT_REG> vtxAttr;
std::array<u32, CP_NUM_ARRAYS> arrayBases;
std::array<u32, CP_NUM_ARRAYS> arrayStrides;
std::array<u32, CP_NUM_ARRAYS> arrayBases{};
std::array<u32, CP_NUM_ARRAYS> arrayStrides{};
};
void LoadCPReg(u32 subCmd, u32 value, CPMemory& cpMem);

Some files were not shown because too many files have changed in this diff Show More