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

Some Cpp Core Guidelines warning fixes #2116

Merged

Conversation

AlexGuteniev
Copy link
Contributor

@AlexGuteniev AlexGuteniev commented Aug 12, 2021

  • The const variable '%1$s' can be computed at compile-time. Consider using constexpr (con.5).
  • Do not use function style C-casts (es.49).
  • Don't use reinterpret_cast. A cast from void* can use static_cast (type.1).

 * The const variable '%1$s' can be computed at compile-time. Consider using constexpr (con.5).
 * Do not use function style C-casts (es.49).
 * Don't use reinterpret_cast. A cast from void* can use static_cast (type.1).
stl/inc/chrono Outdated Show resolved Hide resolved
stl/inc/sstream Outdated Show resolved Hide resolved
stl/inc/memory_resource Outdated Show resolved Hide resolved
@CaseyCarter CaseyCarter added the test Related to test code label Aug 12, 2021
@CaseyCarter CaseyCarter linked an issue Aug 12, 2021 that may be closed by this pull request
@AlexGuteniev AlexGuteniev marked this pull request as ready for review August 13, 2021 10:19
@AlexGuteniev AlexGuteniev requested a review from a team as a code owner August 13, 2021 10:19
@AlexGuteniev

This comment was marked as resolved.

@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Aug 13, 2021
@StephanTLavavej StephanTLavavej self-assigned this Aug 18, 2021
@AlexGuteniev

This comment was marked as resolved.

@AlexGuteniev AlexGuteniev marked this pull request as draft November 16, 2021 19:04
Copy link
Member

@StephanTLavavej StephanTLavavej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AlexGuteniev We talked about this at the weekly maintainer meeting - we like the product code changes here, but we're very worried about false positives from the static analyzer which could block GitHub PRs; we've been dealing with such issues when internally mirroring PRs. We think it would be reasonable to not add test coverage here, but instead to add something to tools/scripts that can manually run CppCoreCheck over the STL. In the future, it may be desirable to add automated test coverage, but in the meantime a manual script would allow on-demand investigations.

@StephanTLavavej StephanTLavavej marked this pull request as ready for review March 29, 2023 20:37
@StephanTLavavej
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@StephanTLavavej StephanTLavavej removed the test Related to test code label Mar 29, 2023
@StephanTLavavej
Copy link
Member

I think for now we can (finally) land these product code changes, and consider a script to run CppCoreCheck in the future. Apologies for the delay here.

I pushed a merge with main (it had been ages but the only conflict was with nearby arrow comments) followed by dropping the test changes.

@StephanTLavavej
Copy link
Member

I'm speculatively mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit f6dadc0 into microsoft:main Mar 30, 2023
@StephanTLavavej
Copy link
Member

Thanks for fixing these warnings and improving the codebase! 🛠️ 😸 🎉

@AlexGuteniev AlexGuteniev deleted the some_cpp_core_guidelines_fixes branch March 31, 2023 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something can be improved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
  翻译: