clang-tidy: check and fix cppcoreguidelines-pro-bounds-array-to-pointer-decay#3074
clang-tidy: check and fix cppcoreguidelines-pro-bounds-array-to-pointer-decay#3074prashsti29 wants to merge 10 commits intopgRouting:developfrom
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughEnabled the clang-tidy check cppcoreguidelines-pro-bounds-array-to-pointer-decay and updated source code to satisfy it: replaced a C-style string with Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip You can generate walkthrough in a markdown collapsible section to save space.Enable the |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/common/assert.cpp`:
- Around line 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.
|
You don't have your actions running |
cvvergara
left a comment
There was a problem hiding this comment.
I dont see your actions running
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.ci-trigger:
- Line 1: Remove the temporary CI trigger file named .ci-trigger from the
repository before merging; delete the file and any references to it (there are
no code symbols to change) so the commit does not include this workaround, and
rely on proper GitHub Actions workflow configuration or the workflow re-run
button instead.
.ci-trigger
Outdated
| @@ -0,0 +1 @@ | |||
| trigger CI | |||
There was a problem hiding this comment.
Remove this CI trigger file before merging.
This file appears to be a workaround to force GitHub Actions to run (per the maintainer's comment about actions not running). It serves no functional purpose in the repository and should be removed before merging to avoid permanent clutter.
Consider using GitHub's workflow re-run button or fixing the underlying CI trigger configuration instead.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.ci-trigger at line 1, Remove the temporary CI trigger file named
.ci-trigger from the repository before merging; delete the file and any
references to it (there are no code symbols to change) so the commit does not
include this workaround, and rely on proper GitHub Actions workflow
configuration or the workflow re-run button instead.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/common/assert.cpp (1)
38-48:⚠️ Potential issue | 🔴 CriticalMissing
#include <iterator>forstd::data()with raw arrays.
std::data()applied to a raw C-style array (void *trace[16]) requires the<iterator>header in C++17. Without it, the overloadtemplate<class T, std::size_t N> T* data(T (&)[N])is not declared and the code will fail to compile.Proposed fix
`#include` <string> `#include` <exception> +#include <iterator>🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/common/assert.cpp` around lines 38 - 48, The build fails because get_backtrace() uses std::data(trace) on a raw array but the <iterator> header (which defines std::data overloads for C-style arrays) is not included; fix by adding `#include` <iterator> at the top of the file so the std::data(trace) call inside get_backtrace() (and the backtrace/backtrace_symbols usage) compiles correctly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/common/assert.cpp`:
- Around line 38-48: The build fails because get_backtrace() uses
std::data(trace) on a raw array but the <iterator> header (which defines
std::data overloads for C-style arrays) is not included; fix by adding `#include`
<iterator> at the top of the file so the std::data(trace) call inside
get_backtrace() (and the backtrace/backtrace_symbols usage) compiles correctly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: eb5fa478-3759-4700-84b2-349173446893
📒 Files selected for processing (1)
src/common/assert.cpp
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/common/assert.cpp`:
- Around line 47-48: The call to backtrace_symbols can return nullptr and the
code unconditionally dereferences funcNames in the loop; update the
assert/reporting code that calls backtrace_symbols(std::data(trace), trace_size)
to check that funcNames is non-null before iterating or dereferencing it (e.g.,
if funcNames == nullptr, log a fallback message or skip symbol names), and
ensure you only call free(funcNames) when funcNames is non-null; reference the
backtrace_symbols result (funcNames), the trace_size value and the loop that
accesses funcNames[i] when making the guard.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 82159482-2d1d-4fb2-8a39-647e6158da33
📒 Files selected for processing (1)
src/common/assert.cpp
|
hi @cvvergara, could you kindly review this |
|
ping @cvvergara |
Summary:
cppcoreguidelines-pro-bounds-array-to-pointer-decayin.clang-tidy.Changes Made:
src/breadthFirstSearch/binaryBreadthFirstSearch_driver.cppby replacingconst char c_err_msg[]withconst std::string c_err_msg.src/common/assert.cppby adding an explicitstatic_cast<void**>when passingtrace[]tobacktrace()andbacktrace_symbols().Summary by CodeRabbit
Refactor
Chores