From 1446254a038dd0d2b1c81beb11c751ce977c9044 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Mon, 15 Feb 2021 18:45:54 +0300 Subject: [PATCH] Add error on missing 'override' For consistency. --- Utilities/JIT.h | 4 ++++ rpcs3/Emu/Cell/PPCDisAsm.h | 2 +- rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp | 4 ++++ rpcs3/Emu/RSX/VK/VKMemAlloc.cpp | 4 ++++ rpcs3/cmake_modules/ConfigureCompiler.cmake | 6 ++++++ rpcs3/rpcs3qt/custom_table_widget_item.h | 2 +- rpcs3/rpcs3qt/log_frame.cpp | 2 +- 7 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Utilities/JIT.h b/Utilities/JIT.h index e5eb622841..bcc041ca22 100644 --- a/Utilities/JIT.h +++ b/Utilities/JIT.h @@ -177,6 +177,10 @@ inline FT build_function_asm(F&& builder) #pragma GCC diagnostic ignored "-Wall" #pragma GCC diagnostic ignored "-Wextra" #pragma GCC diagnostic ignored "-Wold-style-cast" +#pragma GCC diagnostic ignored "-Wsuggest-override" +#ifdef __clang__ +#pragma clang diagnostic ignored "-Winconsistent-missing-override" +#endif #endif #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" diff --git a/rpcs3/Emu/Cell/PPCDisAsm.h b/rpcs3/Emu/Cell/PPCDisAsm.h index c712be4b10..52a45a7ae5 100644 --- a/rpcs3/Emu/Cell/PPCDisAsm.h +++ b/rpcs3/Emu/Cell/PPCDisAsm.h @@ -9,7 +9,7 @@ protected: { } - virtual u32 DisAsmBranchTarget(const s32 imm)=0; + virtual u32 DisAsmBranchTarget(const s32 imm) override = 0; void DisAsm_V4(const std::string& op, u32 v0, u32 v1, u32 v2, u32 v3) { diff --git a/rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp b/rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp index 203702f1ad..f10ad0c6ba 100644 --- a/rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp +++ b/rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp @@ -8,6 +8,10 @@ #pragma GCC diagnostic ignored "-Wall" #pragma GCC diagnostic ignored "-Wextra" #pragma GCC diagnostic ignored "-Wold-style-cast" +#pragma GCC diagnostic ignored "-Wsuggest-override" +#ifdef __clang__ +#pragma clang diagnostic ignored "-Winconsistent-missing-override" +#endif #endif #include "SPIRV/GlslangToSpv.h" #include "spirv-tools/optimizer.hpp" diff --git a/rpcs3/Emu/RSX/VK/VKMemAlloc.cpp b/rpcs3/Emu/RSX/VK/VKMemAlloc.cpp index 29134021ad..4b5386430f 100644 --- a/rpcs3/Emu/RSX/VK/VKMemAlloc.cpp +++ b/rpcs3/Emu/RSX/VK/VKMemAlloc.cpp @@ -43,6 +43,10 @@ private: #pragma GCC diagnostic ignored "-Wextra" #pragma GCC diagnostic ignored "-Wold-style-cast" #pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsuggest-override" +#ifdef __clang__ +#pragma clang diagnostic ignored "-Winconsistent-missing-override" +#endif #endif #include "3rdparty/GPUOpen/include/vk_mem_alloc.h" #ifdef _MSC_VER diff --git a/rpcs3/cmake_modules/ConfigureCompiler.cmake b/rpcs3/cmake_modules/ConfigureCompiler.cmake index 486eb4713a..d77f9bf073 100644 --- a/rpcs3/cmake_modules/ConfigureCompiler.cmake +++ b/rpcs3/cmake_modules/ConfigureCompiler.cmake @@ -33,6 +33,12 @@ else() add_compile_options(-Werror=return-type) add_compile_options(-Werror=overloaded-virtual) + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Werror=inconsistent-missing-override) + else() + add_compile_options(-Werror=suggest-override) + endif() + #TODO Clean the code so these are removed add_compile_options(-Wno-attributes) diff --git a/rpcs3/rpcs3qt/custom_table_widget_item.h b/rpcs3/rpcs3qt/custom_table_widget_item.h index f465fa908f..4dede4c910 100644 --- a/rpcs3/rpcs3qt/custom_table_widget_item.h +++ b/rpcs3/rpcs3qt/custom_table_widget_item.h @@ -14,7 +14,7 @@ public: custom_table_widget_item(const std::string& text, int sort_role = Qt::DisplayRole, const QVariant& sort_value = 0); custom_table_widget_item(const QString& text, int sort_role = Qt::DisplayRole, const QVariant& sort_value = 0); - bool operator<(const QTableWidgetItem& other) const; + bool operator<(const QTableWidgetItem& other) const override; void setData(int role, const QVariant& value, bool assign_sort_role); }; diff --git a/rpcs3/rpcs3qt/log_frame.cpp b/rpcs3/rpcs3qt/log_frame.cpp index 985fcece55..335775aed2 100644 --- a/rpcs3/rpcs3qt/log_frame.cpp +++ b/rpcs3/rpcs3qt/log_frame.cpp @@ -51,7 +51,7 @@ struct gui_listener : logs::listener { } - void log(u64 stamp, const logs::message& msg, const std::string& prefix, const std::string& text) + void log(u64 stamp, const logs::message& msg, const std::string& prefix, const std::string& text) override { Q_UNUSED(stamp);