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

src: fix warnings in aliased_buffer #19665

Merged
merged 0 commits into from
Mar 31, 2018
Merged

Conversation

kfarnung
Copy link
Contributor

@kfarnung kfarnung commented Mar 28, 2018

  • Unary minus usages on unsigned type
  • Implicit casts to/from input parameters

I removed the template parameters from the operator overloads to push the burden of casting out of aliased buffer. It now expects the correct type to be passed to it and will generate warnings at the site rather than in the AliasedBuffer code.

EDIT: These warnings were generated by the VC++ compiler.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@kfarnung kfarnung self-assigned this Mar 28, 2018
@kfarnung kfarnung requested a review from addaleax March 28, 2018 22:25
@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Mar 28, 2018
@kfarnung
Copy link
Contributor Author

/cc @mike-kaufman FYI

@kfarnung
Copy link
Contributor Author

inline Reference& operator-=(const NativeT& val) {
const NativeT current = aliased_buffer_->GetValue(index_);
aliased_buffer_->SetValue(index_, current - val);
return *this;
Copy link
Member

Choose a reason for hiding this comment

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

Just curious, was this causing real issues? Unary minus on unsigned values should not really be an issue afaik, although I agree that being explicit is probably a good idea?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No functional issue, I was just seeing a warning in VC++ and looking at the code it's not clear what the behavior is when values are unsigned. Looking around it appears to be speced behavior, but still didn't feel intuitive.

@kfarnung
Copy link
Contributor Author

@kfarnung
Copy link
Contributor Author

@kfarnung
Copy link
Contributor Author

One more CI: https://ci.nodejs.org/job/node-test-pull-request/13951/

If there are no objections I plan to land this today.

@kfarnung
Copy link
Contributor Author

@kfarnung kfarnung closed this Mar 31, 2018
@kfarnung kfarnung merged commit 0d64f33 into nodejs:master Mar 31, 2018
@kfarnung
Copy link
Contributor Author

Landed in 0d64f33

@kfarnung kfarnung deleted the ab_warnings branch March 31, 2018 06:25
targos pushed a commit that referenced this pull request Apr 2, 2018
* Unary minus usages on unsigned type
* Implicit casts to/from input parameters

PR-URL: #19665
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
Reviewed-By: Khaidi Chu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
@targos targos mentioned this pull request Apr 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants