-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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 #25665
Conversation
Currently the following compiler warnings are generated on Linux: ../src/node_buffer.cc: In function 'void node::Buffer::{anonymous}::StringSlice( const v8::FunctionCallbackInfo<v8::Value>&) [with node::encoding encoding = (node::encoding)1]': ../src/node_buffer.cc:54:20: warning: 'start' may be used uninitialized in this function [-Wmaybe-uninitialized] if (end < start) end = start; ^~~ ../src/node_buffer.cc:50:10: note: 'start' was declared here size_t start; ^~~~~ This commit initializes start and end to zero to avoid these warnings.
Re-run of failing node-test-commit-arm-fanned : |
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.
LGTM
CI: https://ci.nodejs.org/job/node-test-pull-request/20359/ Did you check what path led to these variables potentially being used while initialized? I’d be curious whether this was an actual bug in our code… |
I can't see that these variables would ever be uninitialized, as that initialization happens in From looking into this I can't find that there was a bug. The For |
Landed in d310d8d. |
Currently the following compiler warnings are generated on Linux: ../src/node_buffer.cc: In function 'void node::Buffer::{anonymous}::StringSlice( const v8::FunctionCallbackInfo<v8::Value>&) [with node::encoding encoding = (node::encoding)1]': ../src/node_buffer.cc:54:20: warning: 'start' may be used uninitialized in this function [-Wmaybe-uninitialized] if (end < start) end = start; ^~~ ../src/node_buffer.cc:50:10: note: 'start' was declared here size_t start; ^~~~~ This commit initializes start and end to zero to avoid these warnings. PR-URL: #25665 Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
Currently the following compiler warnings are generated on Linux: ../src/node_buffer.cc: In function 'void node::Buffer::{anonymous}::StringSlice( const v8::FunctionCallbackInfo<v8::Value>&) [with node::encoding encoding = (node::encoding)1]': ../src/node_buffer.cc:54:20: warning: 'start' may be used uninitialized in this function [-Wmaybe-uninitialized] if (end < start) end = start; ^~~ ../src/node_buffer.cc:50:10: note: 'start' was declared here size_t start; ^~~~~ This commit initializes start and end to zero to avoid these warnings. PR-URL: #25665 Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
Currently the following compiler warnings are generated on Linux:
This commit initializes start and end to zero to avoid these warnings.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes