google / pprof-nodejs

pprof support for Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stop suppressing warnings with -Wno-cast-function-type

nolanmar511 opened this issue · comments

Without -Wno-cast-function-type, we see the following warnings when compiling with gcc 8:

gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/tmpfs/src/github/pprof-nodejs/build'
  CXX(target) Release/obj.target/pprof/bindings/profiler.o
In file included from /root/.node-gyp/6.0.0/include/node/v8-profiler.h:9,
                 from ../bindings/profiler.cc:17:
/root/.node-gyp/6.0.0/include/node/v8.h: In static member function 'static void v8::V8::RemoveGCPrologueCallback(v8::GCCallback)':
/root/.node-gyp/6.0.0/include/node/v8.h:8504:57: warning: cast between incompatible function types from 'v8::GCCallback' {aka 'void (*)(v8::GCType, v8::GCCallbackFlags)'} to 'v8::Isolate::GCCallback' {aka 'void (*)(v8::Isolate*, v8::GCType, v8::GCCallbackFlags)'} [-Wcast-function-type]
       reinterpret_cast<v8::Isolate::GCCallback>(callback));
                                                         ^
/root/.node-gyp/6.0.0/include/node/v8.h: In static member function 'static void v8::V8::RemoveGCEpilogueCallback(v8::GCCallback)':
/root/.node-gyp/6.0.0/include/node/v8.h:8511:57: warning: cast between incompatible function types from 'v8::GCCallback' {aka 'void (*)(v8::GCType, v8::GCCallbackFlags)'} to 'v8::Isolate::GCCallback' {aka 'void (*)(v8::Isolate*, v8::GCType, v8::GCCallbackFlags)'} [-Wcast-function-type]
       reinterpret_cast<v8::Isolate::GCCallback>(callback));
                                                         ^
In file included from ../bindings/profiler.cc:18:
../node_modules/nan/nan.h: In function 'void Nan::AsyncQueueWorker(Nan::AsyncWorker*)':
../node_modules/nan/nan.h:2232:62: warning: cast between incompatible function types from 'void (*)(uv_work_t*)' {aka 'void (*)(uv_work_s*)'} to 'uv_after_work_cb' {aka 'void (*)(uv_work_s*, int)'} [-Wcast-function-type]
     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
                                                              ^
In file included from ../node_modules/nan/nan.h:53,
                 from ../bindings/profiler.cc:18:
../bindings/profiler.cc: At global scope:
/root/.node-gyp/6.0.0/include/node/node.h:438:43: warning: cast between incompatible function types from 'void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)' {aka 'void (*)(v8::Local<v8::Object>)'} to 'node::addon_register_func' {aka 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)'} [-Wcast-function-type]
       (node::addon_register_func) (regfunc),                          \
                                           ^
/root/.node-gyp/6.0.0/include/node/node.h:469:3: note: in expansion of macro 'NODE_MODULE_X'
   NODE_MODULE_X(modname, regfunc, NULL, 0)
   ^~~~~~~~~~~~~
../bindings/profiler.cc:189:1: note: in expansion of macro 'NODE_MODULE'
 NODE_MODULE(google_cloud_profiler, InitAll);
 ^~~~~~~~~~~
In file included from /root/.node-gyp/6.0.0/include/node/v8-profiler.h:9,
                 from ../bindings/profiler.cc:17:
/root/.node-gyp/6.0.0/include/node/v8.h: In instantiation of 'void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]':
/root/.node-gyp/6.0.0/include/node/node_object_wrap.h:64:78:   required from here
/root/.node-gyp/6.0.0/include/node/v8.h:7484:16: warning: cast between incompatible function types from 'v8::WeakCallbackInfo<node::ObjectWrap>::Callback' {aka 'void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)'} to 'Callback' {aka 'void (*)(const v8::WeakCallbackInfo<void>&)'} [-Wcast-function-type]
                reinterpret_cast<Callback>(callback), type);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/.node-gyp/6.0.0/include/node/v8.h: In instantiation of 'void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]':
../node_modules/nan/nan_object_wrap.h:66:61:   required from here
/root/.node-gyp/6.0.0/include/node/v8.h:7484:16: warning: cast between incompatible function types from 'v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback' {aka 'void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)'} to 'Callback' {aka 'void (*)(const v8::WeakCallbackInfo<void>&)'} [-Wcast-function-type]
  SOLINK_MODULE(target) Release/obj.target/pprof.node
  COPY Release/pprof.node
  COPY /tmpfs/src/github/pprof-nodejs/build/node-v48-linux-x64-musl/pprof.node
  TOUCH Release/obj.target/action_after_build.stamp
make: Leaving directory '/tmpfs/src/github/pprof-nodejs/build'
gyp info ok

We are going to suppress these warnings for now with -Wno-cast-function-type , but should stop using this flag in the future when these warnings are handled by V8.