diff --git a/.clang-tidy b/.clang-tidy index aa9f598740..36ac3d6f91 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -15,7 +15,6 @@ Checks: > -cppcoreguidelines-no-malloc, -cppcoreguidelines-non-private-member-variables-in-classes, -cppcoreguidelines-owning-memory, - -cppcoreguidelines-pro-bounds-array-to-pointer-decay, -cppcoreguidelines-pro-bounds-pointer-arithmetic, -cppcoreguidelines-pro-type-const-cast, -cppcoreguidelines-pro-type-member-init, diff --git a/src/breadthFirstSearch/binaryBreadthFirstSearch_driver.cpp b/src/breadthFirstSearch/binaryBreadthFirstSearch_driver.cpp index 3377fa5343..7d2f294afb 100644 --- a/src/breadthFirstSearch/binaryBreadthFirstSearch_driver.cpp +++ b/src/breadthFirstSearch/binaryBreadthFirstSearch_driver.cpp @@ -144,8 +144,10 @@ pgr_do_binaryBreadthFirstSearch( std::ostringstream err; std::ostringstream notice; const char *hint = nullptr; - const char c_err_msg[] = "Graph Condition Failed: Graph should have at most two distinct non-negative edge costs! " - "If there are exactly two distinct edge costs, one of them must equal zero!"; + const std::string c_err_msg = + "Graph Condition Failed: Graph should have at most two distinct " + "non-negative edge costs! If there are exactly two distinct edge " + "costs, one of them must equal zero!"; try { pgassert(!(*log_msg)); diff --git a/src/common/assert.cpp b/src/common/assert.cpp index 98000e1c2b..58f229326d 100644 --- a/src/common/assert.cpp +++ b/src/common/assert.cpp @@ -38,7 +38,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. #include #include #include - +#include std::string get_backtrace() { #ifdef __GLIBC__ @@ -50,11 +50,14 @@ std::string get_backtrace() { char** funcNames = backtrace_symbols(trace.data(), trace_size); std::string message = "\n*** Execution path***\n"; - for (i = 0; i < trace_size; ++i) { - message += "[bt]" + static_cast(funcNames[i]) + "\n"; + if (funcNames == nullptr) { + message += "[bt] backtrace_symbols failed\n"; + } else { + for (i = 0; i < trace_size; ++i) { + message += "[bt]" + static_cast(funcNames[i]) + "\n"; + } + free(funcNames); } - - free(funcNames); return message; #else return "";