[CODE HEALTH] fix clang-tidy cppcoreguidelines-pro-type-const-cast warnings - #4482
Open
Anish701 wants to merge 5 commits into
Open
[CODE HEALTH] fix clang-tidy cppcoreguidelines-pro-type-const-cast warnings#4482Anish701 wants to merge 5 commits into
Anish701 wants to merge 5 commits into
Conversation
Signed-off-by: Anish701 <anish2sinha@gmail.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4482 +/- ##
==========================================
- Coverage 83.12% 83.11% -0.00%
==========================================
Files 519 519
Lines 20256 20254 -2
==========================================
- Hits 16835 16832 -3
- Misses 3421 3422 +1
🚀 New features to boost your workflow:
|
Signed-off-by: Anish701 <anish2sinha@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4477
Changes
Resolves all
cppcoreguidelines-pro-type-const-castwarnings by eliminatingconst_castusage through proper typing.Note: The methods
MultiObserverResult::ForInstrumentandMultiObserverResult::HasInstrumenthave their parameters changed fromconst ObservableInstrument*toObservableInstrument*. The previous const qualifier was misleading because there was a const_cast on the pointer. Also, all existing callers already pass non-const pointers. This is not a breaking change to the API. All unit tests pass successfully.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 use mutable std::vector copies for blob data instead of const_cast from 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().sdk/metrics/multi_observer_result: Change ForInstrumentDouble, ForInstrumentInt64, and HasInstrument to accept ObservableInstrument* (non-const) since the internal map key is non-const. This is an API signature change because the previous const parameter was misleading as mentioned in the note above.CHANGELOG.mdupdated for non-trivial changes - N/A this is a trivial code health change