diff --git a/CMakeLists.txt b/CMakeLists.txt index 33d2d835..185e3fe5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -360,7 +360,7 @@ if(ENABLE_CPP_CORE_GUIDELINES_CHECK) message(WARNING "clang-tidy not found.") else() message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}") - set(DO_CLANG_TIDY "${CLANG_TIDY_EXE}" "-checks=*,-clang-analyzer-alpha.*,-*braces-around-statements,-fuchsia-default-arguments") + set(DO_CLANG_TIDY "${CLANG_TIDY_EXE}" "-warnings-as-errors=*" "-header-filter=libsrc/core/") endif() endif(ENABLE_CPP_CORE_GUIDELINES_CHECK) diff --git a/libsrc/core/.clang-tidy b/libsrc/core/.clang-tidy new file mode 100644 index 00000000..c299ae90 --- /dev/null +++ b/libsrc/core/.clang-tidy @@ -0,0 +1,4 @@ +Checks: '*,-clang-analyzer-alpha.*,-*braces-around-statements,-fuchsia-*,-google-runtime-references,-readability-implicit-bool-conversion' +CheckOptions: + - key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor + value: 1 \ No newline at end of file diff --git a/libsrc/core/archive.hpp b/libsrc/core/archive.hpp index 89656ad5..66589d90 100644 --- a/libsrc/core/archive.hpp +++ b/libsrc/core/archive.hpp @@ -3,8 +3,8 @@ #include #include -#include #include +#include #include #include #include @@ -25,12 +25,12 @@ namespace ngcore NGCORE_API std::string demangle(const char* typeinfo); // create new pointer of type T if it is default constructible, else throw - template - T* constructIfPossible_impl(...) + template + T* constructIfPossible_impl(Rest... /*unused*/) { throw std::runtime_error(std::string(demangle(typeid(T).name())) + " is not default constructible!"); } template::value>::type> - T* constructIfPossible_impl(int) { return new T; } + T* constructIfPossible_impl(int /*unused*/) { return new T; } template T* constructIfPossible() { return constructIfPossible_impl(int{}); } @@ -45,7 +45,7 @@ namespace ngcore typename std::is_same().DoArchive(std::declval())),void>::type; template static constexpr std::false_type check(...); - typedef decltype(check(0)) type; + using type = decltype(check(nullptr)); public: NGCORE_API static constexpr bool value = type::value; }; @@ -60,7 +60,7 @@ namespace ngcore typename std::is_same() & std::declval()),Archive&>::type; template static constexpr std::false_type check(...); - typedef decltype(check(nullptr)) type; + using type = decltype(check(nullptr)); public: NGCORE_API static constexpr bool value = type::value; }; @@ -107,7 +107,8 @@ namespace ngcore static void SetArchiveRegister(const std::string& classname, const ClassArchiveInfo& info); static bool IsRegistered(const std::string& classname); public: - Archive (bool ais_output) : is_output(ais_output), shared_ptr_count(0), ptr_count(0) { ; } + Archive (bool ais_output) : is_output(ais_output), shared_ptr_count(0), ptr_count(0) + shared_ptr2nr(), ptr2nr(), nr2shared_ptr(), nr2prt() { ; } virtual ~Archive() { ; } bool Output () { return is_output; } diff --git a/libsrc/core/version.hpp b/libsrc/core/version.hpp index f46e74af..5ffa8bb0 100644 --- a/libsrc/core/version.hpp +++ b/libsrc/core/version.hpp @@ -53,16 +53,16 @@ namespace ngcore std::string to_string() const { std::string vstring = "v" + std::to_string(mayor_); - if(minor_ || release || patch || git_hash.size()) + if(minor_ || release || patch || !git_hash.empty()) { vstring += "." + std::to_string(minor_); - if(release || patch || git_hash.size()) + if(release || patch || !git_hash.empty()) { vstring += "." + std::to_string(release); - if(patch || git_hash.size()) + if(patch || !git_hash.empty()) { vstring += "-" + std::to_string(patch); - if(git_hash.size()) + if(!git_hash.empty()) vstring += "-" + git_hash; } }