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

Commits on Jul 6, 2017

  1. n-api: fix warning in test_general

    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.
    danbev committed Jul 6, 2017
    Configuration menu
    Copy the full SHA
    501f240 View commit details
    Browse the repository at this point in the history