diff options
author | Daniel Bevenius <daniel.bevenius@gmail.com> | 2019-06-17 07:58:58 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-06-19 15:23:00 -0700 |
commit | 264cb79bc2e22cc56fbbd742b8c7bf723e9ce5e2 (patch) | |
tree | 9b3f4caff7fab8f450712bacc29027edc46ccaa8 /src/node_process_methods.cc | |
parent | 05b8526a594db8be5621ea40de625c46fcd5f1dc (diff) | |
download | node-new-264cb79bc2e22cc56fbbd742b8c7bf723e9ce5e2.tar.gz |
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>
Diffstat (limited to 'src/node_process_methods.cc')
-rw-r--r-- | src/node_process_methods.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc index 912ac9bec2..b34cbf89b6 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc @@ -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) { |