-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
src: fix compiler warnings in node_buffer.cc #38722
Conversation
Any idea why the warnings are only emitted on v14.x branches? |
/cc @addaleax ? |
There was a problem hiding this 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.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this 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
15303b2
to
2ab4e90
Compare
This comment has been minimized.
This comment has been minimized.
@richardlau Updated the PR to initialize |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Landed in 7766b38 |
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>
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>
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>
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>
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>
The variables could be initialized to
0
to avoid the warnings from-Wmaybe-uninitialized
.Fixes: #38718