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

n-api: fix warning in test_general #14104

Closed
wants to merge 1 commit into from

Conversation

danbev
Copy link
Contributor

@danbev danbev commented Jul 6, 2017

Currently the following warning is issued when buildning:

Building addon
/work/nodejs/node/test/addons-napi/test_general/
  CC(target) Debug/obj.target/test_general/test_general.o
../test_general.c:116:14: warning: variable 'result' is used
uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
  } else if (argument_type == napi_null) {
             ^~~~~~~~~~~~~~~~~~~~~~~~~~
../test_general.c:119:10: note: uninitialized use occurs here
  return result;
         ^~~~~~
../test_general.c:116:10: note: remove the 'if' if its condition is
always true
  } else if (argument_type == napi_null) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../test_general.c:101:20: note: initialize the variable 'result' to
silence this warning
  napi_value result;
                   ^
                    = NULL

This commit simply initializes result to NULL to avoid this warning.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
    n-api, test
Affected core subsystem(s)

Currently the following warning is issued when buildning:

Building addon
/work/nodejs/node/test/addons-napi/test_general/
  CC(target) Debug/obj.target/test_general/test_general.o
../test_general.c:116:14: warning: variable 'result' is used
uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
  } else if (argument_type == napi_null) {
             ^~~~~~~~~~~~~~~~~~~~~~~~~~
../test_general.c:119:10: note: uninitialized use occurs here
  return result;
         ^~~~~~
../test_general.c:116:10: note: remove the 'if' if its condition is
always true
  } else if (argument_type == napi_null) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../test_general.c:101:20: note: initialize the variable 'result' to
silence this warning
  napi_value result;
                   ^
                    = NULL

This commit simply initializes result to NULL to avoid this warning.
@nodejs-github-bot nodejs-github-bot added node-api Issues and PRs related to the Node-API. test Issues and PRs related to the tests. labels Jul 6, 2017
@danbev
Copy link
Contributor Author

danbev commented Jul 6, 2017

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

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

LGTM.

@mhdawson
Copy link
Member

mhdawson commented Jul 6, 2017

I'm thinking this can land without the 48hour wait. Any objections ?

danbev added a commit to danbev/node that referenced this pull request Jul 7, 2017
Currently the following warning is issued when buildning:

Building addon
/work/nodejs/node/test/addons-napi/test_general/
  CC(target) Debug/obj.target/test_general/test_general.o
../test_general.c:116:14: warning: variable 'result' is used
uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
  } else if (argument_type == napi_null) {
             ^~~~~~~~~~~~~~~~~~~~~~~~~~
../test_general.c:119:10: note: uninitialized use occurs here
  return result;
         ^~~~~~
../test_general.c:116:10: note: remove the 'if' if its condition is
always true
  } else if (argument_type == napi_null) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../test_general.c:101:20: note: initialize the variable 'result' to
silence this warning
  napi_value result;
                   ^
                    = NULL

This commit simply initializes result to NULL to avoid this warning.

PR-URL: nodejs#14104
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@danbev
Copy link
Contributor Author

danbev commented Jul 7, 2017

Landed in 8f3dab4

@danbev danbev closed this Jul 7, 2017
@danbev danbev deleted the napi-test_general-warning branch July 7, 2017 05:27
addaleax pushed a commit that referenced this pull request Jul 11, 2017
Currently the following warning is issued when buildning:

Building addon
/work/nodejs/node/test/addons-napi/test_general/
  CC(target) Debug/obj.target/test_general/test_general.o
../test_general.c:116:14: warning: variable 'result' is used
uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
  } else if (argument_type == napi_null) {
             ^~~~~~~~~~~~~~~~~~~~~~~~~~
../test_general.c:119:10: note: uninitialized use occurs here
  return result;
         ^~~~~~
../test_general.c:116:10: note: remove the 'if' if its condition is
always true
  } else if (argument_type == napi_null) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../test_general.c:101:20: note: initialize the variable 'result' to
silence this warning
  napi_value result;
                   ^
                    = NULL

This commit simply initializes result to NULL to avoid this warning.

PR-URL: #14104
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@addaleax addaleax mentioned this pull request Jul 11, 2017
addaleax pushed a commit that referenced this pull request Jul 18, 2017
Currently the following warning is issued when buildning:

Building addon
/work/nodejs/node/test/addons-napi/test_general/
  CC(target) Debug/obj.target/test_general/test_general.o
../test_general.c:116:14: warning: variable 'result' is used
uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
  } else if (argument_type == napi_null) {
             ^~~~~~~~~~~~~~~~~~~~~~~~~~
../test_general.c:119:10: note: uninitialized use occurs here
  return result;
         ^~~~~~
../test_general.c:116:10: note: remove the 'if' if its condition is
always true
  } else if (argument_type == napi_null) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../test_general.c:101:20: note: initialize the variable 'result' to
silence this warning
  napi_value result;
                   ^
                    = NULL

This commit simply initializes result to NULL to avoid this warning.

PR-URL: #14104
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Fishrock123 pushed a commit that referenced this pull request Jul 19, 2017
Currently the following warning is issued when buildning:

Building addon
/work/nodejs/node/test/addons-napi/test_general/
  CC(target) Debug/obj.target/test_general/test_general.o
../test_general.c:116:14: warning: variable 'result' is used
uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
  } else if (argument_type == napi_null) {
             ^~~~~~~~~~~~~~~~~~~~~~~~~~
../test_general.c:119:10: note: uninitialized use occurs here
  return result;
         ^~~~~~
../test_general.c:116:10: note: remove the 'if' if its condition is
always true
  } else if (argument_type == napi_null) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../test_general.c:101:20: note: initialize the variable 'result' to
silence this warning
  napi_value result;
                   ^
                    = NULL

This commit simply initializes result to NULL to avoid this warning.

PR-URL: #14104
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
gabrielschulhof pushed a commit to gabrielschulhof/node that referenced this pull request Apr 10, 2018
Currently the following warning is issued when buildning:

Building addon
/work/nodejs/node/test/addons-napi/test_general/
  CC(target) Debug/obj.target/test_general/test_general.o
../test_general.c:116:14: warning: variable 'result' is used
uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
  } else if (argument_type == napi_null) {
             ^~~~~~~~~~~~~~~~~~~~~~~~~~
../test_general.c:119:10: note: uninitialized use occurs here
  return result;
         ^~~~~~
../test_general.c:116:10: note: remove the 'if' if its condition is
always true
  } else if (argument_type == napi_null) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../test_general.c:101:20: note: initialize the variable 'result' to
silence this warning
  napi_value result;
                   ^
                    = NULL

This commit simply initializes result to NULL to avoid this warning.

PR-URL: nodejs#14104
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
MylesBorins pushed a commit that referenced this pull request Apr 16, 2018
Currently the following warning is issued when buildning:

Building addon
/work/nodejs/node/test/addons-napi/test_general/
  CC(target) Debug/obj.target/test_general/test_general.o
../test_general.c:116:14: warning: variable 'result' is used
uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
  } else if (argument_type == napi_null) {
             ^~~~~~~~~~~~~~~~~~~~~~~~~~
../test_general.c:119:10: note: uninitialized use occurs here
  return result;
         ^~~~~~
../test_general.c:116:10: note: remove the 'if' if its condition is
always true
  } else if (argument_type == napi_null) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../test_general.c:101:20: note: initialize the variable 'result' to
silence this warning
  napi_value result;
                   ^
                    = NULL

This commit simply initializes result to NULL to avoid this warning.

Backport-PR-URL: #19447
PR-URL: #14104
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Apr 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
node-api Issues and PRs related to the Node-API. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants