Skip to content

Conversation

@mhdawson
Copy link
Member

@mhdawson mhdawson commented Jan 6, 2022

Add missing initialization reported by coverity

Signed-off-by: Michael Dawson [email protected]

Add missing initialization reported by coverity

Signed-off-by: Michael Dawson <[email protected]>
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. worker Issues and PRs related to Worker support. labels Jan 6, 2022
@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.

uv_thread_t is an opaque type, we should not rely on the fact that 0 may currently be a valid initailizer for it.

Usage of tid_ is restricted to the condition that thread_joined_ is false, and conversely thread_joined_ is only set to false when tid_ is initialized. Consequently, this seems to be a false positive.

Edit: To be clear: This also reduces readability because initializing tid_ makes it looks like the variable can always be accessed, even when the thread is not running, which is not valid usage of it. However, I think we’re using C++17 now, so maybe we could drop thread_joined_ and instead make tid_ an std::optional<uv_thread_t>?

addaleax added a commit to addaleax/node that referenced this pull request Jan 9, 2022
addaleax added a commit to addaleax/node that referenced this pull request Jan 9, 2022
@addaleax
Copy link
Member

addaleax commented Jan 9, 2022

PR with that suggestion: #41453

@mhdawson
Copy link
Member Author

Ok, I'll check the coverity report after the change proposed in #41453 and if it still reports an issue we can flag it as a false positive.

aduh95 pushed a commit that referenced this pull request Jan 14, 2022
Refs: #41421

PR-URL: #41453
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
targos pushed a commit that referenced this pull request Jan 16, 2022
Refs: #41421

PR-URL: #41453
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
mawaregetsuka pushed a commit to mawaregetsuka/node that referenced this pull request Jan 17, 2022
Refs: nodejs#41421

PR-URL: nodejs#41453
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
@mhdawson
Copy link
Member Author

#41453 seems to have resolve the warning, closing.

@mhdawson mhdawson closed this Jan 17, 2022
thedull pushed a commit to thedull/node that referenced this pull request Jan 18, 2022
Refs: nodejs#41421

PR-URL: nodejs#41453
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Linkgoron pushed a commit to Linkgoron/node that referenced this pull request Jan 31, 2022
Refs: nodejs#41421

PR-URL: nodejs#41453
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
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++. needs-ci PRs that need a full CI run. worker Issues and PRs related to Worker support.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants