diff --git a/Common/Data/Encoding/Shiftjis.h b/Common/Data/Encoding/Shiftjis.h index 5f77f7665d..7d73ea381a 100644 --- a/Common/Data/Encoding/Shiftjis.h +++ b/Common/Data/Encoding/Shiftjis.h @@ -20,6 +20,7 @@ struct ShiftJIS { return INVALID; } // Intentional fall-through. + [[fallthrough]]; case 0x9: case 0xE: row = ((j & 0x3F) << 1) - 0x01; diff --git a/Common/UI/Tween.h b/Common/UI/Tween.h index 229a210b8b..ee20fef026 100644 --- a/Common/UI/Tween.h +++ b/Common/UI/Tween.h @@ -65,7 +65,7 @@ template class TweenBase: public Tween { public: TweenBase(float duration, float (*curve)(float) = [](float f) { return f; }) - : Tween(duration, curve), from{}, to_{} { + : Tween(duration, curve), from_{}, to_{} { } TweenBase(Value from, Value to, float duration, float (*curve)(float) = [](float f) { return f; }) : Tween(duration, curve), from_(from), to_(to) { diff --git a/Core/Dialog/SavedataParam.cpp b/Core/Dialog/SavedataParam.cpp index 82a7fa532e..26c0a4949e 100644 --- a/Core/Dialog/SavedataParam.cpp +++ b/Core/Dialog/SavedataParam.cpp @@ -883,7 +883,7 @@ std::set SavedataParam::GetSecureFileNames(const std::string &dirPa std::set secureFileNames; for (const auto &entry : entries) { - char temp[14]; + char temp[14]{}; truncate_cpy(temp, entry.filename); secureFileNames.insert(temp); } diff --git a/Core/HLE/sceFont.cpp b/Core/HLE/sceFont.cpp index 6b6049a64b..0715a40dc7 100644 --- a/Core/HLE/sceFont.cpp +++ b/Core/HLE/sceFont.cpp @@ -1208,7 +1208,7 @@ static int sceFontFindOptimumFont(u32 libHandle, u32 fontStylePtr, u32 errorCode if (PSP_CoreParameter().compat.flags().Fontltn12Hack && requestedStyle->fontLanguage == 2) { for (size_t j = 0; j < internalFonts.size(); j++) { - const auto tempmatchStyle = internalFonts[j]->GetFontStyle(); + const auto &tempmatchStyle = internalFonts[j]->GetFontStyle(); const std::string str(tempmatchStyle.fontFileName); if (str == "ltn12.pgf") { optimumFont = internalFonts[j]; diff --git a/Core/MIPS/IR/IRInst.h b/Core/MIPS/IR/IRInst.h index 0dbfa67905..4348d527e5 100644 --- a/Core/MIPS/IR/IRInst.h +++ b/Core/MIPS/IR/IRInst.h @@ -379,7 +379,7 @@ public: insts_ = w.insts_; return *this; } - IRWriter &operator =(IRWriter &&w) { + IRWriter &operator =(IRWriter &&w) noexcept { insts_ = std::move(w.insts_); return *this; } diff --git a/Core/MIPS/IR/IRJit.h b/Core/MIPS/IR/IRJit.h index c8ef2d5192..063bb40c9c 100644 --- a/Core/MIPS/IR/IRJit.h +++ b/Core/MIPS/IR/IRJit.h @@ -51,7 +51,7 @@ public: IRBlock() {} IRBlock(u32 emAddr, u32 origSize, int instOffset, u32 numInstructions) : origAddr_(emAddr), origSize_(origSize), arenaOffset_(instOffset), numIRInstructions_(numInstructions) {} - IRBlock(IRBlock &&b) { + IRBlock(IRBlock &&b) noexcept { arenaOffset_ = b.arenaOffset_; hash_ = b.hash_; origAddr_ = b.origAddr_; diff --git a/Core/MIPS/MIPS.cpp b/Core/MIPS/MIPS.cpp index a5e522ce6b..3993962999 100644 --- a/Core/MIPS/MIPS.cpp +++ b/Core/MIPS/MIPS.cpp @@ -207,6 +207,8 @@ void MIPSState::Init() { nextPC = 0; downcount = 0; + memset(vcmpResult, 0, sizeof(vcmpResult)); + std::lock_guard guard(MIPSComp::jitLock); if (PSP_CoreParameter().cpuCore == CPUCore::JIT || PSP_CoreParameter().cpuCore == CPUCore::JIT_IR) { MIPSComp::jit = MIPSComp::CreateNativeJit(this, PSP_CoreParameter().cpuCore == CPUCore::JIT_IR); diff --git a/Core/MIPS/MIPSIntVFPU.cpp b/Core/MIPS/MIPSIntVFPU.cpp index c5d712beff..f0ae68a799 100644 --- a/Core/MIPS/MIPSIntVFPU.cpp +++ b/Core/MIPS/MIPSIntVFPU.cpp @@ -961,9 +961,11 @@ namespace MIPSInt case V_Triple: sz = V_Pair; // Intentional fallthrough. + [[fallthrough]]; case V_Pair: oz = V_Quad; // Intentional fallthrough. + [[fallthrough]]; case V_Single: for (int i = 0; i < GetNumVectorElements(sz); i++) { u32 value = s[i]; @@ -985,9 +987,11 @@ namespace MIPSInt case V_Triple: sz = V_Pair; // Intentional fallthrough. + [[fallthrough]]; case V_Pair: oz = V_Quad; // Intentional fallthrough. + [[fallthrough]]; case V_Single: for (int i = 0; i < GetNumVectorElements(sz); i++) { u32 value = s[i]; diff --git a/Core/Util/BlockAllocator.cpp b/Core/Util/BlockAllocator.cpp index 72907d7aea..e580c2eb7a 100644 --- a/Core/Util/BlockAllocator.cpp +++ b/Core/Util/BlockAllocator.cpp @@ -27,10 +27,6 @@ // Slow freaking thing but works (eventually) :) -BlockAllocator::BlockAllocator(int grain) : bottom_(NULL), top_(NULL), grain_(grain) -{ -} - BlockAllocator::~BlockAllocator() { Shutdown(); diff --git a/Core/Util/BlockAllocator.h b/Core/Util/BlockAllocator.h index 91e9642462..51a4038ca1 100644 --- a/Core/Util/BlockAllocator.h +++ b/Core/Util/BlockAllocator.h @@ -24,7 +24,7 @@ class PointerWrap; class BlockAllocator { public: - BlockAllocator(int grain = 16); // 16 byte granularity by default. + BlockAllocator(int grain = 16) : grain_(grain) {} // 16 byte granularity by default. ~BlockAllocator(); void Init(u32 _rangeStart, u32 _rangeSize, bool suballoc); @@ -59,8 +59,7 @@ public: private: void CheckBlocks() const; - struct Block - { + struct Block { Block(u32 _start, u32 _size, bool _taken, Block *_prev, Block *_next); void SetAllocated(const char *_tag, bool suballoc); void DoState(PointerWrap &p); @@ -72,13 +71,13 @@ private: Block *next; }; - Block *bottom_; - Block *top_; - u32 rangeStart_; - u32 rangeSize_; + Block *bottom_ = nullptr; + Block *top_ = nullptr; + u32 rangeStart_ = 0; + u32 rangeSize_ = 0; u32 grain_; - bool suballoc_; + bool suballoc_ = false; void MergeFreeBlocks(Block *fromBlock); Block *GetBlockFromAddress(u32 addr); diff --git a/Core/Util/DisArm64.cpp b/Core/Util/DisArm64.cpp index aa49af09cd..2414eec409 100644 --- a/Core/Util/DisArm64.cpp +++ b/Core/Util/DisArm64.cpp @@ -418,7 +418,7 @@ static void DataProcessingRegister(uint32_t w, uint64_t addr, Instruction *instr int opcode2 = (w >> 16) & 0x1F; int opcode = (w >> 10) & 0x3F; // Data-processing (1 source) - const char *opname[8] = { "rbit", "rev16", "rev32", "(unk)", "clz", "cls" }; + const char *opname[64] = { "rbit", "rev16", "rev32", "(unk)", "clz", "cls" }; const char *op = opcode2 >= 8 ? "unk" : opname[opcode]; snprintf(instr->text, sizeof(instr->text), "%s %c%d, %c%d", op, r, Rd, r, Rn); } else if (((w >> 21) & 0x2FF) == 0x0D6) { @@ -749,7 +749,7 @@ static void FPandASIMD1(uint32_t w, uint64_t addr, Instruction *instr) { int dst_index = imm5 >> (size + 1); int src_index = imm4 >> size; int op = (w >> 29) & 1; - char s; + char s = '_'; switch (size) { case 0x00: s = 'b'; break; case 0x01: s = 'h'; break; diff --git a/Core/Util/GameDB.h b/Core/Util/GameDB.h index 5d211da724..babf63e244 100644 --- a/Core/Util/GameDB.h +++ b/Core/Util/GameDB.h @@ -12,8 +12,8 @@ class VFSInterface; struct GameDBInfo { std::string title; std::string foreignTitle; - uint32_t crc; - uint64_t size; + uint32_t crc = 0; + uint64_t size = 0; }; class GameDB { diff --git a/ext/riscv-disas.cpp b/ext/riscv-disas.cpp index 816c985cca..a4868ae50d 100644 --- a/ext/riscv-disas.cpp +++ b/ext/riscv-disas.cpp @@ -2233,7 +2233,7 @@ static void decode_inst_operands(rv_decode *dec) static void decode_inst_decompress(rv_decode *dec, rv_isa isa) { - int decomp_op; + int decomp_op = 0; switch (isa) { case rv32: decomp_op = opcode_data[dec->op].decomp_rv32; break; case rv64: decomp_op = opcode_data[dec->op].decomp_rv64; break;