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
Member

@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 targos commented May 18, 2021

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

@targos
Copy link
Member

@targos targos commented May 19, 2021

/cc @addaleax ?

Copy link
Member

@addaleax addaleax left a comment

@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 hidden.

targos
targos approved these changes May 19, 2021
Copy link
Member

@richardlau richardlau left a comment

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 May 19, 2021
@nodejs-github-bot

This comment has been hidden.

@RaisinTen
Copy link
Member Author

@RaisinTen RaisinTen commented May 19, 2021

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

@nodejs-github-bot

This comment has been hidden.

@nodejs-github-bot

This comment has been hidden.

@nodejs-github-bot

This comment has been hidden.

@nodejs-github-bot

This comment has been hidden.

@nodejs-github-bot

This comment has been hidden.

@nodejs-github-bot

This comment has been hidden.

@nodejs-github-bot
Copy link
Contributor

@nodejs-github-bot nodejs-github-bot commented May 22, 2021

@jasnell
Copy link
Member

@jasnell jasnell commented May 24, 2021

Landed in 7766b38

jasnell added a commit that referenced this issue 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 <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
@jasnell jasnell closed this May 24, 2021
@RaisinTen RaisinTen deleted the src/fix-compiler-warnings-in-node_buffer.cc branch May 24, 2021
targos added a commit that referenced this issue 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 <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
danielleadams added a commit that referenced this issue 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 <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
@danielleadams danielleadams mentioned this pull request May 31, 2021
targos added a commit that referenced this issue 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 <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
targos added a commit that referenced this issue 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 <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

7 participants