From d683da7ffa94999dcd1e6d3b756f125a288646cb Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 23 Jan 2019 12:01:01 +0100 Subject: [PATCH] test, tools: suppress addon function cast warnings Currently, there are a number of compiler warnings generated when building the addons on Linux, for example: make[1]: Entering directory '/node/test/addons/zlib-binding/build' CXX(target) Release/obj.target/binding/binding.o SOLINK_MODULE(target) Release/obj.target/binding.node COPY Release/binding.node make[1]: Leaving directory '/node/test/addons/zlib-binding/build' In file included from ../binding.cc:1: /node/src/node.h:515:51: warning: cast between incompatible function types from 'void (*)(v8::Local, v8::Local, v8::Local)' to 'node::addon_context_register_func' {aka 'void (*)(v8::Local, v8::Local, v8::Local, void*)'} [-Wcast-function-type] (node::addon_context_register_func) (regfunc), \ ^ /node/src/node.h:533:3: note: in expansion of macro 'NODE_MODULE_CONTEXT_AWARE_X' NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, NULL, 0) ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../binding.cc:58:1: note: in expansion of macro 'NODE_MODULE_CONTEXT_AWARE' NODE_MODULE_CONTEXT_AWARE(NODE_GYP_MODULE_NAME, Initialize) ^~~~~~~~~~~~~~~~~~~~~~~~~ This commit adds the flag -Wno-cast-function-type to suppress these warnings. With this change the warnings are not displayed anymore and the output matches that of osx when running 'make -j8 test/addons/.buildstamp'. PR-URL: https://github.com/nodejs/node/pull/25663 Reviewed-By: Anna Henningsen Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Richard Lau --- test/addons/async-hello-world/binding.gyp | 4 ++-- test/addons/async-hooks-id/binding.gyp | 4 ++-- test/addons/async-hooks-promise/binding.gyp | 4 ++-- test/addons/async-resource/binding.gyp | 4 ++-- test/addons/at-exit/binding.gyp | 4 ++-- test/addons/buffer-free-callback/binding.gyp | 4 ++-- test/addons/callback-scope/binding.gyp | 4 ++-- test/addons/common.gypi | 8 ++++++++ test/addons/dlopen-ping-pong/binding.gyp | 2 +- test/addons/errno-exception/binding.gyp | 4 ++-- test/addons/heap-profiler/binding.gyp | 4 ++-- test/addons/hello-world-esm/binding.gyp | 4 ++-- test/addons/hello-world-function-export/binding.gyp | 4 ++-- test/addons/hello-world/binding.gyp | 4 ++-- test/addons/load-long-path/binding.gyp | 4 ++-- test/addons/make-callback-domain-warning/binding.gyp | 4 ++-- test/addons/make-callback-recurse/binding.gyp | 4 ++-- test/addons/make-callback/binding.gyp | 4 ++-- test/addons/new-target/binding.gyp | 4 ++-- test/addons/node-module-version/binding.gyp | 4 ++-- test/addons/non-node-context/binding.gyp | 3 ++- test/addons/not-a-binding/binding.gyp | 3 ++- test/addons/null-buffer-neuter/binding.gyp | 4 ++-- test/addons/openssl-binding/binding.gyp | 5 +++-- test/addons/openssl-client-cert-engine/binding.gyp | 3 ++- test/addons/parse-encoding/binding.gyp | 4 ++-- test/addons/repl-domain-abort/binding.gyp | 4 ++-- test/addons/stringbytes-external-exceed-max/binding.gyp | 4 ++-- test/addons/symlinked-module/binding.gyp | 3 ++- test/addons/uv-handle-leak/binding.gyp | 4 ++-- test/addons/worker-addon/binding.gyp | 4 ++-- test/addons/zlib-binding/binding.gyp | 1 + tools/doc/addon-verify.js | 4 ++-- 33 files changed, 71 insertions(+), 57 deletions(-) create mode 100644 test/addons/common.gypi diff --git a/test/addons/async-hello-world/binding.gyp b/test/addons/async-hello-world/binding.gyp index 7ede63d94a0d77..55fbe7050f18e4 100644 --- a/test/addons/async-hello-world/binding.gyp +++ b/test/addons/async-hello-world/binding.gyp @@ -2,8 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/async-hooks-id/binding.gyp b/test/addons/async-hooks-id/binding.gyp index 7ede63d94a0d77..55fbe7050f18e4 100644 --- a/test/addons/async-hooks-id/binding.gyp +++ b/test/addons/async-hooks-id/binding.gyp @@ -2,8 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/async-hooks-promise/binding.gyp b/test/addons/async-hooks-promise/binding.gyp index 7ede63d94a0d77..55fbe7050f18e4 100644 --- a/test/addons/async-hooks-promise/binding.gyp +++ b/test/addons/async-hooks-promise/binding.gyp @@ -2,8 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/async-resource/binding.gyp b/test/addons/async-resource/binding.gyp index 7ede63d94a0d77..55fbe7050f18e4 100644 --- a/test/addons/async-resource/binding.gyp +++ b/test/addons/async-resource/binding.gyp @@ -2,8 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/at-exit/binding.gyp b/test/addons/at-exit/binding.gyp index 7ede63d94a0d77..55fbe7050f18e4 100644 --- a/test/addons/at-exit/binding.gyp +++ b/test/addons/at-exit/binding.gyp @@ -2,8 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/buffer-free-callback/binding.gyp b/test/addons/buffer-free-callback/binding.gyp index 7ede63d94a0d77..55fbe7050f18e4 100644 --- a/test/addons/buffer-free-callback/binding.gyp +++ b/test/addons/buffer-free-callback/binding.gyp @@ -2,8 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/callback-scope/binding.gyp b/test/addons/callback-scope/binding.gyp index 7ede63d94a0d77..55fbe7050f18e4 100644 --- a/test/addons/callback-scope/binding.gyp +++ b/test/addons/callback-scope/binding.gyp @@ -2,8 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/common.gypi b/test/addons/common.gypi new file mode 100644 index 00000000000000..3f1c11dc3cda15 --- /dev/null +++ b/test/addons/common.gypi @@ -0,0 +1,8 @@ +{ + 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], + 'conditions': [ + [ 'OS in "linux freebsd openbsd solaris android aix cloudabi"', { + 'cflags': ['-Wno-cast-function-type'], + }], + ], +} diff --git a/test/addons/dlopen-ping-pong/binding.gyp b/test/addons/dlopen-ping-pong/binding.gyp index 48af696b326507..8569b011fac8e5 100644 --- a/test/addons/dlopen-ping-pong/binding.gyp +++ b/test/addons/dlopen-ping-pong/binding.gyp @@ -17,8 +17,8 @@ }, { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/errno-exception/binding.gyp b/test/addons/errno-exception/binding.gyp index 7ede63d94a0d77..55fbe7050f18e4 100644 --- a/test/addons/errno-exception/binding.gyp +++ b/test/addons/errno-exception/binding.gyp @@ -2,8 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/heap-profiler/binding.gyp b/test/addons/heap-profiler/binding.gyp index ceb1d3e73415de..2d26a785709dd1 100644 --- a/test/addons/heap-profiler/binding.gyp +++ b/test/addons/heap-profiler/binding.gyp @@ -2,9 +2,9 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], 'sources': [ 'binding.cc' ], - 'win_delay_load_hook': 'false' + 'win_delay_load_hook': 'false', + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/hello-world-esm/binding.gyp b/test/addons/hello-world-esm/binding.gyp index 7ede63d94a0d77..55fbe7050f18e4 100644 --- a/test/addons/hello-world-esm/binding.gyp +++ b/test/addons/hello-world-esm/binding.gyp @@ -2,8 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/hello-world-function-export/binding.gyp b/test/addons/hello-world-function-export/binding.gyp index 7ede63d94a0d77..55fbe7050f18e4 100644 --- a/test/addons/hello-world-function-export/binding.gyp +++ b/test/addons/hello-world-function-export/binding.gyp @@ -2,8 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/hello-world/binding.gyp b/test/addons/hello-world/binding.gyp index 7ede63d94a0d77..55fbe7050f18e4 100644 --- a/test/addons/hello-world/binding.gyp +++ b/test/addons/hello-world/binding.gyp @@ -2,8 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/load-long-path/binding.gyp b/test/addons/load-long-path/binding.gyp index 7ede63d94a0d77..55fbe7050f18e4 100644 --- a/test/addons/load-long-path/binding.gyp +++ b/test/addons/load-long-path/binding.gyp @@ -2,8 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/make-callback-domain-warning/binding.gyp b/test/addons/make-callback-domain-warning/binding.gyp index 7ede63d94a0d77..55fbe7050f18e4 100644 --- a/test/addons/make-callback-domain-warning/binding.gyp +++ b/test/addons/make-callback-domain-warning/binding.gyp @@ -2,8 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/make-callback-recurse/binding.gyp b/test/addons/make-callback-recurse/binding.gyp index 7ede63d94a0d77..55fbe7050f18e4 100644 --- a/test/addons/make-callback-recurse/binding.gyp +++ b/test/addons/make-callback-recurse/binding.gyp @@ -2,8 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/make-callback/binding.gyp b/test/addons/make-callback/binding.gyp index 7ede63d94a0d77..55fbe7050f18e4 100644 --- a/test/addons/make-callback/binding.gyp +++ b/test/addons/make-callback/binding.gyp @@ -2,8 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/new-target/binding.gyp b/test/addons/new-target/binding.gyp index 7ede63d94a0d77..55fbe7050f18e4 100644 --- a/test/addons/new-target/binding.gyp +++ b/test/addons/new-target/binding.gyp @@ -2,8 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/node-module-version/binding.gyp b/test/addons/node-module-version/binding.gyp index 7ede63d94a0d77..55fbe7050f18e4 100644 --- a/test/addons/node-module-version/binding.gyp +++ b/test/addons/node-module-version/binding.gyp @@ -2,8 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/non-node-context/binding.gyp b/test/addons/non-node-context/binding.gyp index b83bae308260f2..2eb456719623b9 100644 --- a/test/addons/non-node-context/binding.gyp +++ b/test/addons/non-node-context/binding.gyp @@ -2,7 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'sources': ['binding.cc'] + 'sources': ['binding.cc'], + 'includes': ['../common.gypi'], }, ] } diff --git a/test/addons/not-a-binding/binding.gyp b/test/addons/not-a-binding/binding.gyp index 7ddad59c1d1683..43036995f8e5d4 100644 --- a/test/addons/not-a-binding/binding.gyp +++ b/test/addons/not-a-binding/binding.gyp @@ -2,7 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'sources': [ 'not_a_binding.c' ] + 'sources': [ 'not_a_binding.c' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/null-buffer-neuter/binding.gyp b/test/addons/null-buffer-neuter/binding.gyp index 7ede63d94a0d77..55fbe7050f18e4 100644 --- a/test/addons/null-buffer-neuter/binding.gyp +++ b/test/addons/null-buffer-neuter/binding.gyp @@ -2,8 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/openssl-binding/binding.gyp b/test/addons/openssl-binding/binding.gyp index 3bfe93350fe3bf..38a7c10d672d92 100644 --- a/test/addons/openssl-binding/binding.gyp +++ b/test/addons/openssl-binding/binding.gyp @@ -2,12 +2,13 @@ 'targets': [ { 'target_name': 'binding', + 'includes': ['../common.gypi'], 'conditions': [ ['node_use_openssl=="true"', { 'sources': ['binding.cc'], 'include_dirs': ['../../../deps/openssl/openssl/include'], - }] - ] + }], + ], }, ] } diff --git a/test/addons/openssl-client-cert-engine/binding.gyp b/test/addons/openssl-client-cert-engine/binding.gyp index f43be602199ad0..9d5f501fd633bc 100644 --- a/test/addons/openssl-client-cert-engine/binding.gyp +++ b/test/addons/openssl-client-cert-engine/binding.gyp @@ -3,6 +3,7 @@ { 'target_name': 'testengine', 'type': 'none', + 'includes': ['../common.gypi'], 'conditions': [ ['OS=="mac" and ' 'node_use_openssl=="true" and ' @@ -17,7 +18,7 @@ '../../../../out/<(PRODUCT_DIR)/<(openssl_product)' ] }, - }] + }], ] } ] diff --git a/test/addons/parse-encoding/binding.gyp b/test/addons/parse-encoding/binding.gyp index 7ede63d94a0d77..55fbe7050f18e4 100644 --- a/test/addons/parse-encoding/binding.gyp +++ b/test/addons/parse-encoding/binding.gyp @@ -2,8 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/repl-domain-abort/binding.gyp b/test/addons/repl-domain-abort/binding.gyp index 7ede63d94a0d77..55fbe7050f18e4 100644 --- a/test/addons/repl-domain-abort/binding.gyp +++ b/test/addons/repl-domain-abort/binding.gyp @@ -2,8 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/stringbytes-external-exceed-max/binding.gyp b/test/addons/stringbytes-external-exceed-max/binding.gyp index 7ede63d94a0d77..55fbe7050f18e4 100644 --- a/test/addons/stringbytes-external-exceed-max/binding.gyp +++ b/test/addons/stringbytes-external-exceed-max/binding.gyp @@ -2,8 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/symlinked-module/binding.gyp b/test/addons/symlinked-module/binding.gyp index 3bfb84493f3e87..55fbe7050f18e4 100644 --- a/test/addons/symlinked-module/binding.gyp +++ b/test/addons/symlinked-module/binding.gyp @@ -2,7 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/uv-handle-leak/binding.gyp b/test/addons/uv-handle-leak/binding.gyp index 7ede63d94a0d77..55fbe7050f18e4 100644 --- a/test/addons/uv-handle-leak/binding.gyp +++ b/test/addons/uv-handle-leak/binding.gyp @@ -2,8 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/worker-addon/binding.gyp b/test/addons/worker-addon/binding.gyp index 7ede63d94a0d77..55fbe7050f18e4 100644 --- a/test/addons/worker-addon/binding.gyp +++ b/test/addons/worker-addon/binding.gyp @@ -2,8 +2,8 @@ 'targets': [ { 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ] + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], } ] } diff --git a/test/addons/zlib-binding/binding.gyp b/test/addons/zlib-binding/binding.gyp index 60a9bb82661820..0451f21782ff19 100644 --- a/test/addons/zlib-binding/binding.gyp +++ b/test/addons/zlib-binding/binding.gyp @@ -4,6 +4,7 @@ 'target_name': 'binding', 'sources': ['binding.cc'], 'include_dirs': ['../../../deps/zlib'], + 'includes': ['../common.gypi'], }, ] } diff --git a/tools/doc/addon-verify.js b/tools/doc/addon-verify.js index ae6a08b2cc6475..2ff61c21f5c22e 100644 --- a/tools/doc/addon-verify.js +++ b/tools/doc/addon-verify.js @@ -79,8 +79,8 @@ ${files[name].replace( targets: [ { target_name: 'addon', - defines: [ 'V8_DEPRECATION_WARNINGS=1' ], - sources: files.map(({ name }) => name) + sources: files.map(({ name }) => name), + includes: ['../common.gypi'], } ] })