src: silence compiler warning node_process_methods

Currently, the following compiler warning is generated by clang:
../src/node_process_methods.cc:71:3:
warning: indirection of non-volatile null pointer will be deleted,
not trap [-Wnull-dereference]
  *static_cast<volatile void**>(nullptr) = nullptr;
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/node_process_methods.cc:71:3: note:
consider using __builtin_trap() or qualifying pointer with 'volatile'
1 warning generated.

This commit adds the volatile qualifier to avoid this warning.

PR-URL: https://github.com/nodejs/node/pull/28261
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Daniel Bevenius 2019-06-17 07:58:58 +02:00 committed by Anna Henningsen
parent 05b8526a59
commit 264cb79bc2
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9

View File

@ -66,7 +66,8 @@ static void Abort(const FunctionCallbackInfo<Value>& args) {
// For internal testing only, not exposed to userland.
static void CauseSegfault(const FunctionCallbackInfo<Value>& args) {
// This should crash hard all platforms.
*static_cast<void**>(nullptr) = nullptr;
volatile void** d = static_cast<volatile void**>(nullptr);
*d = nullptr;
}
static void Chdir(const FunctionCallbackInfo<Value>& args) {