diff --git a/CMakeLists.txt b/CMakeLists.txt index b81d81565055d5d8e7a47fa65c28d5782b9b0522..54cae954b93e7e7211925b648da7169be5fae8e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,7 +125,7 @@ check_include_file_cxx("opencv2/cudastereo.hpp" HAVE_OPENCVCUDA) find_program(CPPCHECK_FOUND cppcheck) if (CPPCHECK_FOUND) message(STATUS "Found cppcheck: will perform source checks") - set(CMAKE_CXX_CPPCHECK "cppcheck" "--enable=style" "--suppress=*:*catch.hpp" "--suppress=*:*elas*" "--suppress=*:*json.hpp") + set(CMAKE_CXX_CPPCHECK "cppcheck" "--enable=warning,performance,portability,style" "--inline-suppr" "--std=c++11" "--suppress=*:*catch.hpp" "--suppress=*:*elas*" "--suppress=*:*json.hpp" "--quiet") endif() # include_directories(${PROJECT_SOURCE_DIR}/common/cpp/include) diff --git a/components/common/cpp/include/loguru.hpp b/components/common/cpp/include/loguru.hpp index 2bfe8e0e2e174b107fea79dd286be956adc00a82..ec3dc97461033ebaafb0c968dfd162ae76bf8e82 100644 --- a/components/common/cpp/include/loguru.hpp +++ b/components/common/cpp/include/loguru.hpp @@ -536,7 +536,7 @@ namespace loguru class LOGURU_EXPORT LogScopeRAII { public: - LogScopeRAII() : _file(nullptr) {} // No logging + LogScopeRAII() : _file(nullptr), _line(0), _indent_stderr(false), _start_time_ns(0), _name({}) {} // No logging LogScopeRAII(Verbosity verbosity, const char* file, unsigned line, LOGURU_FORMAT_STRING_TYPE format, ...) LOGURU_PRINTF_LIKE(5, 6); ~LogScopeRAII(); diff --git a/components/common/cpp/src/configuration.cpp b/components/common/cpp/src/configuration.cpp index 3f1bcd2133a497367b9dba9c0620e809308f0bcd..c4369bd0057488455e43770aa7772ff350b6f395 100644 --- a/components/common/cpp/src/configuration.cpp +++ b/components/common/cpp/src/configuration.cpp @@ -143,6 +143,7 @@ static bool mergeConfig(const string path) { } catch (...) { LOG(ERROR) << "Unknown error opening config file"; } + return false; } else { return false; } diff --git a/components/common/cpp/src/loguru.cpp b/components/common/cpp/src/loguru.cpp index 7e2c748ed6505c448aef18e7388013144172f67f..b481a411ef0ae05a23b66289abb4297138b994fd 100644 --- a/components/common/cpp/src/loguru.cpp +++ b/components/common/cpp/src/loguru.cpp @@ -510,6 +510,7 @@ namespace loguru Text errno_as_text() { + // cppcheck-suppress unusedVariable char buff[256]; #if defined(__GLIBC__) && defined(_GNU_SOURCE) // GNU Version @@ -1069,7 +1070,7 @@ namespace loguru i - skip, int(2 + sizeof(void*) * 2), callstack[i], status == 0 ? demangled : info.dli_sname == 0 ? symbols[i] : info.dli_sname, - static_cast<char*>(callstack[i]) - static_cast<char*>(info.dli_saddr)); + (ssize_t)(static_cast<char*>(callstack[i]) - static_cast<char*>(info.dli_saddr))); free(demangled); } else { snprintf(buf, sizeof(buf), "%-3d %*p %s\n", diff --git a/components/net/cpp/include/ftl/net/peer.hpp b/components/net/cpp/include/ftl/net/peer.hpp index 07cffaf51338c6b68a4e8105d33e9067ad7bc3ad..6d28d3b84d1c6a9c3861c09239c9e97ccf4dc995 100644 --- a/components/net/cpp/include/ftl/net/peer.hpp +++ b/components/net/cpp/include/ftl/net/peer.hpp @@ -269,6 +269,7 @@ R Peer::call(const std::string &name, ARGS... args) { template <typename T, typename... ARGS> int Peer::asyncCall( const std::string &name, + // cppcheck-suppress * std::function<void(const T&)> cb, ARGS... args) { auto args_obj = std::make_tuple(args...); diff --git a/components/net/cpp/test/peer_unit.cpp b/components/net/cpp/test/peer_unit.cpp index dd846a961ebd3817024db29c302b348f1ab9e8b3..d72d96791349818949b65eb2957f7cf3c41fbf70 100644 --- a/components/net/cpp/test/peer_unit.cpp +++ b/components/net/cpp/test/peer_unit.cpp @@ -238,8 +238,8 @@ TEST_CASE("Peer::call()", "[rpc]") { std::thread thr([&s]() { while (fakedata[0].size() == 0) std::this_thread::sleep_for(std::chrono::milliseconds(20)); - auto [id,value] = readRPC<tuple<>>(0); - auto res_obj = std::make_tuple(1,id,"__return__",77); + auto res = readRPC<tuple<>>(0); + auto res_obj = std::make_tuple(1,std::get<0>(res),"__return__",77); std::stringstream buf; msgpack::pack(buf, res_obj); fakedata[0] = buf.str(); @@ -263,9 +263,9 @@ TEST_CASE("Peer::call()", "[rpc]") { std::thread thr([&s]() { while (fakedata[0].size() == 0) std::this_thread::sleep_for(std::chrono::milliseconds(20)); - auto [id,value] = readRPC<tuple<>>(0); + auto res = readRPC<tuple<>>(0); vector<int> data = {44,55,66}; - auto res_obj = std::make_tuple(1,id,"__return__",data); + auto res_obj = std::make_tuple(1,std::get<0>(res),"__return__",data); std::stringstream buf; msgpack::pack(buf, res_obj); fakedata[0] = buf.str(); diff --git a/components/rgbd-sources/include/ftl/rgbd_source.hpp b/components/rgbd-sources/include/ftl/rgbd_source.hpp index e6ca35418f80368e5f62adc622203ce09d5962a6..aa5748324dc9aeddd1134556fb3153baf08c1915 100644 --- a/components/rgbd-sources/include/ftl/rgbd_source.hpp +++ b/components/rgbd-sources/include/ftl/rgbd_source.hpp @@ -19,7 +19,7 @@ namespace rgbd { */ class RGBDSource : public ftl::Configurable { public: - RGBDSource(nlohmann::json &config); + explicit RGBDSource(nlohmann::json &config); RGBDSource(nlohmann::json &config, ftl::net::Universe *net); virtual ~RGBDSource(); @@ -57,6 +57,7 @@ class RGBDSource : public ftl::Configurable { */ class Register { public: + // cppcheck-suppress * Register(const std::string &n, std::function<RGBDSource*(nlohmann::json&,ftl::net::Universe*)> f) { RGBDSource::_register(n,f); }; diff --git a/components/rgbd-sources/src/disparity.hpp b/components/rgbd-sources/src/disparity.hpp index c8e3636929f1aaa26c8310d0ca54b2339bc92151..cb25e28953bf8ac8455c5a0565fa639e61979196 100644 --- a/components/rgbd-sources/src/disparity.hpp +++ b/components/rgbd-sources/src/disparity.hpp @@ -37,6 +37,7 @@ class Disparity : public ftl::Configurable { */ class Register { public: + // cppcheck-suppress * Register(const std::string &n, std::function<Disparity*(ftl::Configurable *, const std::string &)> f) { Disparity::_register(n,f); };