Skip to content

src: fix compiler warnings in node_buffer.cc - #38722

Closed
RaisinTen wants to merge 1 commit into
nodejs:masterfrom
RaisinTen:src/fix-compiler-warnings-in-node_buffer.cc
Closed

src: fix compiler warnings in node_buffer.cc#38722
RaisinTen wants to merge 1 commit into
nodejs:masterfrom
RaisinTen:src/fix-compiler-warnings-in-node_buffer.cc

Conversation

@RaisinTen

@RaisinTenRaisinTen commented May 18, 2021

Copy link
Copy Markdown
Member

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

Fixes: #38718

@targos

Copy link
Copy Markdown
Member

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

@targos

Copy link
Copy Markdown
Member

/cc @addaleax ?

@github-actionsgithub-actionsBot 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

@addaleaxaddaleax left a comment

Copy link
Copy Markdown
Member

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.

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

@richardlaurichardlau left a comment

Copy link
Copy Markdown
Member

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
RaisinTenforce-pushed the src/fix-compiler-warnings-in-node_buffer.cc branch from 15303b2 to 2ab4e90CompareMay 19, 2021 15:24
@nodejs-github-bot

This comment has been minimized.

@RaisinTen

Copy link
Copy Markdown
MemberAuthor

@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

nodejs-github-bot commented May 22, 2021

Copy link
Copy Markdown
Collaborator

@jasnell

Copy link
Copy Markdown
Member

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 <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>
@jasnelljasnell 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 <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 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 <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>
@danielleadamsdanielleadams 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 <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>
@targostargos mentioned this pull request Jun 6, 2021
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 <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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.bufferIssues and PRs related to the buffer subsystem.c++Issues and PRs that require attention from people who are familiar with C++.needs-ciPRs 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

@RaisinTen@targos@nodejs-github-bot@jasnell@addaleax@JungMinu@richardlau