Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,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,
Expand Down
2 changes: 1 addition & 1 deletion src/breadthFirstSearch/binaryBreadthFirstSearch_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ 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! "
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 {
Expand Down
4 changes: 2 additions & 2 deletions src/common/assert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ std::string get_backtrace() {
void *trace[16];
int i = 0, trace_size = 0;

trace_size = backtrace(trace, 16);
char** funcNames = backtrace_symbols(trace, trace_size);
trace_size = backtrace(static_cast<void**>(trace), 16);
char** funcNames = backtrace_symbols(static_cast<void**>(trace), trace_size);
Comment on lines +47 to +48
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Consider std::data(trace) as a cleaner alternative to static_cast<void**>(trace).

An LLVM bug report on the same backtrace_symbols pattern confirms that static_cast<void**> resolves the array-to-pointer decay warning, so the fix is correct. However, the idiomatic C++17 way to explicitly obtain a pointer to an array's first element without a cast is std::data():

♻️ Optional refactor using `std::data()`
-        trace_size = backtrace(static_cast<void**>(trace), 16);
-        char** funcNames = backtrace_symbols(static_cast<void**>(trace), trace_size);
+        trace_size = backtrace(std::data(trace), 16);
+        char** funcNames = backtrace_symbols(std::data(trace), trace_size);

Both approaches silence the clang-tidy check because the check was patched to not flag explicit casts. The std::data() form expresses the intent (pointer to the first element) more directly than a static_cast.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
trace_size = backtrace(static_cast<void**>(trace), 16);
char** funcNames = backtrace_symbols(static_cast<void**>(trace), trace_size);
trace_size = backtrace(std::data(trace), 16);
char** funcNames = backtrace_symbols(std::data(trace), trace_size);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/common/assert.cpp` around lines 47 - 48, Replace the explicit
static_cast<void**>(trace) uses with the C++17 idiomatic std::data(trace) when
calling backtrace and backtrace_symbols: update the calls that reference trace
(trace_size/backtrace/backtrace_symbols) to pass std::data(trace) instead of
static_cast, and add the proper include for std::data (e.g., `#include`
<iterator>) so the code compiles.



std::string message = "\n*** Execution path***\n";
Expand Down