Commit 6ba9c90f authored by Paul's avatar Paul
Browse files

Upgrade cppcheck version

parent 531ccec2
......@@ -22,16 +22,6 @@ add_compile_options(-std=c++14)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(EnableCompilerWarnings)
# Override clang-tidy to not find the version from hcc
# find_program(CLANG_TIDY_EXE
# NAMES
# clang-tidy
# clang-tidy-5.0
# clang-tidy-6.0
# clang-tidy-7.0
# PATHS
# /usr/local/opt/llvm/bin
# )
include(ROCMClangTidy)
rocm_enable_clang_tidy(
CHECKS
......@@ -88,7 +78,10 @@ rocm_enable_clang_tidy(
include(ROCMCppCheck)
rocm_enable_cppcheck(
CHECKS
all
warning
style
performance
portability
SUPPRESS
ConfigurationNotChecked
unmatchedSuppression
......
......@@ -2,7 +2,7 @@ pfultz2/rocm-recipes
danmar/cppcheck@399a90c00e6c37be195bb7155b8e2c84d51f40aa
ROCm-Developer-Tools/HIP@3a41f286203968421c557338d6fb39c36f3c717c
# Needed for clang-ocl
RadeonOpenCompute/rocm-cmake@38096ce --build
RadeonOpenCompute/rocm-cmake@3c3bd57 --build
RadeonOpenCompute/clang-ocl@a180592885ecae5b8beadf667c633c246cec82b6
# python/cpython@v3.6.6 -X autotools -H sha256:92aa914572c695c0aeb01b0a214813f414da4b51a371234df514a74761f2bb36
-f requirements.txt
......@@ -8,6 +8,8 @@
#include <iso646.h>
#endif
#include <migraph/requires.hpp>
namespace migraph {
template <class... Ts>
......@@ -15,7 +17,7 @@ using common_type = typename std::common_type<Ts...>::type;
struct float_equal_fn
{
template <class T>
template <class T, MIGRAPH_REQUIRES(std::is_floating_point<T>{})>
static bool apply(T x, T y)
{
return std::isfinite(x) and std::isfinite(y) and
......@@ -23,6 +25,12 @@ struct float_equal_fn
std::nextafter(x, std::numeric_limits<T>::max()) >= y;
}
template <class T, MIGRAPH_REQUIRES(not std::is_floating_point<T>{})>
static bool apply(T x, T y)
{
return x == y;
}
template <class T, class U>
bool operator()(T x, U y) const
{
......
......@@ -140,7 +140,7 @@ std::size_t mismatch_diff(R1&& r1, R2&& r2, T diff)
{
return mismatch_idx(r1, r2, [&](auto x, auto y) {
auto d = abs_diff(x, y);
return !(d > diff && d < diff);
return float_equal(d, diff);
});
}
......
......@@ -43,7 +43,9 @@ void operation_copy_test()
simple_operation s{};
migraph::operation op1 = s; // NOLINT
migraph::operation op2 = op1; // NOLINT
// cppcheck-suppress duplicateExpression
EXPECT(s.name() == op1.name());
// cppcheck-suppress duplicateExpression
EXPECT(op2.name() == op1.name());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment