From a6e6f0f7bf5b3a199e897bee6828900295320e7f Mon Sep 17 00:00:00 2001 From: gibbed Date: Sat, 22 Feb 2020 13:23:03 -0600 Subject: [PATCH] Lint cleanup. --- src/xenia/app/emulator_window.cc | 6 +- src/xenia/app/xenia_main.cc | 3 +- src/xenia/cpu/backend/x64/x64_sequences.cc | 106 +++++++++++------- src/xenia/gpu/trace_viewer.cc | 8 +- src/xenia/kernel/xboxkrnl/xboxkrnl_strings.cc | 15 ++- 5 files changed, 82 insertions(+), 56 deletions(-) diff --git a/src/xenia/app/emulator_window.cc b/src/xenia/app/emulator_window.cc index a676302f1..19dc370df 100644 --- a/src/xenia/app/emulator_window.cc +++ b/src/xenia/app/emulator_window.cc @@ -2,7 +2,7 @@ ****************************************************************************** * Xenia : Xbox 360 Emulator Research Project * ****************************************************************************** - * Copyright 2015 Ben Vanik. All rights reserved. * + * Copyright 2020 Ben Vanik. All rights reserved. * * Released under the BSD license - see LICENSE in the root for more details. * ****************************************************************************** */ @@ -158,7 +158,9 @@ bool EmulatorWindow::Initialize() { ShowCommitID(); } break; - default: { handled = false; } break; + default: { + handled = false; + } break; } e->set_handled(handled); }); diff --git a/src/xenia/app/xenia_main.cc b/src/xenia/app/xenia_main.cc index 623744651..51fc61b5a 100644 --- a/src/xenia/app/xenia_main.cc +++ b/src/xenia/app/xenia_main.cc @@ -89,7 +89,8 @@ class Factory { void Add(const std::string& name, std::function(Args...)> instantiate) { - Add(name, []() { return true; }, instantiate); + constexpr auto always_available = []() { return true; }; + Add(name, always_available, instantiate); } template diff --git a/src/xenia/cpu/backend/x64/x64_sequences.cc b/src/xenia/cpu/backend/x64/x64_sequences.cc index 6ae28b468..8561c124d 100644 --- a/src/xenia/cpu/backend/x64/x64_sequences.cc +++ b/src/xenia/cpu/backend/x64/x64_sequences.cc @@ -2,7 +2,7 @@ ****************************************************************************** * Xenia : Xbox 360 Emulator Research Project * ****************************************************************************** - * Copyright 2019 Ben Vanik. All rights reserved. * + * Copyright 2020 Ben Vanik. All rights reserved. * * Released under the BSD license - see LICENSE in the root for more details. * ****************************************************************************** */ @@ -891,44 +891,56 @@ EMITTER_OPCODE_TABLE(OPCODE_IS_NAN, IS_NAN_F32, IS_NAN_F64); struct COMPARE_EQ_I8 : Sequence> { static void Emit(X64Emitter& e, const EmitArgType& i) { - EmitCommutativeCompareOp(e, i, - [](X64Emitter& e, const Reg8& src1, - const Reg8& src2) { e.cmp(src1, src2); }, - [](X64Emitter& e, const Reg8& src1, - int32_t constant) { e.cmp(src1, constant); }); + EmitCommutativeCompareOp( + e, i, + [](X64Emitter& e, const Reg8& src1, const Reg8& src2) { + e.cmp(src1, src2); + }, + [](X64Emitter& e, const Reg8& src1, int32_t constant) { + e.cmp(src1, constant); + }); e.sete(i.dest); } }; struct COMPARE_EQ_I16 : Sequence> { static void Emit(X64Emitter& e, const EmitArgType& i) { - EmitCommutativeCompareOp(e, i, - [](X64Emitter& e, const Reg16& src1, - const Reg16& src2) { e.cmp(src1, src2); }, - [](X64Emitter& e, const Reg16& src1, - int32_t constant) { e.cmp(src1, constant); }); + EmitCommutativeCompareOp( + e, i, + [](X64Emitter& e, const Reg16& src1, const Reg16& src2) { + e.cmp(src1, src2); + }, + [](X64Emitter& e, const Reg16& src1, int32_t constant) { + e.cmp(src1, constant); + }); e.sete(i.dest); } }; struct COMPARE_EQ_I32 : Sequence> { static void Emit(X64Emitter& e, const EmitArgType& i) { - EmitCommutativeCompareOp(e, i, - [](X64Emitter& e, const Reg32& src1, - const Reg32& src2) { e.cmp(src1, src2); }, - [](X64Emitter& e, const Reg32& src1, - int32_t constant) { e.cmp(src1, constant); }); + EmitCommutativeCompareOp( + e, i, + [](X64Emitter& e, const Reg32& src1, const Reg32& src2) { + e.cmp(src1, src2); + }, + [](X64Emitter& e, const Reg32& src1, int32_t constant) { + e.cmp(src1, constant); + }); e.sete(i.dest); } }; struct COMPARE_EQ_I64 : Sequence> { static void Emit(X64Emitter& e, const EmitArgType& i) { - EmitCommutativeCompareOp(e, i, - [](X64Emitter& e, const Reg64& src1, - const Reg64& src2) { e.cmp(src1, src2); }, - [](X64Emitter& e, const Reg64& src1, - int32_t constant) { e.cmp(src1, constant); }); + EmitCommutativeCompareOp( + e, i, + [](X64Emitter& e, const Reg64& src1, const Reg64& src2) { + e.cmp(src1, src2); + }, + [](X64Emitter& e, const Reg64& src1, int32_t constant) { + e.cmp(src1, constant); + }); e.sete(i.dest); } }; @@ -962,44 +974,56 @@ EMITTER_OPCODE_TABLE(OPCODE_COMPARE_EQ, COMPARE_EQ_I8, COMPARE_EQ_I16, struct COMPARE_NE_I8 : Sequence> { static void Emit(X64Emitter& e, const EmitArgType& i) { - EmitCommutativeCompareOp(e, i, - [](X64Emitter& e, const Reg8& src1, - const Reg8& src2) { e.cmp(src1, src2); }, - [](X64Emitter& e, const Reg8& src1, - int32_t constant) { e.cmp(src1, constant); }); + EmitCommutativeCompareOp( + e, i, + [](X64Emitter& e, const Reg8& src1, const Reg8& src2) { + e.cmp(src1, src2); + }, + [](X64Emitter& e, const Reg8& src1, int32_t constant) { + e.cmp(src1, constant); + }); e.setne(i.dest); } }; struct COMPARE_NE_I16 : Sequence> { static void Emit(X64Emitter& e, const EmitArgType& i) { - EmitCommutativeCompareOp(e, i, - [](X64Emitter& e, const Reg16& src1, - const Reg16& src2) { e.cmp(src1, src2); }, - [](X64Emitter& e, const Reg16& src1, - int32_t constant) { e.cmp(src1, constant); }); + EmitCommutativeCompareOp( + e, i, + [](X64Emitter& e, const Reg16& src1, const Reg16& src2) { + e.cmp(src1, src2); + }, + [](X64Emitter& e, const Reg16& src1, int32_t constant) { + e.cmp(src1, constant); + }); e.setne(i.dest); } }; struct COMPARE_NE_I32 : Sequence> { static void Emit(X64Emitter& e, const EmitArgType& i) { - EmitCommutativeCompareOp(e, i, - [](X64Emitter& e, const Reg32& src1, - const Reg32& src2) { e.cmp(src1, src2); }, - [](X64Emitter& e, const Reg32& src1, - int32_t constant) { e.cmp(src1, constant); }); + EmitCommutativeCompareOp( + e, i, + [](X64Emitter& e, const Reg32& src1, const Reg32& src2) { + e.cmp(src1, src2); + }, + [](X64Emitter& e, const Reg32& src1, int32_t constant) { + e.cmp(src1, constant); + }); e.setne(i.dest); } }; struct COMPARE_NE_I64 : Sequence> { static void Emit(X64Emitter& e, const EmitArgType& i) { - EmitCommutativeCompareOp(e, i, - [](X64Emitter& e, const Reg64& src1, - const Reg64& src2) { e.cmp(src1, src2); }, - [](X64Emitter& e, const Reg64& src1, - int32_t constant) { e.cmp(src1, constant); }); + EmitCommutativeCompareOp( + e, i, + [](X64Emitter& e, const Reg64& src1, const Reg64& src2) { + e.cmp(src1, src2); + }, + [](X64Emitter& e, const Reg64& src1, int32_t constant) { + e.cmp(src1, constant); + }); e.setne(i.dest); } }; diff --git a/src/xenia/gpu/trace_viewer.cc b/src/xenia/gpu/trace_viewer.cc index 77ab7c022..d11faaecc 100644 --- a/src/xenia/gpu/trace_viewer.cc +++ b/src/xenia/gpu/trace_viewer.cc @@ -2,7 +2,7 @@ ****************************************************************************** * Xenia : Xbox 360 Emulator Research Project * ****************************************************************************** - * Copyright 2015 Ben Vanik. All rights reserved. * + * Copyright 2020 Ben Vanik. All rights reserved. * * Released under the BSD license - see LICENSE in the root for more details. * ****************************************************************************** */ @@ -123,9 +123,9 @@ bool TraceViewer::Setup() { // Create the emulator but don't initialize so we can setup the window. emulator_ = std::make_unique(L"", L""); - X_STATUS result = - emulator_->Setup(window_.get(), nullptr, - [this]() { return CreateGraphicsSystem(); }, nullptr); + X_STATUS result = emulator_->Setup( + window_.get(), nullptr, [this]() { return CreateGraphicsSystem(); }, + nullptr); if (XFAILED(result)) { XELOGE("Failed to setup emulator: %.8X", result); return false; diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_strings.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_strings.cc index aa1bbf245..b574af1df 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_strings.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_strings.cc @@ -2,7 +2,7 @@ ****************************************************************************** * Xenia : Xbox 360 Emulator Research Project * ****************************************************************************** - * Copyright 2013 Ben Vanik. All rights reserved. * + * Copyright 2020 Ben Vanik. All rights reserved. * * Released under the BSD license - see LICENSE in the root for more details. * ****************************************************************************** */ @@ -174,7 +174,9 @@ int32_t format_core(PPCContext* ppc_context, FormatData& data, ArgList& args, case FS_Invalid: case FS_Unknown: case FS_End: - default: { assert_always(); } + default: { + assert_always(); + } case FS_Start: { if (c == '%') { @@ -220,7 +222,6 @@ int32_t format_core(PPCContext* ppc_context, FormatData& data, ArgList& args, flags |= FF_AddPrefix; continue; } - state = FS_Width; // fall through, don't need to goto restart } @@ -240,7 +241,6 @@ int32_t format_core(PPCContext* ppc_context, FormatData& data, ArgList& args, width += c - '0'; continue; } - state = FS_PrecisionStart; // fall through, don't need to goto restart } @@ -252,7 +252,6 @@ int32_t format_core(PPCContext* ppc_context, FormatData& data, ArgList& args, precision = 0; continue; } - state = FS_Size; goto restart; } @@ -271,7 +270,6 @@ int32_t format_core(PPCContext* ppc_context, FormatData& data, ArgList& args, precision += c - '0'; continue; } - state = FS_Size; // fall through } @@ -310,7 +308,6 @@ int32_t format_core(PPCContext* ppc_context, FormatData& data, ArgList& args, continue; } } - // fall through } @@ -581,7 +578,9 @@ int32_t format_core(PPCContext* ppc_context, FormatData& data, ArgList& args, break; } - default: { assert_always(); } + default: { + assert_always(); + } } } }