From d9d00820187d0d8e75c1cc113196ba255ab1a688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Vanda=C3=ABle?= Date: Mon, 17 Mar 2025 11:43:17 +0100 Subject: [PATCH 1/3] linter: Bump clang-format version to 19.1 --- Contributing.md | 2 +- Source/.clang-format | 3 ++- Tools/lint.sh | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Contributing.md b/Contributing.md index 23f529a5a36..474b5deb765 100644 --- a/Contributing.md +++ b/Contributing.md @@ -39,7 +39,7 @@ This guide is for developers who wish to contribute to the Dolphin codebase. It Following this guide and formatting your code as detailed will likely get your pull request merged much faster than if you don't (assuming the code itself has no mistakes). -This project uses clang-format 13.0 to check for common style issues. In case of conflicts between this guide and clang-format rules, the latter should be followed instead of this guide. +This project uses clang-format 19.1 to check for common style issues. In case of conflicts between this guide and clang-format rules, the latter should be followed instead of this guide. ## Checking and fixing formatting issues diff --git a/Source/.clang-format b/Source/.clang-format index 2262cdaa26b..12912e91262 100644 --- a/Source/.clang-format +++ b/Source/.clang-format @@ -79,6 +79,8 @@ SpacesInCStyleCastParentheses: false SpacesInParentheses: false SpacesInSquareBrackets: false Standard: Latest +StatementAttributeLikeMacros: + - emit TabWidth: 2 UseTab: Never --- @@ -93,4 +95,3 @@ ObjCSpaceBeforeProtocolList: true BraceWrapping: AfterObjCDeclaration: true ... - diff --git a/Tools/lint.sh b/Tools/lint.sh index db5398cc7cc..69cb5b27bb8 100755 --- a/Tools/lint.sh +++ b/Tools/lint.sh @@ -18,8 +18,8 @@ if ! [ -x "$(command -v $GIT)" ]; then exit 1 fi -REQUIRED_CLANG_FORMAT_MAJOR=13 -REQUIRED_CLANG_FORMAT_MINOR=0 +REQUIRED_CLANG_FORMAT_MAJOR=19 +REQUIRED_CLANG_FORMAT_MINOR=1 CLANG_FORMAT=clang-format CLANG_FORMAT_MAJOR=clang-format-${REQUIRED_CLANG_FORMAT_MAJOR} CLANG_FORMAT_MAJOR_MINOR=${CLANG_FORMAT_MAJOR}.${REQUIRED_CLANG_FORMAT_MINOR} From 2c54ee94c1bed2b958478e302307be4d056321a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Vanda=C3=ABle?= Date: Mon, 17 Mar 2025 12:14:32 +0100 Subject: [PATCH 2/3] linter: Apply clang-format 19.1 formatting find ./Source/ -name '*.cpp' -o -name '*.h' | xargs clang-format-19 -i --- .../Core/Common/Assembler/AssemblerTables.cpp | 14 +++++--- Source/Core/Common/ColorUtil.cpp | 4 +-- Source/Core/Common/CompatPatches.cpp | 4 +-- Source/Core/Common/Contains.h | 17 ++++----- .../Common/GL/GLExtensions/GLExtensions.cpp | 30 ++++------------ Source/Core/Common/GekkoDisassembler.cpp | 22 ++++++------ Source/Core/Common/StringUtil.h | 8 ++--- Source/Core/Core/Boot/ElfTypes.h | 4 +-- Source/Core/Core/Core.cpp | 2 +- .../Core/DSP/Interpreter/DSPInterpreter.cpp | 2 +- .../Core/Core/DSP/Jit/x64/DSPJitRegCache.cpp | 2 +- Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp | 5 ++- .../Core/HW/GCMemcard/GCMemcardDirectory.h | 2 +- Source/Core/Core/HW/WiimoteReal/IOAndroid.h | 2 +- Source/Core/Core/IOS/USB/Bluetooth/hci.h | 12 +++---- Source/Core/Core/IOS/USB/Bluetooth/l2cap.h | 6 ++-- Source/Core/Core/IOS/USB/USB_KBD.cpp | 4 +-- Source/Core/Core/PowerPC/Expression.cpp | 6 ++-- .../Core/PowerPC/Interpreter/Interpreter.cpp | 2 +- .../Interpreter/Interpreter_Tables.cpp | 36 +++++++------------ .../Core/Core/PowerPC/Jit64/Jit64_Tables.cpp | 36 +++++++------------ .../Core/PowerPC/JitArm64/JitArm64_Tables.cpp | 36 +++++++------------ Source/Core/Core/PowerPC/JitCommon/JitBase.h | 6 ++-- Source/Core/Core/PowerPC/PPCTables.cpp | 9 ++--- Source/Core/DiscIO/DirectoryBlob.cpp | 2 +- Source/Core/DolphinNoGUI/MainNoGUI.cpp | 19 +++++----- .../Config/ConfigControls/ConfigControl.h | 2 +- .../DolphinQt/Debugger/BranchWatchDialog.cpp | 6 ++-- Source/Core/DolphinQt/Debugger/JITWidget.cpp | 4 +-- .../Core/DolphinQt/GameList/GameTracker.cpp | 5 ++- Source/Core/DolphinQt/QtUtils/RunOnObject.h | 2 +- .../ControllerInterface/WGInput/WGInput.cpp | 2 +- .../VideoBackends/Software/TextureEncoder.cpp | 10 ++++-- .../VideoCommon/TextureDecoder_Common.cpp | 6 ++-- .../VideoCommon/TextureDecoder_Generic.cpp | 6 ++-- .../Core/VideoCommon/TextureDecoder_x64.cpp | 6 ++-- Source/Core/VideoCommon/VertexLoaderBase.h | 6 ++-- Source/Core/VideoCommon/VertexLoader_Color.h | 6 ++-- Source/Core/VideoCommon/VertexLoader_Normal.h | 6 ++-- .../Core/VideoCommon/VertexLoader_Position.h | 6 ++-- .../Core/VideoCommon/VertexLoader_TextCoord.h | 6 ++-- 41 files changed, 159 insertions(+), 212 deletions(-) diff --git a/Source/Core/Common/Assembler/AssemblerTables.cpp b/Source/Core/Common/Assembler/AssemblerTables.cpp index f9869d3ad37..f1ab3d7eebe 100644 --- a/Source/Core/Common/Assembler/AssemblerTables.cpp +++ b/Source/Core/Common/Assembler/AssemblerTables.cpp @@ -429,7 +429,10 @@ extern const CaseInsensitiveDict mnemonic_tokens = { #define PSEUDO(mnemonic, base, variant_bits, alg) \ { \ - mnemonic, { static_cast(base) * VARIANT_PERMUTATIONS + (variant_bits), alg } \ + mnemonic, \ + { \ + static_cast(base) * VARIANT_PERMUTATIONS + (variant_bits), alg \ + } \ } #define PLAIN_PSEUDO(mnemonic, base, alg) PSEUDO(mnemonic, base, PLAIN_MNEMONIC, alg) #define RC_PSEUDO(mnemonic, base, alg) \ @@ -673,7 +676,7 @@ extern const CaseInsensitiveDict extended_mnemoni EMIT_MNEMONIC_ENTRY(opcode_val, ((extra_bits) | InsertVal(0b11, 30, 31)), __VA_ARGS__) // Defines all basic mnemonics that Broadway/Gekko supports -extern const std::array mnemonics = { +extern const std::array mnemonics = { // A-2 OERC_MNEMONIC(31, InsertVal(266, 22, 30), OpDesc_D, OpDesc_A, OpDesc_B), // add OERC_MNEMONIC(31, InsertVal(10, 22, 30), OpDesc_D, OpDesc_A, OpDesc_B), // addc @@ -1048,7 +1051,10 @@ void FillMfsprBatAndBitswap(OperandList& operands) } // namespace #define PSEUDO(base, variant_bits, cb) \ - ExtendedMnemonicDesc { static_cast(base) * VARIANT_PERMUTATIONS + variant_bits, cb } + ExtendedMnemonicDesc \ + { \ + static_cast(base) * VARIANT_PERMUTATIONS + variant_bits, cb \ + } #define PLAIN_PSEUDO(base, cb) \ PSEUDO(base, PLAIN_MNEMONIC, cb), INVALID_EXT_MNEMONIC, INVALID_EXT_MNEMONIC, INVALID_EXT_MNEMONIC #define RC_PSEUDO(base, cb) \ @@ -1064,7 +1070,7 @@ void FillMfsprBatAndBitswap(OperandList& operands) PSEUDO(base, PLAIN_MNEMONIC, cb), PSEUDO(base, LINK_BIT, cb), \ PSEUDO(base, ABSOLUTE_ADDRESS_BIT, cb), PSEUDO(base, (LINK_BIT | ABSOLUTE_ADDRESS_BIT), cb) -extern const std::array +extern const std::array extended_mnemonics = { // E.2.1 PLAIN_PSEUDO(GekkoMnemonic::Addi, NegateSIMM), // subi diff --git a/Source/Core/Common/ColorUtil.cpp b/Source/Core/Common/ColorUtil.cpp index 0f1a0dc69c6..8a305898835 100644 --- a/Source/Core/Common/ColorUtil.cpp +++ b/Source/Core/Common/ColorUtil.cpp @@ -26,7 +26,7 @@ static u32 Decode5A3(u16 val) { r = s_lut5to8[(val >> 10) & 0x1f]; g = s_lut5to8[(val >> 5) & 0x1f]; - b = s_lut5to8[(val)&0x1f]; + b = s_lut5to8[(val) & 0x1f]; a = 0xFF; } else @@ -34,7 +34,7 @@ static u32 Decode5A3(u16 val) a = s_lut3to8[(val >> 12) & 0x7]; r = (s_lut4to8[(val >> 8) & 0xf] * a + (bg_color & 0xFF) * (255 - a)) / 255; g = (s_lut4to8[(val >> 4) & 0xf] * a + ((bg_color >> 8) & 0xFF) * (255 - a)) / 255; - b = (s_lut4to8[(val)&0xf] * a + ((bg_color >> 16) & 0xFF) * (255 - a)) / 255; + b = (s_lut4to8[(val) & 0xf] * a + ((bg_color >> 16) & 0xFF) * (255 - a)) / 255; a = 0xFF; } return (a << 24) | (r << 16) | (g << 8) | b; diff --git a/Source/Core/Common/CompatPatches.cpp b/Source/Core/Common/CompatPatches.cpp index b3f1643b065..26c88156507 100644 --- a/Source/Core/Common/CompatPatches.cpp +++ b/Source/Core/Common/CompatPatches.cpp @@ -155,6 +155,6 @@ int __cdecl EnableCompatPatches() // referencing it doesn't require ugly decorated names. // Use /include:enableCompatPatches linker flag to enable this. extern "C" { -__declspec(allocate(".CRT$XCZ")) decltype(&EnableCompatPatches) - enableCompatPatches = EnableCompatPatches; +__declspec(allocate(".CRT$XCZ")) decltype(&EnableCompatPatches) enableCompatPatches = + EnableCompatPatches; } diff --git a/Source/Core/Common/Contains.h b/Source/Core/Common/Contains.h index f707cb0f82c..526355fae13 100644 --- a/Source/Core/Common/Contains.h +++ b/Source/Core/Common/Contains.h @@ -11,16 +11,17 @@ namespace Common struct ContainsFn { template S, class T, class Proj = std::identity> - requires std::indirect_binary_predicate < std::ranges::equal_to, std::projected, - const T* > constexpr bool operator()(I first, S last, const T& value, Proj proj = {}) const + requires std::indirect_binary_predicate, + const T*> + constexpr bool operator()(I first, S last, const T& value, Proj proj = {}) const { return std::ranges::find(std::move(first), last, value, std::move(proj)) != last; } template - requires std::indirect_binary_predicate < std::ranges::equal_to, - std::projected, Proj>, - const T* > constexpr bool operator()(R&& r, const T& value, Proj proj = {}) const + requires std::indirect_binary_predicate< + std::ranges::equal_to, std::projected, Proj>, const T*> + constexpr bool operator()(R&& r, const T& value, Proj proj = {}) const { return (*this)(std::ranges::begin(r), std::ranges::end(r), value, std::move(proj)); } @@ -31,7 +32,7 @@ struct ContainsSubrangeFn template S1, std::forward_iterator I2, std::sentinel_for S2, class Pred = std::ranges::equal_to, class Proj1 = std::identity, class Proj2 = std::identity> - requires std::indirectly_comparable + requires std::indirectly_comparable constexpr bool operator()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) const { @@ -44,8 +45,8 @@ struct ContainsSubrangeFn template - requires std::indirectly_comparable, std::ranges::iterator_t, - Pred, Proj1, Proj2> + requires std::indirectly_comparable, std::ranges::iterator_t, + Pred, Proj1, Proj2> constexpr bool operator()(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) const { diff --git a/Source/Core/Common/GL/GLExtensions/GLExtensions.cpp b/Source/Core/Common/GL/GLExtensions/GLExtensions.cpp index c7d038f0de2..3a724f3abab 100644 --- a/Source/Core/Common/GL/GLExtensions/GLExtensions.cpp +++ b/Source/Core/Common/GL/GLExtensions/GLExtensions.cpp @@ -996,41 +996,23 @@ PFNDOLDISPATCHCOMPUTEPROC dolDispatchCompute; PFNDOLDISPATCHCOMPUTEINDIRECTPROC dolDispatchComputeIndirect; // Creates a GLFunc object that requires a feature -#define GLFUNC_REQUIRES(x, y) \ - { \ - (void**)&x, #x, y \ - } +#define GLFUNC_REQUIRES(x, y) {(void**)&x, #x, y} // Creates a GLFunc object with a different function suffix // For when we want to use the same function pointer, but different function name -#define GLFUNC_SUFFIX(x, y, z) \ - { \ - (void**)&x, #x #y, z \ - } +#define GLFUNC_SUFFIX(x, y, z) {(void**)&x, #x #y, z} // Creates a GLFunc object that should always be able to get grabbed // Used for Desktop OpenGL functions that should /always/ be provided. // aka GL 1.1/1.2/1.3/1.4 -#define GLFUNC_ALWAYS_REQUIRED(x) \ - { \ - (void**)&x, #x, "VERSION_GL" \ - } +#define GLFUNC_ALWAYS_REQUIRED(x) {(void**)&x, #x, "VERSION_GL"} // Creates a GLFunc object that should be able to get grabbed // on both GL and ES -#define GL_ES_FUNC_ALWAYS_REQUIRED(x) \ - { \ - (void**)&x, #x, "VERSION_GL |VERSION_GLES_2" \ - } +#define GL_ES_FUNC_ALWAYS_REQUIRED(x) {(void**)&x, #x, "VERSION_GL |VERSION_GLES_2"} // Creates a GLFunc object that should be able to get grabbed // on both GL and ES 3.0 -#define GL_ES3_FUNC_ALWAYS_REQUIRED(x) \ - { \ - (void**)&x, #x, "VERSION_GL |VERSION_GLES_3" \ - } +#define GL_ES3_FUNC_ALWAYS_REQUIRED(x) {(void**)&x, #x, "VERSION_GL |VERSION_GLES_3"} // Creates a GLFunc object that should be able to get grabbed // on both GL and ES 3.2 -#define GL_ES32_FUNC_ALWAYS_REQUIRED(x) \ - { \ - (void**)&x, #x, "VERSION_GL |VERSION_GLES_3_2" \ - } +#define GL_ES32_FUNC_ALWAYS_REQUIRED(x) {(void**)&x, #x, "VERSION_GL |VERSION_GLES_3_2"} struct GLFunc { diff --git a/Source/Core/Common/GekkoDisassembler.cpp b/Source/Core/Common/GekkoDisassembler.cpp index 46905c8773d..6dc865bf877 100644 --- a/Source/Core/Common/GekkoDisassembler.cpp +++ b/Source/Core/Common/GekkoDisassembler.cpp @@ -73,17 +73,17 @@ namespace Common #define PPCLSH 21 #define PPCIDX2SH 1 -#define PPCGETIDX(x) (((x)&PPCIDXMASK) >> PPCIDXSH) -#define PPCGETD(x) (((x)&PPCDMASK) >> PPCDSH) -#define PPCGETA(x) (((x)&PPCAMASK) >> PPCASH) -#define PPCGETB(x) (((x)&PPCBMASK) >> PPCBSH) -#define PPCGETC(x) (((x)&PPCCMASK) >> PPCCSH) -#define PPCGETM(x) (((x)&PPCMMASK) >> PPCMSH) -#define PPCGETCRD(x) (((x)&PPCCRDMASK) >> PPCCRDSH) -#define PPCGETCRA(x) (((x)&PPCCRAMASK) >> PPCCRASH) -#define PPCGETL(x) (((x)&PPCLMASK) >> PPCLSH) -#define PPCGETIDX2(x) (((x)&PPCIDX2MASK) >> PPCIDX2SH) -#define PPCGETSTRM(x) (((x)&PPCSTRM) >> PPCDSH) +#define PPCGETIDX(x) (((x) & PPCIDXMASK) >> PPCIDXSH) +#define PPCGETD(x) (((x) & PPCDMASK) >> PPCDSH) +#define PPCGETA(x) (((x) & PPCAMASK) >> PPCASH) +#define PPCGETB(x) (((x) & PPCBMASK) >> PPCBSH) +#define PPCGETC(x) (((x) & PPCCMASK) >> PPCCSH) +#define PPCGETM(x) (((x) & PPCMMASK) >> PPCMSH) +#define PPCGETCRD(x) (((x) & PPCCRDMASK) >> PPCCRDSH) +#define PPCGETCRA(x) (((x) & PPCCRAMASK) >> PPCCRASH) +#define PPCGETL(x) (((x) & PPCLMASK) >> PPCLSH) +#define PPCGETIDX2(x) (((x) & PPCIDX2MASK) >> PPCIDX2SH) +#define PPCGETSTRM(x) (((x) & PPCSTRM) >> PPCDSH) constexpr std::array trap_condition{ nullptr, "lgt", "llt", nullptr, "eq", "lge", "lle", nullptr, diff --git a/Source/Core/Common/StringUtil.h b/Source/Core/Common/StringUtil.h index 8ccc05ee6bf..621ec2188e8 100644 --- a/Source/Core/Common/StringUtil.h +++ b/Source/Core/Common/StringUtil.h @@ -73,9 +73,8 @@ void TruncateToCString(std::string* s); bool TryParse(const std::string& str, bool* output); template -requires(std::is_integral_v || - (std::is_enum_v && !detail::IsBooleanEnum())) bool TryParse(const std::string& str, - T* output, int base = 0) + requires(std::is_integral_v || (std::is_enum_v && !detail::IsBooleanEnum())) +bool TryParse(const std::string& str, T* output, int base = 0) { char* end_ptr = nullptr; @@ -113,7 +112,8 @@ requires(std::is_integral_v || } template -requires(detail::IsBooleanEnum()) bool TryParse(const std::string& str, T* output) + requires(detail::IsBooleanEnum()) +bool TryParse(const std::string& str, T* output) { bool value; if (!TryParse(str, &value)) diff --git a/Source/Core/Core/Boot/ElfTypes.h b/Source/Core/Core/Boot/ElfTypes.h index 747f36da0c6..820021a8a06 100644 --- a/Source/Core/Core/Boot/ElfTypes.h +++ b/Source/Core/Core/Boot/ElfTypes.h @@ -239,8 +239,8 @@ struct Elf32_Sym }; #define ELF32_ST_BIND(i) ((i) >> 4) -#define ELF32_ST_TYPE(i) ((i)&0xf) -#define ELF32_ST_INFO(b, t) (((b) << 4) + ((t)&0xf)) +#define ELF32_ST_TYPE(i) ((i) & 0xf) +#define ELF32_ST_INFO(b, t) (((b) << 4) + ((t) & 0xf)) // Relocation entries struct Elf32_Rel diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp index 5f90f93baef..323ea899d17 100644 --- a/Source/Core/Core/Core.cpp +++ b/Source/Core/Core/Core.cpp @@ -589,7 +589,7 @@ static void EmuThread(Core::System& system, std::unique_ptr boot system.GetPowerPC().SetMode(PowerPC::CoreMode::Interpreter); // Determine the CPU thread function - void (*cpuThreadFunc)(Core::System & system, const std::optional& savestate_path, + void (*cpuThreadFunc)(Core::System& system, const std::optional& savestate_path, bool delete_savestate); if (std::holds_alternative(boot->parameters)) cpuThreadFunc = FifoPlayerThread; diff --git a/Source/Core/Core/DSP/Interpreter/DSPInterpreter.cpp b/Source/Core/Core/DSP/Interpreter/DSPInterpreter.cpp index c15a6062816..43766c1b3c6 100644 --- a/Source/Core/Core/DSP/Interpreter/DSPInterpreter.cpp +++ b/Source/Core/Core/DSP/Interpreter/DSPInterpreter.cpp @@ -39,7 +39,7 @@ namespace DSP::Interpreter // used without changes. When PRECISE_BACKLOG is not defined, ZeroWriteBackLog does nothing and // ApplyWriteBackLog overwrites the register value with the value from the backlog (so writes from // extended opcodes "win" over the main opcode). -//#define PRECISE_BACKLOG +// #define PRECISE_BACKLOG Interpreter::Interpreter(DSPCore& dsp) : m_dsp_core{dsp} { diff --git a/Source/Core/Core/DSP/Jit/x64/DSPJitRegCache.cpp b/Source/Core/Core/DSP/Jit/x64/DSPJitRegCache.cpp index 3078e367149..47a011e9b47 100644 --- a/Source/Core/Core/DSP/Jit/x64/DSPJitRegCache.cpp +++ b/Source/Core/Core/DSP/Jit/x64/DSPJitRegCache.cpp @@ -105,7 +105,7 @@ static Gen::OpArg GetRegisterPointer(size_t reg) #endif #define STATIC_REG_ACCS -//#undef STATIC_REG_ACCS +// #undef STATIC_REG_ACCS DSPJitRegCache::DSPJitRegCache(DSPEmitter& emitter) : m_emitter(emitter), m_is_temporary(false) { diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp index c540dc24611..b96937e710c 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp @@ -672,7 +672,10 @@ void ZeldaUCode::RenderAudio() // Utility to define 32 bit accessors/modifiers methods based on two 16 bit // fields named _l and _h. #define DEFINE_32BIT_ACCESSOR(field_name, name) \ - u32 Get##name() const { return (field_name##_h << 16) | field_name##_l; } \ + u32 Get##name() const \ + { \ + return (field_name##_h << 16) | field_name##_l; \ + } \ void Set##name(u32 v) \ { \ field_name##_h = v >> 16; \ diff --git a/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.h b/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.h index 5b02700a613..7967c526709 100644 --- a/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.h +++ b/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.h @@ -15,7 +15,7 @@ #include "DiscIO/Enums.h" // Uncomment this to write the system data of the memorycard from directory to disc -//#define _WRITE_MC_HEADER 1 +// #define _WRITE_MC_HEADER 1 void MigrateFromMemcardFile(const std::string& directory_name, ExpansionInterface::Slot card_slot, DiscIO::Region region); diff --git a/Source/Core/Core/HW/WiimoteReal/IOAndroid.h b/Source/Core/Core/HW/WiimoteReal/IOAndroid.h index 1bdf8d4d64f..8373ef51e2a 100644 --- a/Source/Core/Core/HW/WiimoteReal/IOAndroid.h +++ b/Source/Core/Core/HW/WiimoteReal/IOAndroid.h @@ -23,7 +23,7 @@ protected: bool ConnectInternal() override; void DisconnectInternal() override; bool IsConnected() const override; - void IOWakeup() override{}; + void IOWakeup() override {}; int IORead(u8* buf) override; int IOWrite(u8 const* buf, size_t len) override; diff --git a/Source/Core/Core/IOS/USB/Bluetooth/hci.h b/Source/Core/Core/IOS/USB/Bluetooth/hci.h index c42a42aae7d..82b459f1c7a 100644 --- a/Source/Core/Core/IOS/USB/Bluetooth/hci.h +++ b/Source/Core/Core/IOS/USB/Bluetooth/hci.h @@ -399,8 +399,8 @@ constexpr bdaddr_t BDADDR_ANY{}; * and OCF (OpCode Command Field) from OpCode. */ -#define HCI_OPCODE(gf, cf) ((((gf)&0x3f) << 10) | ((cf)&0x3ff)) -#define HCI_OCF(op) ((op)&0x3ff) +#define HCI_OPCODE(gf, cf) ((((gf) & 0x3f) << 10) | ((cf) & 0x3ff)) +#define HCI_OCF(op) ((op) & 0x3ff) #define HCI_OGF(op) (((op) >> 10) & 0x3f) /* @@ -408,10 +408,10 @@ constexpr bdaddr_t BDADDR_ANY{}; * PB (Packet boundary) flags. */ -#define HCI_CON_HANDLE(h) ((h)&0x0fff) -#define HCI_PB_FLAG(h) (((h)&0x3000) >> 12) -#define HCI_BC_FLAG(h) (((h)&0xc000) >> 14) -#define HCI_MK_CON_HANDLE(h, pb, bc) (((h)&0x0fff) | (((pb)&3) << 12) | (((bc)&3) << 14)) +#define HCI_CON_HANDLE(h) ((h) & 0x0fff) +#define HCI_PB_FLAG(h) (((h) & 0x3000) >> 12) +#define HCI_BC_FLAG(h) (((h) & 0xc000) >> 14) +#define HCI_MK_CON_HANDLE(h, pb, bc) (((h) & 0x0fff) | (((pb) & 3) << 12) | (((bc) & 3) << 14)) /* PB flag values */ /* 00 - reserved for future use */ diff --git a/Source/Core/Core/IOS/USB/Bluetooth/l2cap.h b/Source/Core/Core/IOS/USB/Bluetooth/l2cap.h index 3d8249c0dbf..2990f494b9a 100644 --- a/Source/Core/Core/IOS/USB/Bluetooth/l2cap.h +++ b/Source/Core/Core/IOS/USB/Bluetooth/l2cap.h @@ -125,7 +125,7 @@ /* Transport Protocol */ /* 0x0019 - 0x1000 - reserved for future use */ -#define L2CAP_PSM_INVALID(psm) (((psm)&0x0101) != 0x0001) +#define L2CAP_PSM_INVALID(psm) (((psm) & 0x0101) != 0x0001) /* L2CAP Connection response command result codes */ #define L2CAP_SUCCESS 0x0000 @@ -151,9 +151,9 @@ /* L2CAP Configuration options */ #define L2CAP_OPT_CFLAG_BIT 0x0001 -#define L2CAP_OPT_CFLAG(flags) ((flags)&L2CAP_OPT_CFLAG_BIT) +#define L2CAP_OPT_CFLAG(flags) ((flags) & L2CAP_OPT_CFLAG_BIT) #define L2CAP_OPT_HINT_BIT 0x80 -#define L2CAP_OPT_HINT(type) ((type)&L2CAP_OPT_HINT_BIT) +#define L2CAP_OPT_HINT(type) ((type) & L2CAP_OPT_HINT_BIT) #define L2CAP_OPT_HINT_MASK 0x7f #define L2CAP_OPT_MTU 0x01 #define L2CAP_OPT_MTU_SIZE sizeof(uint16_t) diff --git a/Source/Core/Core/IOS/USB/USB_KBD.cpp b/Source/Core/Core/IOS/USB/USB_KBD.cpp index badfbac4b71..c0bf361e2f0 100644 --- a/Source/Core/Core/IOS/USB/USB_KBD.cpp +++ b/Source/Core/Core/IOS/USB/USB_KBD.cpp @@ -177,8 +177,8 @@ constexpr std::array s_key_codes_azerty{}; } // Anonymous namespace USB_KBD::MessageData::MessageData(MessageType type, u8 modifiers_, PressedKeyData pressed_keys_) - : msg_type{Common::swap32(static_cast(type))}, modifiers{modifiers_}, pressed_keys{ - pressed_keys_} + : msg_type{Common::swap32(static_cast(type))}, modifiers{modifiers_}, + pressed_keys{pressed_keys_} { } diff --git a/Source/Core/Core/PowerPC/Expression.cpp b/Source/Core/Core/PowerPC/Expression.cpp index 7c12b3b16a2..d522b7d522d 100644 --- a/Source/Core/Core/PowerPC/Expression.cpp +++ b/Source/Core/Core/PowerPC/Expression.cpp @@ -230,8 +230,7 @@ Expression::Expression(std::string_view text, ExprPointer ex, ExprVarListPointer : m_text(text), m_expr(std::move(ex)), m_vars(std::move(vars)) { using LookupKV = std::pair; - static constexpr auto sorted_lookup = []() consteval - { + static constexpr auto sorted_lookup = []() consteval { using enum Expression::VarBindingType; auto unsorted_lookup = std::to_array({ {"r0", {GPR, 0}}, @@ -385,8 +384,7 @@ Expression::Expression(std::string_view text, ExprPointer ex, ExprVarListPointer }); std::ranges::sort(unsorted_lookup, {}, &LookupKV::first); return unsorted_lookup; - } - (); + }(); static_assert(std::ranges::adjacent_find(sorted_lookup, {}, &LookupKV::first) == sorted_lookup.end(), "Expression: Sorted lookup should not contain duplicate keys."); diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp index 89153f801e5..63c68a6dc37 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp @@ -217,7 +217,7 @@ void Interpreter::SingleStep() } } -//#define SHOW_HISTORY +// #define SHOW_HISTORY #ifdef SHOW_HISTORY static std::vector s_pc_vec; static std::vector s_pc_block_vec; diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Tables.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Tables.cpp index 8c513df306c..a1673841711 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Tables.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Tables.cpp @@ -337,8 +337,7 @@ constexpr std::array s_table63_2{{ {31, Interpreter::fnmaddx}, // fnmaddx }}; -constexpr std::array s_interpreter_op_table = []() consteval -{ +constexpr std::array s_interpreter_op_table = []() consteval { std::array table{}; table.fill(Interpreter::unknown_instruction); for (auto& tpl : s_primary_table) @@ -347,10 +346,8 @@ constexpr std::array s_interpreter_op_table = []() table[tpl.opcode] = tpl.fn; }; return table; -} -(); -constexpr std::array s_interpreter_op_table4 = []() consteval -{ +}(); +constexpr std::array s_interpreter_op_table4 = []() consteval { std::array table{}; table.fill(Interpreter::unknown_instruction); @@ -384,10 +381,8 @@ constexpr std::array s_interpreter_op_table4 = [ } return table; -} -(); -constexpr std::array s_interpreter_op_table19 = []() consteval -{ +}(); +constexpr std::array s_interpreter_op_table19 = []() consteval { std::array table{}; table.fill(Interpreter::unknown_instruction); for (auto& tpl : s_table19) @@ -396,10 +391,8 @@ constexpr std::array s_interpreter_op_table19 = table[tpl.opcode] = tpl.fn; }; return table; -} -(); -constexpr std::array s_interpreter_op_table31 = []() consteval -{ +}(); +constexpr std::array s_interpreter_op_table31 = []() consteval { std::array table{}; table.fill(Interpreter::unknown_instruction); for (auto& tpl : s_table31) @@ -408,10 +401,8 @@ constexpr std::array s_interpreter_op_table31 = table[tpl.opcode] = tpl.fn; }; return table; -} -(); -constexpr std::array s_interpreter_op_table59 = []() consteval -{ +}(); +constexpr std::array s_interpreter_op_table59 = []() consteval { std::array table{}; table.fill(Interpreter::unknown_instruction); for (auto& tpl : s_table59) @@ -420,10 +411,8 @@ constexpr std::array s_interpreter_op_table59 = [] table[tpl.opcode] = tpl.fn; }; return table; -} -(); -constexpr std::array s_interpreter_op_table63 = []() consteval -{ +}(); +constexpr std::array s_interpreter_op_table63 = []() consteval { std::array table{}; table.fill(Interpreter::unknown_instruction); for (auto& tpl : s_table63) @@ -444,8 +433,7 @@ constexpr std::array s_interpreter_op_table63 = } return table; -} -(); +}(); Interpreter::Instruction Interpreter::GetInterpreterOp(UGeckoInstruction inst) { diff --git a/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.cpp b/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.cpp index 1914542c9f6..62275b3dd87 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.cpp @@ -335,8 +335,7 @@ constexpr std::array s_table63_2{{ {31, &Jit64::fmaddXX}, // fnmaddx }}; -constexpr std::array s_dyna_op_table = []() consteval -{ +constexpr std::array s_dyna_op_table = []() consteval { std::array table{}; table.fill(&Jit64::FallBackToInterpreter); @@ -347,11 +346,9 @@ constexpr std::array s_dyna_op_table = []() consteval } return table; -} -(); +}(); -constexpr std::array s_dyna_op_table4 = []() consteval -{ +constexpr std::array s_dyna_op_table4 = []() consteval { std::array table{}; table.fill(&Jit64::FallBackToInterpreter); @@ -385,11 +382,9 @@ constexpr std::array s_dyna_op_table4 = []() consteval } return table; -} -(); +}(); -constexpr std::array s_dyna_op_table19 = []() consteval -{ +constexpr std::array s_dyna_op_table19 = []() consteval { std::array table{}; table.fill(&Jit64::FallBackToInterpreter); @@ -400,11 +395,9 @@ constexpr std::array s_dyna_op_table19 = []() consteva } return table; -} -(); +}(); -constexpr std::array s_dyna_op_table31 = []() consteval -{ +constexpr std::array s_dyna_op_table31 = []() consteval { std::array table{}; table.fill(&Jit64::FallBackToInterpreter); @@ -415,11 +408,9 @@ constexpr std::array s_dyna_op_table31 = []() consteva } return table; -} -(); +}(); -constexpr std::array s_dyna_op_table59 = []() consteval -{ +constexpr std::array s_dyna_op_table59 = []() consteval { std::array table{}; table.fill(&Jit64::FallBackToInterpreter); @@ -430,11 +421,9 @@ constexpr std::array s_dyna_op_table59 = []() consteval } return table; -} -(); +}(); -constexpr std::array s_dyna_op_table63 = []() consteval -{ +constexpr std::array s_dyna_op_table63 = []() consteval { std::array table{}; table.fill(&Jit64::FallBackToInterpreter); @@ -456,8 +445,7 @@ constexpr std::array s_dyna_op_table63 = []() consteva } return table; -} -(); +}(); } // Anonymous namespace diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp index 09013ee196c..0aac345296b 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp @@ -335,8 +335,7 @@ constexpr std::array s_table63_2{{ {31, &JitArm64::fp_arith}, // fnmaddx }}; -constexpr std::array s_dyna_op_table = []() consteval -{ +constexpr std::array s_dyna_op_table = []() consteval { std::array table{}; table.fill(&JitArm64::FallBackToInterpreter); @@ -347,11 +346,9 @@ constexpr std::array s_dyna_op_table = []() consteval } return table; -} -(); +}(); -constexpr std::array s_dyna_op_table4 = []() consteval -{ +constexpr std::array s_dyna_op_table4 = []() consteval { std::array table{}; table.fill(&JitArm64::FallBackToInterpreter); @@ -385,11 +382,9 @@ constexpr std::array s_dyna_op_table4 = []() conste } return table; -} -(); +}(); -constexpr std::array s_dyna_op_table19 = []() consteval -{ +constexpr std::array s_dyna_op_table19 = []() consteval { std::array table{}; table.fill(&JitArm64::FallBackToInterpreter); @@ -400,11 +395,9 @@ constexpr std::array s_dyna_op_table19 = []() const } return table; -} -(); +}(); -constexpr std::array s_dyna_op_table31 = []() consteval -{ +constexpr std::array s_dyna_op_table31 = []() consteval { std::array table{}; table.fill(&JitArm64::FallBackToInterpreter); @@ -415,11 +408,9 @@ constexpr std::array s_dyna_op_table31 = []() const } return table; -} -(); +}(); -constexpr std::array s_dyna_op_table59 = []() consteval -{ +constexpr std::array s_dyna_op_table59 = []() consteval { std::array table{}; table.fill(&JitArm64::FallBackToInterpreter); @@ -430,11 +421,9 @@ constexpr std::array s_dyna_op_table59 = []() constev } return table; -} -(); +}(); -constexpr std::array s_dyna_op_table63 = []() consteval -{ +constexpr std::array s_dyna_op_table63 = []() consteval { std::array table{}; table.fill(&JitArm64::FallBackToInterpreter); @@ -456,8 +445,7 @@ constexpr std::array s_dyna_op_table63 = []() const } return table; -} -(); +}(); } // Anonymous namespace diff --git a/Source/Core/Core/PowerPC/JitCommon/JitBase.h b/Source/Core/Core/PowerPC/JitCommon/JitBase.h index 4ac81c40495..31659348caa 100644 --- a/Source/Core/Core/PowerPC/JitCommon/JitBase.h +++ b/Source/Core/Core/PowerPC/JitCommon/JitBase.h @@ -36,9 +36,9 @@ struct PowerPCState; } // namespace PowerPC class PPCSymbolDB; -//#define JIT_LOG_GENERATED_CODE // Enables logging of generated code -//#define JIT_LOG_GPR // Enables logging of the PPC general purpose regs -//#define JIT_LOG_FPR // Enables logging of the PPC floating point regs +// #define JIT_LOG_GENERATED_CODE // Enables logging of generated code +// #define JIT_LOG_GPR // Enables logging of the PPC general purpose regs +// #define JIT_LOG_FPR // Enables logging of the PPC floating point regs // Use these to control the instruction selection // #define INSTRUCTION_START FallBackToInterpreter(inst); return; diff --git a/Source/Core/Core/PowerPC/PPCTables.cpp b/Source/Core/Core/PowerPC/PPCTables.cpp index 3e8bfe27cf7..6cc84121a32 100644 --- a/Source/Core/Core/PowerPC/PPCTables.cpp +++ b/Source/Core/Core/PowerPC/PPCTables.cpp @@ -507,13 +507,11 @@ struct Tables static std::array s_all_instructions_stats; -constexpr Tables s_tables = []() consteval -{ +constexpr Tables s_tables = []() consteval { Tables tables{}; u32 counter = 0; - auto make_info = [&](const GekkoOPTemplate& inst) consteval->u32 - { + auto make_info = [&](const GekkoOPTemplate& inst) consteval -> u32 { ASSERT(counter < TOTAL_INSTRUCTION_COUNT); GekkoOPInfo* info = &tables.all_instructions[counter]; info->opname = inst.opname; @@ -609,8 +607,7 @@ constexpr Tables s_tables = []() consteval ASSERT(counter == TOTAL_INSTRUCTION_COUNT); return tables; -} -(); +}(); const GekkoOPInfo* GetOpInfo(UGeckoInstruction inst, u32 pc) { diff --git a/Source/Core/DiscIO/DirectoryBlob.cpp b/Source/Core/DiscIO/DirectoryBlob.cpp index 2623a2e4202..035e688670a 100644 --- a/Source/Core/DiscIO/DirectoryBlob.cpp +++ b/Source/Core/DiscIO/DirectoryBlob.cpp @@ -1166,7 +1166,7 @@ void DirectoryBlobPartition::WriteEntryData(std::vector* fst_data, u32* entr (*fst_data)[(*entry_offset)++] = (name_offset >> 16) & 0xff; (*fst_data)[(*entry_offset)++] = (name_offset >> 8) & 0xff; - (*fst_data)[(*entry_offset)++] = (name_offset)&0xff; + (*fst_data)[(*entry_offset)++] = (name_offset) & 0xff; Write32((u32)(data_offset >> address_shift), *entry_offset, fst_data); *entry_offset += 4; diff --git a/Source/Core/DolphinNoGUI/MainNoGUI.cpp b/Source/Core/DolphinNoGUI/MainNoGUI.cpp index 539bbe769ff..2d677aa7bae 100644 --- a/Source/Core/DolphinNoGUI/MainNoGUI.cpp +++ b/Source/Core/DolphinNoGUI/MainNoGUI.cpp @@ -209,23 +209,22 @@ int main(int argc, char* argv[]) parser->add_option("-p", "--platform") .action("store") .help("Window platform to use [%choices]") - .choices({ - "headless" + .choices({"headless" #ifdef __linux__ - , - "fbdev" + , + "fbdev" #endif #if HAVE_X11 - , - "x11" + , + "x11" #endif #ifdef _WIN32 - , - "win32" + , + "win32" #endif #ifdef __APPLE__ - , - "macos" + , + "macos" #endif }); diff --git a/Source/Core/DolphinQt/Config/ConfigControls/ConfigControl.h b/Source/Core/DolphinQt/Config/ConfigControls/ConfigControl.h index ee2f98d73d8..32f94a91e84 100644 --- a/Source/Core/DolphinQt/Config/ConfigControls/ConfigControl.h +++ b/Source/Core/DolphinQt/Config/ConfigControls/ConfigControl.h @@ -90,7 +90,7 @@ protected: return Config::Get(setting); } - virtual void OnConfigChanged(){}; + virtual void OnConfigChanged() {}; private: bool IsConfigLocal() const diff --git a/Source/Core/DolphinQt/Debugger/BranchWatchDialog.cpp b/Source/Core/DolphinQt/Debugger/BranchWatchDialog.cpp index 02a64e73348..949bb8d65c4 100644 --- a/Source/Core/DolphinQt/Debugger/BranchWatchDialog.cpp +++ b/Source/Core/DolphinQt/Debugger/BranchWatchDialog.cpp @@ -80,19 +80,19 @@ public: [[noreturn]] void setSourceModel(QAbstractItemModel* source_model) override { Crash(); } bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override; - template + template void OnToggled(bool enabled) { this->*member = enabled; invalidateRowsFilter(); } - template + template void OnSymbolTextChanged(const QString& text) { this->*member = text; invalidateRowsFilter(); } - template BranchWatchProxyModel::*member> + template BranchWatchProxyModel::* member> void OnAddressTextChanged(const QString& text) { bool ok = false; diff --git a/Source/Core/DolphinQt/Debugger/JITWidget.cpp b/Source/Core/DolphinQt/Debugger/JITWidget.cpp index 39580e5030d..bc60545c133 100644 --- a/Source/Core/DolphinQt/Debugger/JITWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/JITWidget.cpp @@ -62,7 +62,7 @@ public: // Always connected slots (external signals) void OnSymbolTextChanged(const QString& text); - template JitBlockProxyModel::*member> + template JitBlockProxyModel::* member> void OnAddressTextChanged(const QString& text); private: @@ -81,7 +81,7 @@ void JitBlockProxyModel::OnSymbolTextChanged(const QString& text) invalidateRowsFilter(); } -template JitBlockProxyModel::*member> +template JitBlockProxyModel::* member> void JitBlockProxyModel::OnAddressTextChanged(const QString& text) { bool ok = false; diff --git a/Source/Core/DolphinQt/GameList/GameTracker.cpp b/Source/Core/DolphinQt/GameList/GameTracker.cpp index 6031d37a325..41c2e017ecb 100644 --- a/Source/Core/DolphinQt/GameList/GameTracker.cpp +++ b/Source/Core/DolphinQt/GameList/GameTracker.cpp @@ -51,9 +51,8 @@ GameTracker::GameTracker(QObject* parent) : QFileSystemWatcher(parent) } }); - connect(&Settings::Instance(), &Settings::MetadataRefreshRequested, this, [this] { - m_load_thread.EmplaceItem(Command{CommandType::UpdateMetadata, {}}); - }); + connect(&Settings::Instance(), &Settings::MetadataRefreshRequested, this, + [this] { m_load_thread.EmplaceItem(Command{CommandType::UpdateMetadata, {}}); }); m_load_thread.Reset("GameList Tracker", [this](Command command) { switch (command.type) diff --git a/Source/Core/DolphinQt/QtUtils/RunOnObject.h b/Source/Core/DolphinQt/QtUtils/RunOnObject.h index ffc109e0ebd..73e6c05beed 100644 --- a/Source/Core/DolphinQt/QtUtils/RunOnObject.h +++ b/Source/Core/DolphinQt/QtUtils/RunOnObject.h @@ -70,7 +70,7 @@ auto RunOnObject(QObject* object, F&& functor) } template -auto RunOnObject(Receiver* obj, Type Base::*func) +auto RunOnObject(Receiver* obj, Type Base::* func) { return RunOnObject(obj, [obj, func] { return (obj->*func)(); }); } diff --git a/Source/Core/InputCommon/ControllerInterface/WGInput/WGInput.cpp b/Source/Core/InputCommon/ControllerInterface/WGInput/WGInput.cpp index a688ca03664..428a7ed6a3d 100644 --- a/Source/Core/InputCommon/ControllerInterface/WGInput/WGInput.cpp +++ b/Source/Core/InputCommon/ControllerInterface/WGInput/WGInput.cpp @@ -62,7 +62,7 @@ static constexpr std::array wgi_button_names = { template struct MemberName { - M T::*ptr; + M T::* ptr; const char* name; }; diff --git a/Source/Core/VideoBackends/Software/TextureEncoder.cpp b/Source/Core/VideoBackends/Software/TextureEncoder.cpp index 9f99cdf2747..8e194923410 100644 --- a/Source/Core/VideoBackends/Software/TextureEncoder.cpp +++ b/Source/Core/VideoBackends/Software/TextureEncoder.cpp @@ -906,7 +906,10 @@ static void EncodeRGB8(u8* dst, const u8* src, EFBCopyFormat format, bool yuv) case EFBCopyFormat::A8: SetBlockDimensions(3, 2, &sBlkCount, &tBlkCount, &sBlkSize, &tBlkSize); SetSpans(sBlkSize, tBlkSize, &tSpan, &sBlkSpan, &tBlkSpan, &writeStride); - ENCODE_LOOP_BLOCKS { *dst++ = 0xff; } + ENCODE_LOOP_BLOCKS + { + *dst++ = 0xff; + } ENCODE_LOOP_SPANS break; @@ -1135,7 +1138,10 @@ static void EncodeRGB8halfscale(u8* dst, const u8* src, EFBCopyFormat format, bo case EFBCopyFormat::A8: SetBlockDimensions(3, 2, &sBlkCount, &tBlkCount, &sBlkSize, &tBlkSize); SetSpans(sBlkSize, tBlkSize, &tSpan, &sBlkSpan, &tBlkSpan, &writeStride); - ENCODE_LOOP_BLOCKS { *dst++ = 0xff; } + ENCODE_LOOP_BLOCKS + { + *dst++ = 0xff; + } ENCODE_LOOP_SPANS break; diff --git a/Source/Core/VideoCommon/TextureDecoder_Common.cpp b/Source/Core/VideoCommon/TextureDecoder_Common.cpp index 299a36e4d41..d4139c02d9c 100644 --- a/Source/Core/VideoCommon/TextureDecoder_Common.cpp +++ b/Source/Core/VideoCommon/TextureDecoder_Common.cpp @@ -319,7 +319,7 @@ static inline u32 DecodePixel_RGB565(u16 val) int r, g, b, a; r = Convert5To8((val >> 11) & 0x1f); g = Convert6To8((val >> 5) & 0x3f); - b = Convert5To8((val)&0x1f); + b = Convert5To8((val) & 0x1f); a = 0xFF; return r | (g << 8) | (b << 16) | (a << 24); } @@ -331,7 +331,7 @@ static inline u32 DecodePixel_RGB5A3(u16 val) { r = Convert5To8((val >> 10) & 0x1f); g = Convert5To8((val >> 5) & 0x1f); - b = Convert5To8((val)&0x1f); + b = Convert5To8((val) & 0x1f); a = 0xFF; } else @@ -339,7 +339,7 @@ static inline u32 DecodePixel_RGB5A3(u16 val) a = Convert3To8((val >> 12) & 0x7); r = Convert4To8((val >> 8) & 0xf); g = Convert4To8((val >> 4) & 0xf); - b = Convert4To8((val)&0xf); + b = Convert4To8((val) & 0xf); } return r | (g << 8) | (b << 16) | (a << 24); } diff --git a/Source/Core/VideoCommon/TextureDecoder_Generic.cpp b/Source/Core/VideoCommon/TextureDecoder_Generic.cpp index 8b70faee504..835ddb523e1 100644 --- a/Source/Core/VideoCommon/TextureDecoder_Generic.cpp +++ b/Source/Core/VideoCommon/TextureDecoder_Generic.cpp @@ -31,7 +31,7 @@ static inline u32 DecodePixel_RGB565(u16 val) int r, g, b, a; r = Convert5To8((val >> 11) & 0x1f); g = Convert6To8((val >> 5) & 0x3f); - b = Convert5To8((val)&0x1f); + b = Convert5To8((val) & 0x1f); a = 0xFF; return r | (g << 8) | (b << 16) | (a << 24); } @@ -43,7 +43,7 @@ static inline u32 DecodePixel_RGB5A3(u16 val) { r = Convert5To8((val >> 10) & 0x1f); g = Convert5To8((val >> 5) & 0x1f); - b = Convert5To8((val)&0x1f); + b = Convert5To8((val) & 0x1f); a = 0xFF; } else @@ -51,7 +51,7 @@ static inline u32 DecodePixel_RGB5A3(u16 val) a = Convert3To8((val >> 12) & 0x7); r = Convert4To8((val >> 8) & 0xf); g = Convert4To8((val >> 4) & 0xf); - b = Convert4To8((val)&0xf); + b = Convert4To8((val) & 0xf); } return r | (g << 8) | (b << 16) | (a << 24); } diff --git a/Source/Core/VideoCommon/TextureDecoder_x64.cpp b/Source/Core/VideoCommon/TextureDecoder_x64.cpp index 85a6e5e7313..3faa6c52c3b 100644 --- a/Source/Core/VideoCommon/TextureDecoder_x64.cpp +++ b/Source/Core/VideoCommon/TextureDecoder_x64.cpp @@ -37,7 +37,7 @@ static inline u32 DecodePixel_RGB565(u16 val) int r, g, b, a; r = Convert5To8((val >> 11) & 0x1f); g = Convert6To8((val >> 5) & 0x3f); - b = Convert5To8((val)&0x1f); + b = Convert5To8((val) & 0x1f); a = 0xFF; return r | (g << 8) | (b << 16) | (a << 24); } @@ -49,7 +49,7 @@ static inline u32 DecodePixel_RGB5A3(u16 val) { r = Convert5To8((val >> 10) & 0x1f); g = Convert5To8((val >> 5) & 0x1f); - b = Convert5To8((val)&0x1f); + b = Convert5To8((val) & 0x1f); a = 0xFF; } else @@ -57,7 +57,7 @@ static inline u32 DecodePixel_RGB5A3(u16 val) a = Convert3To8((val >> 12) & 0x7); r = Convert4To8((val >> 8) & 0xf); g = Convert4To8((val >> 4) & 0xf); - b = Convert4To8((val)&0xf); + b = Convert4To8((val) & 0xf); } return r | (g << 8) | (b << 16) | (a << 24); } diff --git a/Source/Core/VideoCommon/VertexLoaderBase.h b/Source/Core/VideoCommon/VertexLoaderBase.h index 451f0357935..785afc8758c 100644 --- a/Source/Core/VideoCommon/VertexLoaderBase.h +++ b/Source/Core/VideoCommon/VertexLoaderBase.h @@ -73,9 +73,9 @@ public: protected: VertexLoaderBase(const TVtxDesc& vtx_desc, const VAT& vtx_attr) - : m_vertex_size{GetVertexSize(vtx_desc, vtx_attr)}, m_native_components{GetVertexComponents( - vtx_desc, vtx_attr)}, - m_VtxAttr{vtx_attr}, m_VtxDesc{vtx_desc} + : m_vertex_size{GetVertexSize(vtx_desc, vtx_attr)}, + m_native_components{GetVertexComponents(vtx_desc, vtx_attr)}, m_VtxAttr{vtx_attr}, + m_VtxDesc{vtx_desc} { } diff --git a/Source/Core/VideoCommon/VertexLoader_Color.h b/Source/Core/VideoCommon/VertexLoader_Color.h index da56d61212b..15226fe02f2 100644 --- a/Source/Core/VideoCommon/VertexLoader_Color.h +++ b/Source/Core/VideoCommon/VertexLoader_Color.h @@ -34,8 +34,7 @@ private: using SizeTable = EnumMap, VertexComponentFormat::Index16>; - static constexpr SizeTable s_table_size = []() consteval - { + static constexpr SizeTable s_table_size = []() consteval { SizeTable table{}; using VCF = VertexComponentFormat; @@ -45,6 +44,5 @@ private: table[VCF::Index16] = {2u, 2u, 2u, 2u, 2u, 2u}; return table; - } - (); + }(); }; diff --git a/Source/Core/VideoCommon/VertexLoader_Normal.h b/Source/Core/VideoCommon/VertexLoader_Normal.h index 0b8c1077652..40c139e21f6 100644 --- a/Source/Core/VideoCommon/VertexLoader_Normal.h +++ b/Source/Core/VideoCommon/VertexLoader_Normal.h @@ -31,8 +31,7 @@ private: 2>, VertexComponentFormat::Index16>; - static constexpr SizeTable s_table_size = []() consteval - { + static constexpr SizeTable s_table_size = []() consteval { SizeTable table{}; using VCF = VertexComponentFormat; @@ -145,6 +144,5 @@ private: table[VCF::Index16][true][NCC::NTB][FMT::InvalidFloat7] = 6; return table; - } - (); + }(); }; diff --git a/Source/Core/VideoCommon/VertexLoader_Position.h b/Source/Core/VideoCommon/VertexLoader_Position.h index 710e5eee6a8..aded604fad9 100644 --- a/Source/Core/VideoCommon/VertexLoader_Position.h +++ b/Source/Core/VideoCommon/VertexLoader_Position.h @@ -30,8 +30,7 @@ private: EnumMap, ComponentFormat::InvalidFloat7>, VertexComponentFormat::Index16>; - static constexpr SizeTable s_table_size = []() consteval - { + static constexpr SizeTable s_table_size = []() consteval { SizeTable table{}; using VCF = VertexComponentFormat; @@ -65,6 +64,5 @@ private: table[VCF::Index16][FMT::InvalidFloat7] = {2, 2}; return table; - } - (); + }(); }; diff --git a/Source/Core/VideoCommon/VertexLoader_TextCoord.h b/Source/Core/VideoCommon/VertexLoader_TextCoord.h index 5593571f07a..dc8e41d0752 100644 --- a/Source/Core/VideoCommon/VertexLoader_TextCoord.h +++ b/Source/Core/VideoCommon/VertexLoader_TextCoord.h @@ -33,8 +33,7 @@ private: EnumMap, ComponentFormat::InvalidFloat7>, VertexComponentFormat::Index16>; - static constexpr SizeTable s_table_size = []() consteval - { + static constexpr SizeTable s_table_size = []() consteval { SizeTable table{}; using VCF = VertexComponentFormat; @@ -68,6 +67,5 @@ private: table[VCF::Index16][FMT::InvalidFloat7] = {2, 2}; return table; - } - (); + }(); }; From bf554edfe0b543b08c42401b78fea2ae0ffa1168 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Vanda=C3=ABle?= Date: Wed, 23 Apr 2025 11:19:14 +0200 Subject: [PATCH 3/3] linter: Add and apply new formatting rules New rules: `InsertNewlineAtEOF: true` `RemoveSemicolon: true` `RequiresClausePosition: WithPreceding` --- Source/.clang-format | 3 +++ Source/Core/Common/Config/Layer.h | 2 +- Source/Core/Common/Contains.h | 13 ++++++------- Source/Core/Common/StringUtil.h | 4 ++-- Source/Core/Core/AchievementManager.h | 8 ++++---- Source/Core/Core/HW/WiimoteReal/IOAndroid.h | 2 +- .../Config/ConfigControls/ConfigChoice.cpp | 2 +- .../DolphinQt/Config/ConfigControls/ConfigControl.h | 2 +- Source/Core/VideoBackends/Metal/MTLStateTracker.h | 2 +- 9 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Source/.clang-format b/Source/.clang-format index 12912e91262..09d6fe9301f 100644 --- a/Source/.clang-format +++ b/Source/.clang-format @@ -54,6 +54,7 @@ IncludeCategories: IndentCaseLabels: false IndentWidth: 2 IndentWrappedFunctionNames: false +InsertNewlineAtEOF: true KeepEmptyLinesAtTheStartOfBlocks: false MacroBlockBegin: '' MacroBlockEnd: '' @@ -67,6 +68,8 @@ PenaltyExcessCharacter: 1000000 PenaltyReturnTypeOnItsOwnLine: 60 PointerAlignment: Left ReflowComments: true +RemoveSemicolon: true +RequiresClausePosition: WithPreceding SortIncludes: true SpaceAfterCStyleCast: false SpaceBeforeAssignmentOperators: true diff --git a/Source/Core/Common/Config/Layer.h b/Source/Core/Common/Config/Layer.h index 58859789ca9..e82b411c29b 100644 --- a/Source/Core/Common/Config/Layer.h +++ b/Source/Core/Common/Config/Layer.h @@ -18,7 +18,7 @@ namespace Config // Setting a key to an object of this type will delete the key. struct DefaultState { - friend constexpr bool operator==(DefaultState, DefaultState) { return true; }; + friend constexpr bool operator==(DefaultState, DefaultState) { return true; } }; namespace detail diff --git a/Source/Core/Common/Contains.h b/Source/Core/Common/Contains.h index 526355fae13..cabf6c0c07c 100644 --- a/Source/Core/Common/Contains.h +++ b/Source/Core/Common/Contains.h @@ -11,16 +11,15 @@ namespace Common struct ContainsFn { template S, class T, class Proj = std::identity> - requires std::indirect_binary_predicate, - const T*> + requires std::indirect_binary_predicate, const T*> constexpr bool operator()(I first, S last, const T& value, Proj proj = {}) const { return std::ranges::find(std::move(first), last, value, std::move(proj)) != last; } template - requires std::indirect_binary_predicate< - std::ranges::equal_to, std::projected, Proj>, const T*> + requires std::indirect_binary_predicate< + std::ranges::equal_to, std::projected, Proj>, const T*> constexpr bool operator()(R&& r, const T& value, Proj proj = {}) const { return (*this)(std::ranges::begin(r), std::ranges::end(r), value, std::move(proj)); @@ -32,7 +31,7 @@ struct ContainsSubrangeFn template S1, std::forward_iterator I2, std::sentinel_for S2, class Pred = std::ranges::equal_to, class Proj1 = std::identity, class Proj2 = std::identity> - requires std::indirectly_comparable + requires std::indirectly_comparable constexpr bool operator()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) const { @@ -45,8 +44,8 @@ struct ContainsSubrangeFn template - requires std::indirectly_comparable, std::ranges::iterator_t, - Pred, Proj1, Proj2> + requires std::indirectly_comparable, std::ranges::iterator_t, + Pred, Proj1, Proj2> constexpr bool operator()(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) const { diff --git a/Source/Core/Common/StringUtil.h b/Source/Core/Common/StringUtil.h index 621ec2188e8..617aee16bcf 100644 --- a/Source/Core/Common/StringUtil.h +++ b/Source/Core/Common/StringUtil.h @@ -73,7 +73,7 @@ void TruncateToCString(std::string* s); bool TryParse(const std::string& str, bool* output); template - requires(std::is_integral_v || (std::is_enum_v && !detail::IsBooleanEnum())) +requires(std::is_integral_v || (std::is_enum_v && !detail::IsBooleanEnum())) bool TryParse(const std::string& str, T* output, int base = 0) { char* end_ptr = nullptr; @@ -112,7 +112,7 @@ bool TryParse(const std::string& str, T* output, int base = 0) } template - requires(detail::IsBooleanEnum()) +requires(detail::IsBooleanEnum()) bool TryParse(const std::string& str, T* output) { bool value; diff --git a/Source/Core/Core/AchievementManager.h b/Source/Core/Core/AchievementManager.h index 3c09a87d1b9..d3df28160c8 100644 --- a/Source/Core/Core/AchievementManager.h +++ b/Source/Core/Core/AchievementManager.h @@ -171,8 +171,8 @@ public: void SetDevMenuUpdateCallback(std::function callback) { m_dev_menu_callback = callback; - }; - bool CheckForModifications() { return rc_client_raintegration_has_modifications(m_client); }; + } + bool CheckForModifications() { return rc_client_raintegration_has_modifications(m_client); } #endif // RC_CLIENT_SUPPORTS_RAINTEGRATION void DoState(PointerWrap& p); @@ -339,13 +339,13 @@ public: u16 revision) { return true; - }; + } constexpr bool CheckApprovedARCode(const ActionReplay::ARCode& code, const std::string& game_id, u16 revision) { return true; - }; + } constexpr void LoadGame(const std::string&, const DiscIO::Volume*) {} diff --git a/Source/Core/Core/HW/WiimoteReal/IOAndroid.h b/Source/Core/Core/HW/WiimoteReal/IOAndroid.h index 8373ef51e2a..c29c1de8694 100644 --- a/Source/Core/Core/HW/WiimoteReal/IOAndroid.h +++ b/Source/Core/Core/HW/WiimoteReal/IOAndroid.h @@ -23,7 +23,7 @@ protected: bool ConnectInternal() override; void DisconnectInternal() override; bool IsConnected() const override; - void IOWakeup() override {}; + void IOWakeup() override {} int IORead(u8* buf) override; int IOWrite(u8 const* buf, size_t len) override; diff --git a/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp b/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp index 5db63dfc0ea..de82f319d52 100644 --- a/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp +++ b/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp @@ -190,4 +190,4 @@ void ConfigComplexChoice::mousePressEvent(QMouseEvent* event) { QComboBox::mousePressEvent(event); } -}; +} diff --git a/Source/Core/DolphinQt/Config/ConfigControls/ConfigControl.h b/Source/Core/DolphinQt/Config/ConfigControls/ConfigControl.h index 32f94a91e84..fb37d3119f0 100644 --- a/Source/Core/DolphinQt/Config/ConfigControls/ConfigControl.h +++ b/Source/Core/DolphinQt/Config/ConfigControls/ConfigControl.h @@ -90,7 +90,7 @@ protected: return Config::Get(setting); } - virtual void OnConfigChanged() {}; + virtual void OnConfigChanged() {} private: bool IsConfigLocal() const diff --git a/Source/Core/VideoBackends/Metal/MTLStateTracker.h b/Source/Core/VideoBackends/Metal/MTLStateTracker.h index 75bd34352b9..32f6e1db016 100644 --- a/Source/Core/VideoBackends/Metal/MTLStateTracker.h +++ b/Source/Core/VideoBackends/Metal/MTLStateTracker.h @@ -57,7 +57,7 @@ public: explicit StateTracker(); ~StateTracker(); - Framebuffer* GetCurrentFramebuffer() { return m_current_framebuffer; }; + Framebuffer* GetCurrentFramebuffer() { return m_current_framebuffer; } void SetCurrentFramebuffer(Framebuffer* framebuffer); void BeginClearRenderPass(MTLClearColor color, float depth); void BeginRenderPass(MTLLoadAction load_action);