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: use hex not decimal in IsArrayIndex #31758

Closed
wants to merge 1 commit into from

Conversation

codebytere
Copy link
Member

In Electron, clang enforces -Wxor-used-as-pow, so the previous line would cause the following error:

../../third_party/electron_node/src/module_wrap.cc:926:34: error: result of '2 ^ 32' is 34; did you mean '1LL << 32'? [-Werror,-Wxor-used-as-pow]
  return n_dbl > 0 && n_dbl < (2 ^ 32) - 1;
                               ~~^~~~

The simplest solution i see is to just use hex to clarify intent for the compiler, and so this PR does so.

cc @guybedford

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

@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Feb 12, 2020
@guybedford
Copy link
Contributor

@codebytere thanks for the PR, and apologies for the compiler issue!

This is actually a completely daft bug, which I included a fix for, rolled into the PR at https://github.com/nodejs/node/pull/31625/files#diff-4a5950be44f56dfca2e7fa3c4e1fc0e4R966, although that PR with the current approval will take another 5 days to land unless we get another approval there.

If that is the case, and you need this sooner, it may well be better to just port that fix here.

@addaleax
Copy link
Member

Yeah, I think the compiler is correct to warn here, and we should use its suggestion rather than just make the warning go away :)

@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

Since this would be ready to land now, I’ll make it explicit that the previous code was buggy and we should not remove the warning about the bug (and rather fix it)

src/module_wrap.cc Outdated Show resolved Hide resolved
Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

Thanks!

@nodejs-github-bot
Copy link
Collaborator

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Feb 13, 2020
codebytere added a commit that referenced this pull request Feb 14, 2020
PR-URL: #31758
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@codebytere
Copy link
Member Author

Landed in 3a22549

@codebytere codebytere closed this Feb 14, 2020
@codebytere codebytere deleted the no-xor-pow branch February 14, 2020 22:26
codebytere added a commit that referenced this pull request Feb 17, 2020
PR-URL: #31758
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@codebytere codebytere mentioned this pull request Feb 17, 2020
codebytere added a commit that referenced this pull request Mar 15, 2020
PR-URL: #31758
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
codebytere added a commit that referenced this pull request Mar 17, 2020
PR-URL: #31758
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@codebytere codebytere mentioned this pull request Mar 17, 2020
codebytere added a commit that referenced this pull request Mar 30, 2020
PR-URL: #31758
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
codebytere added a commit to electron/electron that referenced this pull request Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. 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.

None yet

9 participants