[CODE HEALTH] fix clang-tidy cppcoreguidelines-pro-type-const-cast warnings - #4482
Conversation
Signed-off-by: Anish701 <anish2sinha@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4482 +/- ##
==========================================
- Coverage 83.25% 83.24% -0.01%
==========================================
Files 521 521
Lines 20381 20379 -2
==========================================
- Hits 16966 16962 -4
- Misses 3415 3417 +2
🚀 New features to boost your workflow:
|
Signed-off-by: Anish701 <anish2sinha@gmail.com>
|
Thanks for the cleanup patch.
I don't think this is the proper fix, and it is a breaking change to the API: what if an existing application invokes opentelemetry with a const pointer today ? Please avoid changing this area, in favor of #4499 which is a different fix. |
marcalff
left a comment
There was a problem hiding this comment.
Thanks for the patch.
Please revert changes related to metrics instruments, to be fixed separately.
Please revert changes related to CURL blob parameters, and silence the warning instead.
Everything else looks ok.
Signed-off-by: Anish701 <anish2sinha@gmail.com>
@marcalff Thanks for reviewing! I reverted the metrics related changes. I also reverted the changes to the CURL blob params and silenced the warnings with Please let me know if any other changes are needed. Thanks! |
marcalff
left a comment
There was a problem hiding this comment.
LGTM, thanks for the cleanup.
dbarker
left a comment
There was a problem hiding this comment.
Thanks for the fixes. Please update the warning limits in the CI workflow to subtract the 10 fixed const-cast warnings.
See .github/workflows/clang-tidy.yaml#L20
@dbarker Sounds good. I subtracted 10 from both abiv1 and abiv2 warning limits |
Signed-off-by: Anish701 <anish2sinha@gmail.com>
Signed-off-by: Anish701 <anish2sinha@gmail.com>
Fixes #4477
Changes
Resolves all
cppcoreguidelines-pro-type-const-castwarnings by eliminatingconst_castusage through proper typing .examples/http: Accept const T& in HttpTextMapCarrier constructor, removing the need to const_cast request headers.ext/http/client/curl: Change SetCurlPtrOption to accept const void*, and silenceconst_castwarning for string data.ext/test/w3c_tracecontext_http_test_server: Copy headers by value instead of const_casting a reference.sdk/common/circular_buffer.h: Make PeekImpl() a const method, eliminating the const_cast<CircularBuffer*>(this) in Peek().CHANGELOG.mdupdated for non-trivial changes - N/A this is a trivial code health change