From 614a636ed5eea1aa1b3bc63bc492678afbbd2229 Mon Sep 17 00:00:00 2001 From: asarium Date: Sat, 6 Jun 2020 10:50:17 +0200 Subject: [PATCH] Fix clang-tidy issues Not sure why travis saw these since I didn't change anything there but fixing these is also good. --- code/cfile/cfile.h | 5 +++-- code/executor/IExecutionContext.cpp | 3 ++- code/executor/IExecutionContext.h | 3 ++- code/graphics/opengl/gropenglshader.cpp | 1 + code/libs/ffmpeg/FFmpeg.h | 2 +- code/parse/parselo.h | 2 +- code/pngutils/pngutils.h | 2 +- code/scripting/api/libs/mission.cpp | 2 +- code/scripting/api/objs/executor.cpp | 4 ++-- code/scripting/lua/LuaArgs.h | 3 +-- code/utils/boost/syncboundedqueue.h | 2 +- 11 files changed, 16 insertions(+), 13 deletions(-) diff --git a/code/cfile/cfile.h b/code/cfile/cfile.h index 0b748c76e7..b1148359fc 100644 --- a/code/cfile/cfile.h +++ b/code/cfile/cfile.h @@ -18,6 +18,7 @@ #include #include #include +#include #define CF_EOF (-1) @@ -437,11 +438,11 @@ namespace cfile { } - explicit cfile_error(const std::string &excuse) : m_excuse(excuse) + explicit cfile_error(std::string excuse) : m_excuse(std::move(excuse)) { } - ~cfile_error() noexcept override {} + ~cfile_error() noexcept override = default; const char *what() const noexcept override { return m_excuse.c_str(); diff --git a/code/executor/IExecutionContext.cpp b/code/executor/IExecutionContext.cpp index feea30fe5f..5073c2c73a 100644 --- a/code/executor/IExecutionContext.cpp +++ b/code/executor/IExecutionContext.cpp @@ -2,7 +2,8 @@ namespace executor { -Executor::Callback runInContext(std::shared_ptr context, IExecutionContext::Callback func) +Executor::Callback runInContext(const std::shared_ptr& context, + const IExecutionContext::Callback& func) { return [context, func]() { const auto ctxState = context->determineContextState(); diff --git a/code/executor/IExecutionContext.h b/code/executor/IExecutionContext.h index a4966c4a08..4ac28f2ebe 100644 --- a/code/executor/IExecutionContext.h +++ b/code/executor/IExecutionContext.h @@ -41,6 +41,7 @@ class IExecutionContext { * @param func The function to wrap * @return An executor work item */ -Executor::Callback runInContext(std::shared_ptr context, IExecutionContext::Callback func); +Executor::Callback runInContext(const std::shared_ptr& context, + const IExecutionContext::Callback& func); } // namespace executor diff --git a/code/graphics/opengl/gropenglshader.cpp b/code/graphics/opengl/gropenglshader.cpp index b04bcad7c5..740a7cdbbc 100644 --- a/code/graphics/opengl/gropenglshader.cpp +++ b/code/graphics/opengl/gropenglshader.cpp @@ -233,6 +233,7 @@ opengl_shader_t::opengl_shader_t() : shader(SDR_TYPE_NONE), flags(0), flags2(0) opengl_shader_t::opengl_shader_t(opengl_shader_t&& other) noexcept { *this = std::move(other); } +// NOLINTNEXTLINE(misc-unconventional-assign-operator) opengl_shader_t& opengl_shader_t::operator=(opengl_shader_t&& other) noexcept { // VS2013 doesn't support implicit move constructors so we need to explicitly declare it shader = other.shader; diff --git a/code/libs/ffmpeg/FFmpeg.h b/code/libs/ffmpeg/FFmpeg.h index 680ce25165..a9934d29d3 100644 --- a/code/libs/ffmpeg/FFmpeg.h +++ b/code/libs/ffmpeg/FFmpeg.h @@ -14,7 +14,7 @@ void initialize(); class FFmpegException: public std::runtime_error { public: explicit FFmpegException(const std::string& msg) : std::runtime_error(msg) {} - ~FFmpegException() noexcept override {} + ~FFmpegException() noexcept override = default; }; } diff --git a/code/parse/parselo.h b/code/parse/parselo.h index 32068ac5cd..d863fe7563 100644 --- a/code/parse/parselo.h +++ b/code/parse/parselo.h @@ -352,7 +352,7 @@ namespace parse { public: explicit ParseException(const std::string& msg) : std::runtime_error(msg) {} - ~ParseException() noexcept override {} + ~ParseException() noexcept override = default; }; /** diff --git a/code/pngutils/pngutils.h b/code/pngutils/pngutils.h index a9ff344415..6ce76a6a05 100644 --- a/code/pngutils/pngutils.h +++ b/code/pngutils/pngutils.h @@ -94,7 +94,7 @@ class ApngException : public std::runtime_error { public: explicit ApngException(const std::string& msg) : std::runtime_error(msg) {} - ~ApngException() noexcept override {} + ~ApngException() noexcept override = default; }; } diff --git a/code/scripting/api/libs/mission.cpp b/code/scripting/api/libs/mission.cpp index 2acf996d9c..fe6c81baec 100644 --- a/code/scripting/api/libs/mission.cpp +++ b/code/scripting/api/libs/mission.cpp @@ -829,7 +829,7 @@ ADE_FUNC(createShip, { const char* name = nullptr; int sclass = -1; - matrix_h* orient = NULL; + matrix_h* orient = nullptr; vec3d pos = vmd_zero_vector; ade_get_args(L, "|sooo", &name, l_Shipclass.Get(&sclass), l_Matrix.GetPtr(&orient), l_Vector.Get(&pos)); diff --git a/code/scripting/api/objs/executor.cpp b/code/scripting/api/objs/executor.cpp index d48800998f..c74d161aa3 100644 --- a/code/scripting/api/objs/executor.cpp +++ b/code/scripting/api/objs/executor.cpp @@ -40,8 +40,8 @@ ADE_FUNC(schedule, } // Post the function onto the executor with a wrapper to convert the Lua value to the proper enum - executor->getExecutor()->post([func]() { - const auto ret = func(); + executor->getExecutor()->post([L, func]() { + const auto ret = func(L); if (ret.empty()) { return executor::Executor::CallbackResult::Done; diff --git a/code/scripting/lua/LuaArgs.h b/code/scripting/lua/LuaArgs.h index 3e60e12803..47b7e2f327 100644 --- a/code/scripting/lua/LuaArgs.h +++ b/code/scripting/lua/LuaArgs.h @@ -17,8 +17,7 @@ class ArgumentException: public LuaException { ArgumentException(const std::string& message = "Argument Error!") noexcept : LuaException(message) { } - ~ArgumentException() noexcept override { - } + ~ArgumentException() noexcept override = default; }; class opt {}; diff --git a/code/utils/boost/syncboundedqueue.h b/code/utils/boost/syncboundedqueue.h index 9ca2c99b78..a3472f3702 100644 --- a/code/utils/boost/syncboundedqueue.h +++ b/code/utils/boost/syncboundedqueue.h @@ -33,7 +33,7 @@ class sync_queue_is_closed : public std::runtime_error { public: sync_queue_is_closed() : std::runtime_error("Sync Bounded Queue is closed") {} - ~sync_queue_is_closed() noexcept override {} + ~sync_queue_is_closed() noexcept override = default; }; template