Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-tidy: Apply fixes "google-readability-casting" #3034

Conversation

mspang
Copy link
Contributor

@mspang mspang commented Oct 3, 2020

Problem

C-style casts are obsolete in C++, may allow stronger cast than intended including losing const qualifiers.

Summary of Changes

Convert C style casts to C++ style casts.

@rwalker-apple
Copy link
Contributor

@rwalker-apple
Copy link
Contributor

@mspang conflicts

@mspang mspang force-pushed the for-chip/clang-tidy-google-readability-casting branch from 5a79320 to 8d7803f Compare October 6, 2020 00:55
@mspang mspang force-pushed the for-chip/clang-tidy-google-readability-casting branch from 8d7803f to f1ea14e Compare October 6, 2020 01:05
@mspang mspang merged commit 181f076 into project-chip:master Oct 6, 2020
mspang added a commit to mspang/connectedhomeip that referenced this pull request Oct 6, 2020
Many C style casts remain after 181f076 ("clang-tidy: Apply fixes
"google-readability-casting" (project-chip#3034)").

The reason they were not updated is typically because they are casting
away const qualifiers. Fix these cases or add a const_cast<> if
appropriate.
mspang added a commit to mspang/connectedhomeip that referenced this pull request Oct 6, 2020
Many C style casts remain after 181f076 ("clang-tidy: Apply fixes
"google-readability-casting" (project-chip#3034)").

The reason they were not updated is typically because they are casting
away const qualifiers. Fix these cases or add a const_cast<> if
appropriate.
@mspang mspang deleted the for-chip/clang-tidy-google-readability-casting branch October 7, 2020 05:18
bzbarsky-apple pushed a commit that referenced this pull request Oct 7, 2020
* Remove remaining Linux C-style casts & fix const correctness

Many C style casts remain after 181f076 ("clang-tidy: Apply fixes
"google-readability-casting" (#3034)").

The reason they were not updated is typically because they are casting
away const qualifiers. Fix these cases or add a const_cast<> if
appropriate.

* Write ReadN(T*&) in terms of ReadN(const T*&)

* Fix timer epochs

* Remove casts around inet_ntop

* Simplify casts around free

* Simplify IPAddress

* Remove casts around setsockopt

* Remove cast from Spake2p "G"

* Document cast around AES_CCM_decrypt

* Add back const_cast around inet_ntop

* Duplicate argv in TestCHIPArgParser

* Revert "Duplicate argv in TestCHIPArgParser"

This reverts commit ec2c119.

* Restyle

* Revert "Revert "Duplicate argv in TestCHIPArgParser""

This reverts commit 8defda3.

* restyle

* Add missing semicolon

* Fix v4 conversions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants