linter: Apply clang-format 19.1 formatting

find ./Source/ -name '*.cpp' -o -name '*.h' | xargs clang-format-19 -i
This commit is contained in:
Joshua Vandaële
2025-04-23 11:19:20 +02:00
parent d9d0082018
commit 2c54ee94c1
41 changed files with 159 additions and 212 deletions
@@ -429,7 +429,10 @@ extern const CaseInsensitiveDict<ParseInfo, '.', '_'> mnemonic_tokens = {
#define PSEUDO(mnemonic, base, variant_bits, alg) \
{ \
mnemonic, { static_cast<size_t>(base) * VARIANT_PERMUTATIONS + (variant_bits), alg } \
mnemonic, \
{ \
static_cast<size_t>(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<ParseInfo, '.', '_', '+', '-'> 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<MnemonicDesc, NUM_MNEMONICS* VARIANT_PERMUTATIONS> mnemonics = {
extern const std::array<MnemonicDesc, NUM_MNEMONICS * VARIANT_PERMUTATIONS> 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<size_t>(base) * VARIANT_PERMUTATIONS + variant_bits, cb }
ExtendedMnemonicDesc \
{ \
static_cast<size_t>(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<ExtendedMnemonicDesc, NUM_EXT_MNEMONICS* VARIANT_PERMUTATIONS>
extern const std::array<ExtendedMnemonicDesc, NUM_EXT_MNEMONICS * VARIANT_PERMUTATIONS>
extended_mnemonics = {
// E.2.1
PLAIN_PSEUDO(GekkoMnemonic::Addi, NegateSIMM), // subi
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -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;
}
+9 -8
View File
@@ -11,16 +11,17 @@ namespace Common
struct ContainsFn
{
template <std::input_iterator I, std::sentinel_for<I> S, class T, class Proj = std::identity>
requires std::indirect_binary_predicate < std::ranges::equal_to, std::projected<I, Proj>,
const T* > constexpr bool operator()(I first, S last, const T& value, Proj proj = {}) const
requires std::indirect_binary_predicate<std::ranges::equal_to, std::projected<I, Proj>,
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 <std::ranges::input_range R, class T, class Proj = std::identity>
requires std::indirect_binary_predicate < std::ranges::equal_to,
std::projected<std::ranges::iterator_t<R>, 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<std::ranges::iterator_t<R>, 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 <std::forward_iterator I1, std::sentinel_for<I1> S1, std::forward_iterator I2,
std::sentinel_for<I2> S2, class Pred = std::ranges::equal_to,
class Proj1 = std::identity, class Proj2 = std::identity>
requires std::indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
requires std::indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
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 <std::ranges::forward_range R1, std::ranges::forward_range R2,
class Pred = std::ranges::equal_to, class Proj1 = std::identity,
class Proj2 = std::identity>
requires std::indirectly_comparable<std::ranges::iterator_t<R1>, std::ranges::iterator_t<R2>,
Pred, Proj1, Proj2>
requires std::indirectly_comparable<std::ranges::iterator_t<R1>, std::ranges::iterator_t<R2>,
Pred, Proj1, Proj2>
constexpr bool operator()(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {},
Proj2 proj2 = {}) const
{
@@ -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
{
+11 -11
View File
@@ -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<const char*, 32> trap_condition{
nullptr, "lgt", "llt", nullptr, "eq", "lge", "lle", nullptr,
+4 -4
View File
@@ -73,9 +73,8 @@ void TruncateToCString(std::string* s);
bool TryParse(const std::string& str, bool* output);
template <typename T>
requires(std::is_integral_v<T> ||
(std::is_enum_v<T> && !detail::IsBooleanEnum<T>())) bool TryParse(const std::string& str,
T* output, int base = 0)
requires(std::is_integral_v<T> || (std::is_enum_v<T> && !detail::IsBooleanEnum<T>()))
bool TryParse(const std::string& str, T* output, int base = 0)
{
char* end_ptr = nullptr;
@@ -113,7 +112,8 @@ requires(std::is_integral_v<T> ||
}
template <typename T>
requires(detail::IsBooleanEnum<T>()) bool TryParse(const std::string& str, T* output)
requires(detail::IsBooleanEnum<T>())
bool TryParse(const std::string& str, T* output)
{
bool value;
if (!TryParse(str, &value))
+2 -2
View File
@@ -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
+1 -1
View File
@@ -589,7 +589,7 @@ static void EmuThread(Core::System& system, std::unique_ptr<BootParameters> boot
system.GetPowerPC().SetMode(PowerPC::CoreMode::Interpreter);
// Determine the CPU thread function
void (*cpuThreadFunc)(Core::System & system, const std::optional<std::string>& savestate_path,
void (*cpuThreadFunc)(Core::System& system, const std::optional<std::string>& savestate_path,
bool delete_savestate);
if (std::holds_alternative<BootParameters::DFF>(boot->parameters))
cpuThreadFunc = FifoPlayerThread;
@@ -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}
{
@@ -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)
{
+4 -1
View File
@@ -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; \
@@ -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);
+1 -1
View File
@@ -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;
+6 -6
View File
@@ -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 */
+3 -3
View File
@@ -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)
+2 -2
View File
@@ -177,8 +177,8 @@ constexpr std::array<u8, 256> s_key_codes_azerty{};
} // Anonymous namespace
USB_KBD::MessageData::MessageData(MessageType type, u8 modifiers_, PressedKeyData pressed_keys_)
: msg_type{Common::swap32(static_cast<u32>(type))}, modifiers{modifiers_}, pressed_keys{
pressed_keys_}
: msg_type{Common::swap32(static_cast<u32>(type))}, modifiers{modifiers_},
pressed_keys{pressed_keys_}
{
}
+2 -4
View File
@@ -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<std::string_view, Expression::VarBinding>;
static constexpr auto sorted_lookup = []() consteval
{
static constexpr auto sorted_lookup = []() consteval {
using enum Expression::VarBindingType;
auto unsorted_lookup = std::to_array<LookupKV>({
{"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.");
@@ -217,7 +217,7 @@ void Interpreter::SingleStep()
}
}
//#define SHOW_HISTORY
// #define SHOW_HISTORY
#ifdef SHOW_HISTORY
static std::vector<u32> s_pc_vec;
static std::vector<u32> s_pc_block_vec;
@@ -337,8 +337,7 @@ constexpr std::array<InterpreterOpTemplate, 10> s_table63_2{{
{31, Interpreter::fnmaddx}, // fnmaddx
}};
constexpr std::array<Interpreter::Instruction, 64> s_interpreter_op_table = []() consteval
{
constexpr std::array<Interpreter::Instruction, 64> s_interpreter_op_table = []() consteval {
std::array<Interpreter::Instruction, 64> table{};
table.fill(Interpreter::unknown_instruction);
for (auto& tpl : s_primary_table)
@@ -347,10 +346,8 @@ constexpr std::array<Interpreter::Instruction, 64> s_interpreter_op_table = []()
table[tpl.opcode] = tpl.fn;
};
return table;
}
();
constexpr std::array<Interpreter::Instruction, 1024> s_interpreter_op_table4 = []() consteval
{
}();
constexpr std::array<Interpreter::Instruction, 1024> s_interpreter_op_table4 = []() consteval {
std::array<Interpreter::Instruction, 1024> table{};
table.fill(Interpreter::unknown_instruction);
@@ -384,10 +381,8 @@ constexpr std::array<Interpreter::Instruction, 1024> s_interpreter_op_table4 = [
}
return table;
}
();
constexpr std::array<Interpreter::Instruction, 1024> s_interpreter_op_table19 = []() consteval
{
}();
constexpr std::array<Interpreter::Instruction, 1024> s_interpreter_op_table19 = []() consteval {
std::array<Interpreter::Instruction, 1024> table{};
table.fill(Interpreter::unknown_instruction);
for (auto& tpl : s_table19)
@@ -396,10 +391,8 @@ constexpr std::array<Interpreter::Instruction, 1024> s_interpreter_op_table19 =
table[tpl.opcode] = tpl.fn;
};
return table;
}
();
constexpr std::array<Interpreter::Instruction, 1024> s_interpreter_op_table31 = []() consteval
{
}();
constexpr std::array<Interpreter::Instruction, 1024> s_interpreter_op_table31 = []() consteval {
std::array<Interpreter::Instruction, 1024> table{};
table.fill(Interpreter::unknown_instruction);
for (auto& tpl : s_table31)
@@ -408,10 +401,8 @@ constexpr std::array<Interpreter::Instruction, 1024> s_interpreter_op_table31 =
table[tpl.opcode] = tpl.fn;
};
return table;
}
();
constexpr std::array<Interpreter::Instruction, 32> s_interpreter_op_table59 = []() consteval
{
}();
constexpr std::array<Interpreter::Instruction, 32> s_interpreter_op_table59 = []() consteval {
std::array<Interpreter::Instruction, 32> table{};
table.fill(Interpreter::unknown_instruction);
for (auto& tpl : s_table59)
@@ -420,10 +411,8 @@ constexpr std::array<Interpreter::Instruction, 32> s_interpreter_op_table59 = []
table[tpl.opcode] = tpl.fn;
};
return table;
}
();
constexpr std::array<Interpreter::Instruction, 1024> s_interpreter_op_table63 = []() consteval
{
}();
constexpr std::array<Interpreter::Instruction, 1024> s_interpreter_op_table63 = []() consteval {
std::array<Interpreter::Instruction, 1024> table{};
table.fill(Interpreter::unknown_instruction);
for (auto& tpl : s_table63)
@@ -444,8 +433,7 @@ constexpr std::array<Interpreter::Instruction, 1024> s_interpreter_op_table63 =
}
return table;
}
();
}();
Interpreter::Instruction Interpreter::GetInterpreterOp(UGeckoInstruction inst)
{

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