From ba450ecd22d4a50b23f4e35b9bbcca2c1cf01179 Mon Sep 17 00:00:00 2001 From: Timm Fitschen <t.fitschen@indiscale.com> Date: Thu, 23 Jun 2022 00:51:45 +0200 Subject: [PATCH] please clang-tidy --- CMakeLists.txt | 2 +- include/caosdb/utility.h | 4 ++-- src/caosdb/configuration.cpp | 3 ++- src/caosdb/utility.cpp | 8 +++----- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 09d03a7..84738ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -323,7 +323,7 @@ if(_LINTING) else() message(STATUS "clang-tidy: ${clang_tidy}") set(_CMAKE_CXX_CLANG_TIDY_CHECKS - "--checks=*,-fuchsia-*,-llvmlibc-*,-readability-convert-member-functions-to-static,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-hicpp-no-array-decay,-llvm-else-after-return,-readability-else-after-return,-modernize-use-trailing-return-type,-bugprone-branch-clone,-altera-*,-cppcoreguidelines-macro-usage,-*-avoid-c-arrays") + "--checks=*,-fuchsia-*,-llvmlibc-*,-readability-convert-member-functions-to-static,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-hicpp-no-array-decay,-llvm-else-after-return,-readability-else-after-return,-modernize-use-trailing-return-type,-bugprone-branch-clone,-altera-*,-cppcoreguidelines-macro-usage,-*-avoid-c-arrays,-cppcoreguidelines-owning-memory") set(_CMAKE_C_CLANG_TIDY_CHECKS "${_CMAKE_CXX_CLANG_TIDY_CHECKS}") set(_CMAKE_CXX_CLANG_TIDY "${clang_tidy}" "--header-filter=caosdb/.*[^\(\.pb\.h\)]$" diff --git a/include/caosdb/utility.h b/include/caosdb/utility.h index d7497e4..43fbf82 100644 --- a/include/caosdb/utility.h +++ b/include/caosdb/utility.h @@ -137,14 +137,14 @@ public: * * Also moves the `wrapped` object. */ - JsonValue(JsonValue &&other); + JsonValue(JsonValue &&other) noexcept ; /** * Move Assigment. * * Also moves the `wrapped` object. */ - auto operator=(JsonValue &&other) -> JsonValue &; + auto operator=(JsonValue &&other) noexcept -> JsonValue &; /** * Return true if the `wrapped` object is the nullptr. diff --git a/src/caosdb/configuration.cpp b/src/caosdb/configuration.cpp index a9699cc..5d1874a 100644 --- a/src/caosdb/configuration.cpp +++ b/src/caosdb/configuration.cpp @@ -479,7 +479,8 @@ auto ConfigurationManager::InitializeDefaults() -> int { // NOLINT "We are using the default configuration"; } - if (configuration_file_path != nullptr && !this->json_configuration.IsNull() && WRAPPED_JSON_CONFIGURATION(this)->is_object()) { + if (configuration_file_path != nullptr && !this->json_configuration.IsNull() && + WRAPPED_JSON_CONFIGURATION(this)->is_object()) { CAOSDB_LOG_INFO(logger_name) << "Loaded configuration from " << *(configuration_file_path) << "."; } diff --git a/src/caosdb/utility.cpp b/src/caosdb/utility.cpp index 1329dca..8617138 100644 --- a/src/caosdb/utility.cpp +++ b/src/caosdb/utility.cpp @@ -147,7 +147,7 @@ auto load_json_file(const path &json_file) -> JsonValue { JsonValue::~JsonValue() { this->Reset(); } auto JsonValue::Reset() -> void { - void *tmp = std::move(this->wrapped); + void *tmp = this->wrapped; this->wrapped = nullptr; if (tmp != nullptr) { delete static_cast<value *>(tmp); @@ -170,16 +170,14 @@ auto JsonValue::operator=(const JsonValue &other) -> JsonValue & { return *this; } -JsonValue::JsonValue(JsonValue &&other) : wrapped(nullptr) { - std::cout << "MoveConstructor" << std::endl; +JsonValue::JsonValue(JsonValue &&other) noexcept : wrapped(nullptr) { if (!other.IsNull()) { this->wrapped = other.wrapped; other.wrapped = nullptr; } } -auto JsonValue::operator=(JsonValue &&other) -> JsonValue & { - std::cout << "MoveAssignment" << std::endl; +auto JsonValue::operator=(JsonValue &&other) noexcept -> JsonValue & { if (this != &other) { this->wrapped = other.wrapped; other.wrapped = nullptr; -- GitLab