mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-26 05:50:32 +05:00
clang-tidy warnings as errors
This commit is contained in:
parent
17aba88117
commit
6f808cb40f
@ -360,7 +360,7 @@ if(ENABLE_CPP_CORE_GUIDELINES_CHECK)
|
|||||||
message(WARNING "clang-tidy not found.")
|
message(WARNING "clang-tidy not found.")
|
||||||
else()
|
else()
|
||||||
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}")
|
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()
|
||||||
endif(ENABLE_CPP_CORE_GUIDELINES_CHECK)
|
endif(ENABLE_CPP_CORE_GUIDELINES_CHECK)
|
||||||
|
|
||||||
|
4
libsrc/core/.clang-tidy
Normal file
4
libsrc/core/.clang-tidy
Normal file
@ -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
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
#include <complex>
|
#include <complex>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <functional>
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <functional>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -25,12 +25,12 @@ namespace ngcore
|
|||||||
NGCORE_API std::string demangle(const char* typeinfo);
|
NGCORE_API std::string demangle(const char* typeinfo);
|
||||||
|
|
||||||
// create new pointer of type T if it is default constructible, else throw
|
// create new pointer of type T if it is default constructible, else throw
|
||||||
template<typename T>
|
template<typename T, typename ...Rest>
|
||||||
T* constructIfPossible_impl(...)
|
T* constructIfPossible_impl(Rest... /*unused*/)
|
||||||
{ throw std::runtime_error(std::string(demangle(typeid(T).name())) + " is not default constructible!"); }
|
{ throw std::runtime_error(std::string(demangle(typeid(T).name())) + " is not default constructible!"); }
|
||||||
|
|
||||||
template<typename T, typename= typename std::enable_if<std::is_constructible<T>::value>::type>
|
template<typename T, typename= typename std::enable_if<std::is_constructible<T>::value>::type>
|
||||||
T* constructIfPossible_impl(int) { return new T; }
|
T* constructIfPossible_impl(int /*unused*/) { return new T; }
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T* constructIfPossible() { return constructIfPossible_impl<T>(int{}); }
|
T* constructIfPossible() { return constructIfPossible_impl<T>(int{}); }
|
||||||
@ -45,7 +45,7 @@ namespace ngcore
|
|||||||
typename std::is_same<decltype(std::declval<T2>().DoArchive(std::declval<Archive&>())),void>::type;
|
typename std::is_same<decltype(std::declval<T2>().DoArchive(std::declval<Archive&>())),void>::type;
|
||||||
template<typename>
|
template<typename>
|
||||||
static constexpr std::false_type check(...);
|
static constexpr std::false_type check(...);
|
||||||
typedef decltype(check<T>(0)) type;
|
using type = decltype(check<T>(nullptr));
|
||||||
public:
|
public:
|
||||||
NGCORE_API static constexpr bool value = type::value;
|
NGCORE_API static constexpr bool value = type::value;
|
||||||
};
|
};
|
||||||
@ -60,7 +60,7 @@ namespace ngcore
|
|||||||
typename std::is_same<decltype(std::declval<Archive>() & std::declval<T2&>()),Archive&>::type;
|
typename std::is_same<decltype(std::declval<Archive>() & std::declval<T2&>()),Archive&>::type;
|
||||||
template<typename>
|
template<typename>
|
||||||
static constexpr std::false_type check(...);
|
static constexpr std::false_type check(...);
|
||||||
typedef decltype(check<T>(nullptr)) type;
|
using type = decltype(check<T>(nullptr));
|
||||||
public:
|
public:
|
||||||
NGCORE_API static constexpr bool value = type::value;
|
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 void SetArchiveRegister(const std::string& classname, const ClassArchiveInfo& info);
|
||||||
static bool IsRegistered(const std::string& classname);
|
static bool IsRegistered(const std::string& classname);
|
||||||
public:
|
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() { ; }
|
virtual ~Archive() { ; }
|
||||||
|
|
||||||
bool Output () { return is_output; }
|
bool Output () { return is_output; }
|
||||||
|
@ -53,16 +53,16 @@ namespace ngcore
|
|||||||
|
|
||||||
std::string to_string() const
|
std::string to_string() const
|
||||||
{ std::string vstring = "v" + std::to_string(mayor_);
|
{ 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_);
|
vstring += "." + std::to_string(minor_);
|
||||||
if(release || patch || git_hash.size())
|
if(release || patch || !git_hash.empty())
|
||||||
{
|
{
|
||||||
vstring += "." + std::to_string(release);
|
vstring += "." + std::to_string(release);
|
||||||
if(patch || git_hash.size())
|
if(patch || !git_hash.empty())
|
||||||
{
|
{
|
||||||
vstring += "-" + std::to_string(patch);
|
vstring += "-" + std::to_string(patch);
|
||||||
if(git_hash.size())
|
if(!git_hash.empty())
|
||||||
vstring += "-" + git_hash;
|
vstring += "-" + git_hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user