Skip to content

Commit 2f7e372

Browse files
danbevBridgeAR
authored andcommitted
src: ignore GCC -Wcast-function-type for v8.h
Currently, the following warnings are emitted during compilation: In file included from ../src/string_bytes.h:29, from ../src/string_bytes.cc:22: ../deps/v8/include/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak( P*,typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::BaseObject; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::BaseObject>&)]’: ../src/base_object-inl.h:135:42: required from here ../deps/v8/include/v8.h:10732:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<node::BaseObject>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<node::BaseObject>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type] 10732 | reinterpret_cast<Callback>(callback), type); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ And the same from test/cctest/test_aliased_buffer.cc We have an open pull request against v8 for this: https://chromium-review.googlesource.com/c/v8/v8/+/2080361 PR-URL: #32679 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 83f1e98 commit 2f7e372

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/string_bytes.h

+7
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,14 @@
2626

2727
// Decodes a v8::Local<v8::String> or Buffer to a raw char*
2828

29+
#if (__GNUC__ >= 8) && !defined(__clang__)
30+
#pragma GCC diagnostic push
31+
#pragma GCC diagnostic ignored "-Wcast-function-type"
32+
#endif
2933
#include "v8.h"
34+
#if (__GNUC__ >= 8) && !defined(__clang__)
35+
#pragma GCC diagnostic pop
36+
#endif
3037
#include "env-inl.h"
3138

3239
#include <string>

test/cctest/test_aliased_buffer.cc

+7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1+
#if (__GNUC__ >= 8) && !defined(__clang__)
2+
#pragma GCC diagnostic push
3+
#pragma GCC diagnostic ignored "-Wcast-function-type"
4+
#endif
15
#include "v8.h"
6+
#if (__GNUC__ >= 8) && !defined(__clang__)
7+
#pragma GCC diagnostic pop
8+
#endif
29
#include "aliased_buffer.h"
310
#include "node_test_fixture.h"
411

0 commit comments

Comments
 (0)