Skip to content

Conversation

@mhdawson
Copy link
Member

@mhdawsonmhdawson commented Apr 3, 2017

  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows [commit guidelines][]
Affected core subsystem(s)

napi

The v8 napi implementation had been depending on a one-to-one
relationship between v8 and napi v8 property attributes.
Remove this dependency and fix coverity scan issue
165845 related to mixing enums.

@nodejs-github-botnodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Apr 3, 2017
@mhdawsonmhdawson self-assigned this Apr 3, 2017
src/node_api.cc Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to declare the variable as v8::PropertyAttribute so the cast below wouldn't be necessary?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

If you do that then the compiler complains because it does not expect you to be oring together enums.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

at least without adding more casts etc to the or lines. I had tried that first but.

Copy link
Contributor

@digitalinfinitydigitalinfinity left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@addaleaxaddaleax left a comment

Choose a reason for hiding this comment

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

@aruneshchandra asked me to change the label we use here from napi to n-api, the commit messages should probably follow that too?

src/node_api.cc Outdated
Copy link
Member

Choose a reason for hiding this comment

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

There is a similar cast in napi_define_properties(), that should probably be changed too. (Generally: How about turning this into a general helper function that also takes care of the typecasting?)

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Strange that coverity did not report that one. I'll take a look. I had considered a helper by did not do that as it was a one off, with 2 cases will definitely create a helper.

@addaleaxaddaleax added the node-api Issues and PRs related to the Node-API. label Apr 4, 2017
The v8 n-api implementation had been depending on a one-to-one relationship between v8 and n-api v8 property attributes. Remove this dependency and fix coverity scan issue 165845.
@mhdawson
Copy link
MemberAuthor

@addaleax pushed commit to address comments.

src/node_api.cc Outdated
}

// convert from n-api property attributes to v8::PropertyAttribute
v8::PropertyAttribute V8PropertyAttributesFromAttributes(
Copy link
Member

Choose a reason for hiding this comment

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

I’d suggest adding static inline since there’s no reason to expose this to the outside world

@mhdawson
Copy link
MemberAuthor

Addressed comment.
CI run: https://ci.nodejs.org/job/node-test-pull-request/7230/

@mhdawson
Copy link
MemberAuthor

landed as 4a21e39

@mhdawsonmhdawson closed this Apr 5, 2017
mhdawson added a commit that referenced this pull request Apr 5, 2017
The v8 n-api implementation had been depending on a one-to-one relationship between v8 and n-api v8 property attributes. Remove this dependency and fix coverity scan issue 165845. PR-URL: #12191 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Timothy Gu <[email protected]>
@jasnelljasnell mentioned this pull request May 11, 2017
gabrielschulhof pushed a commit to gabrielschulhof/node that referenced this pull request Apr 10, 2018
The v8 n-api implementation had been depending on a one-to-one relationship between v8 and n-api v8 property attributes. Remove this dependency and fix coverity scan issue 165845. PR-URL: nodejs#12191 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Timothy Gu <[email protected]>
MylesBorins pushed a commit that referenced this pull request Apr 16, 2018
The v8 n-api implementation had been depending on a one-to-one relationship between v8 and n-api v8 property attributes. Remove this dependency and fix coverity scan issue 165845. Backport-PR-URL: #19447 PR-URL: #12191 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Timothy Gu <[email protected]>
@MylesBorinsMylesBorins mentioned this pull request Apr 16, 2018
@mhdawsonmhdawson deleted the cover1 branch September 30, 2019 13:13
Sign up for freeto 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++.node-apiIssues and PRs related to the Node-API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@mhdawson@digitalinfinity@jasnell@addaleax@TimothyGu@italoacasas@nodejs-github-bot