From faf19c4f7aafc416410e1ae26537c8ec4ba018e6 Mon Sep 17 00:00:00 2001 From: Eric Bickle Date: Sat, 10 Feb 2018 19:02:42 -0800 Subject: [PATCH] Fixed initialization of std::string to nullptr Enabled VC++ static analysis PR-URL: https://github.com/nodejs/node-addon-api/pull/228 Reviewed-By: Michael Dawson Reviewed-By: Hitesh Kanwathirtha --- napi-inl.h | 2 +- test/binding.gyp | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/napi-inl.h b/napi-inl.h index 3ee048e4a..773daf400 100644 --- a/napi-inl.h +++ b/napi-inl.h @@ -1820,7 +1820,7 @@ inline NAPI_NO_RETURN void Error::Fatal(const char* location, const char* messag napi_fatal_error(location, NAPI_AUTO_LENGTH, message, NAPI_AUTO_LENGTH); } -inline Error::Error() : ObjectReference(), _message(nullptr) { +inline Error::Error() : ObjectReference() { } inline Error::Error(napi_env env, napi_value value) : ObjectReference(env, nullptr) { diff --git a/test/binding.gyp b/test/binding.gyp index c7272ede8..0344d133c 100644 --- a/test/binding.gyp +++ b/test/binding.gyp @@ -33,7 +33,10 @@ 'cflags!': [ '-fno-exceptions' ], 'cflags_cc!': [ '-fno-exceptions' ], 'msvs_settings': { - 'VCCLCompilerTool': { 'ExceptionHandling': 1 }, + 'VCCLCompilerTool': { + 'ExceptionHandling': 1, + 'EnablePREfast': 'true', + }, }, 'xcode_settings': { 'CLANG_CXX_LIBRARY': 'libc++', @@ -47,7 +50,10 @@ 'cflags': [ '-fno-exceptions' ], 'cflags_cc': [ '-fno-exceptions' ], 'msvs_settings': { - 'VCCLCompilerTool': { 'ExceptionHandling': 0 }, + 'VCCLCompilerTool': { + 'ExceptionHandling': 0, + 'EnablePREfast': 'true', + }, }, 'xcode_settings': { 'CLANG_CXX_LIBRARY': 'libc++',