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 compiler warnings in node_buffer.cc #38722

Conversation

RaisinTen
Copy link
Contributor

@RaisinTen RaisinTen commented May 18, 2021

The variables could be initialized to 0 to avoid the warnings from
-Wmaybe-uninitialized.

Fixes: #38718

@targos
Copy link
Member

targos commented May 18, 2021

Any idea why the warnings are only emitted on v14.x branches?

@targos
Copy link
Member

targos commented May 19, 2021

/cc @addaleax ?

@github-actions github-actions bot added buffer Issues and PRs related to the buffer subsystem. c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels May 19, 2021
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.

@targos no idea; and I think that warnings would be okay to ignore here as well, as they seem like false positives to me.

@nodejs-github-bot

This comment has been minimized.

@RaisinTen RaisinTen added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 19, 2021
Copy link
Member

@richardlau richardlau left a comment

Choose a reason for hiding this comment

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

This PR has cleared up most of the compiler warnings I get when building locally with GCC 10 (#38718 (comment)) but one still remains:

../src/node_buffer.cc: In function ‘void node::Buffer::{anonymous}::Fill(const v8::FunctionCallbackInfo<v8::Value>&)’:
../src/node_buffer.cc:646:35: error: ‘start’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  646 |   char* ptr = ts_obj_data + start + str_length;
      |               ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
cc1plus: all warnings being treated as errors

The variables could be initialized to `0` to avoid the warnings from
`-Wmaybe-uninitialized`.

Fixes: nodejs#38718
@RaisinTen RaisinTen force-pushed the src/fix-compiler-warnings-in-node_buffer.cc branch from 15303b2 to 2ab4e90 Compare May 19, 2021 15:24
@nodejs-github-bot

This comment has been minimized.

@RaisinTen
Copy link
Contributor Author

@richardlau Updated the PR to initialize start as well. PTAL.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented May 22, 2021

@jasnell
Copy link
Member

jasnell commented May 24, 2021

Landed in 7766b38

jasnell pushed a commit that referenced this pull request May 24, 2021
The variables could be initialized to `0` to avoid the warnings from
`-Wmaybe-uninitialized`.

Fixes: #38718

PR-URL: #38722
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
@jasnell jasnell closed this May 24, 2021
@RaisinTen RaisinTen deleted the src/fix-compiler-warnings-in-node_buffer.cc branch May 24, 2021 14:38
targos pushed a commit that referenced this pull request May 25, 2021
The variables could be initialized to `0` to avoid the warnings from
`-Wmaybe-uninitialized`.

Fixes: #38718

PR-URL: #38722
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
danielleadams pushed a commit that referenced this pull request May 31, 2021
The variables could be initialized to `0` to avoid the warnings from
`-Wmaybe-uninitialized`.

Fixes: #38718

PR-URL: #38722
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
@danielleadams danielleadams mentioned this pull request May 31, 2021
targos pushed a commit that referenced this pull request Jun 5, 2021
The variables could be initialized to `0` to avoid the warnings from
`-Wmaybe-uninitialized`.

Fixes: #38718

PR-URL: #38722
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
targos pushed a commit that referenced this pull request Jun 11, 2021
The variables could be initialized to `0` to avoid the warnings from
`-Wmaybe-uninitialized`.

Fixes: #38718

PR-URL: #38722
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
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. buffer Issues and PRs related to the buffer subsystem. c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compiler warnings make test-linux workflow fail on v14.x
7 participants