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

enable two new clang-tidy checks #3988

Merged

Conversation

Skylion007
Copy link
Collaborator

Description

I enabled a few new clang-tidy checks to harden the code bases. First, misc-definition-in-headers complains about headers issues that are likely to cause ODR problems when included from multiple translation units. The main one is forgetting to ensure that functions are all inline in headers. The 2nd check tries to use modernized for each loops. Luckily, we were already using these in pybind11 except for one test case which has been fixed in this PR. Finally, I changed a default setting for inefficient-string-concatenation to strict mode. We are already following strict mode, so this mainly will just prevent new issues from cropping up.

Suggested changelog entry:

* Enables clang-tidy checks misc-definitions-in-headers and modernize-loop-convert.

@Skylion007 Skylion007 requested a review from henryiii as a code owner June 3, 2022 16:24
@Skylion007 Skylion007 requested a review from rwgk June 3, 2022 16:24
@Skylion007 Skylion007 merged commit 554c045 into pybind:master Jun 6, 2022
@Skylion007 Skylion007 deleted the skylion007/clang-tidy-loop-hdef branch June 6, 2022 16:15
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Jun 6, 2022
@henryiii henryiii removed the needs changelog Possibly needs a changelog entry label Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants