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

Crank up static analysis audit #2607

Merged
merged 56 commits into from
Sep 10, 2019
Merged

Crank up static analysis audit #2607

merged 56 commits into from
Sep 10, 2019

Conversation

miniksa
Copy link
Member

@miniksa miniksa commented Aug 29, 2019

Summary of the Pull Request

Brings audit mode up to full warning speed and fixes relevant errors in the four active projects.

PR Checklist

  • Closes #xxx
  • I'm an employee
  • Tests added/passed - This is a test of sorts
  • Requires documentation to be updated - Yes, should probably mention audits somewhere in docs.
  • I'm a core contributor

Detailed Description of the Pull Request / Additional comments

{
_RedrawCursor();
_cPosition.X = (SHORT)NewX;
_cPosition.X = gsl::narrow<SHORT>(NewX);
Copy link
Contributor

Choose a reason for hiding this comment

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

this is marked noexcept but i thought narrow was the throwing one

Copy link
Member Author

Choose a reason for hiding this comment

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

Urgh, it's actually weird and I should probably undo the one I just did earlier. gsl::narrow would have been detected by the static analysis as throwing and it would have errored out if it was a problem.

The trick is that I believe the implementation of narrow causes a Fail Fast and isn't actually throwing anything. Since that's not going to come back or in any way continue, it isn't technically violating the noexcept marking...

{
return static_cast<UINT>(_storage.size());
return gsl::narrow<UINT>(_storage.size());
Copy link
Contributor

Choose a reason for hiding this comment

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

(same as above)

// Routine Description:
// - Constructs an instance of the CodepointWidthDetector class
CodepointWidthDetector::CodepointWidthDetector() noexcept :
_fallbackCache{},
Copy link
Contributor

Choose a reason for hiding this comment

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

both of these should automatically get default-constructed for us, and we should be able to default our constructor.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I did that and it carped so I did this.

src/types/ScreenInfoUiaProviderBase.cpp Outdated Show resolved Hide resolved
src/types/ScreenInfoUiaProviderBase.cpp Outdated Show resolved Hide resolved
src/types/inc/CodepointWidthDetector.hpp Show resolved Hide resolved
src/types/inc/utils.hpp Show resolved Hide resolved
Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

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

Yea this seems good to me. I have some minor notes, feel free to fix if you want.

src/buffer/out/OutputCell.cpp Outdated Show resolved Hide resolved
src/buffer/out/textBuffer.cpp Show resolved Hide resolved
src/renderer/dx/CustomTextRenderer.cpp Show resolved Hide resolved
src/types/convert.cpp Outdated Show resolved Hide resolved
src/renderer/dx/DxRenderer.cpp Outdated Show resolved Hide resolved
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.

5 participants