v8/include
Daniel Bevenius f08cbfdc40 Suppress cast-function-type in PersistentBase::SetWeak
This issue was seen in Node.js when compiling with GCC. It can also
been see if building V8 using GCC and enabling -Wcast-function-type
in BUILD.gn:
  "-Wcast-function-type",

There are unit tests in V8 that produce this warning, for example
test/cctest/test-global-handles.cc (formatted to fit the commit
message width):
g++ -MMD -MF obj/test/cctest/cctest_sources/test-global-handles.o.d
...
In file included from ../../include/v8-inspector.h:14,
                 from ../../src/execution/isolate.h:15,
                 from ../../src/api/api.h:10,
                 from ../../src/api/api-inl.h:8,
                 from ../../test/cctest/test-global-handles.cc:28:
../../include/v8.h:
In instantiation of ‘void v8::PersistentBase<T>::SetWeak(
    P*,
    typename v8::WeakCallbackInfo<P>::Callback,
    v8::WeakCallbackType)
[with
  P = v8::Global<v8::Object>;
  T = v8::Object;
  typename v8::WeakCallbackInfo<P>::Callback =
  void (*)(const v8::WeakCallbackInfo<v8::Global<v8::Object> >&)
]’:
../../test/cctest/test-global-handles.cc:292:47: required from here
../../include/v8.h:10750:16: warning:
cast between incompatible function types from
‘v8::WeakCallbackInfo<v8::Global<v8::Object> >::Callback’ {aka
‘void (*)(const v8::WeakCallbackInfo<v8::Global<v8::Object> >&)’} to
‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’}
[-Wcast-function-type]
10750 |                reinterpret_cast<Callback>(callback), type);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This commit suggests adding a pragma specifically for GCC to suppress
this warning.

Bug: v8:8735
Change-Id: I5dd2dccf215a7fd2f6dd14993368cc5cbb6c71e5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2080361
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68320}
2020-06-12 13:01:10 +00:00
..
cppgc cppgc: Rework pre-finalizer registration 2020-06-11 20:12:21 +00:00
libplatform Fix LINT exceptions across the code base 2020-04-27 16:37:04 +00:00
APIDesign.md Move inspector protocol definitions to include/ 2019-06-18 17:59:36 +00:00
DEPS heap,cppgc: Update StackState enum values 2020-05-12 12:07:27 +00:00
js_protocol-1.2.json Move inspector protocol definitions to include/ 2019-06-18 17:59:36 +00:00
js_protocol-1.3.json Move inspector protocol definitions to include/ 2019-06-18 17:59:36 +00:00
js_protocol.pdl [wasm] Rename anyref to externref, anyref flag/feature to reftypes 2020-06-09 17:51:04 +00:00
OWNERS Add include owners for version changes 2020-05-15 10:24:49 +00:00
v8-fast-api-calls.h [api] Avoid using v8::NewFromUtf8Lilteral if possible 2020-06-10 07:41:50 +00:00
v8-inspector-protocol.h Fix LINT exceptions across the code base 2020-04-27 16:37:04 +00:00
v8-inspector.h Fix LINT exceptions across the code base 2020-04-27 16:37:04 +00:00
v8-internal.h [sandbox][api] Introduce Internals::GetIsolateForHeapSandbox() 2020-05-13 09:42:00 +00:00
v8-platform.h Fix LINT exceptions across the code base 2020-04-27 16:37:04 +00:00
v8-profiler.h Fix LINT exceptions across the code base 2020-04-27 16:37:04 +00:00
v8-util.h Fix LINT exceptions across the code base 2020-04-27 16:37:04 +00:00
v8-value-serializer-version.h Expose the ValueSerializer data format version as a compile-time constant. 2017-04-27 15:14:41 +00:00
v8-version-string.h Fix LINT exceptions across the code base 2020-04-27 16:37:04 +00:00
v8-version.h Changed version number to 8.5 2020-05-15 11:04:29 +00:00
v8-wasm-trap-handler-posix.h Fix LINT exceptions across the code base 2020-04-27 16:37:04 +00:00
v8-wasm-trap-handler-win.h Fix LINT exceptions across the code base 2020-04-27 16:37:04 +00:00
v8.h Suppress cast-function-type in PersistentBase::SetWeak 2020-06-12 13:01:10 +00:00
v8config.h heap,cppgc: Update StackState enum values 2020-05-12 12:07:27 +00:00