• Daniel Bevenius's avatar
    Suppress cast-function-type in PersistentBase::SetWeak · f08cbfdc
    Daniel Bevenius authored
    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/+/2080361Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
    Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#68320}
    f08cbfdc
Name
Last commit
Last update
build_overrides Loading commit data...
custom_deps Loading commit data...
docs Loading commit data...
gni Loading commit data...
include Loading commit data...
infra Loading commit data...
samples Loading commit data...
src Loading commit data...
test Loading commit data...
testing Loading commit data...
third_party Loading commit data...
tools Loading commit data...
.clang-format Loading commit data...
.clang-tidy Loading commit data...
.editorconfig Loading commit data...
.flake8 Loading commit data...
.git-blame-ignore-revs Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.gn Loading commit data...
.vpython Loading commit data...
.ycm_extra_conf.py Loading commit data...
AUTHORS Loading commit data...
BUILD.gn Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
COMMON_OWNERS Loading commit data...
DEPS Loading commit data...
ENG_REVIEW_OWNERS Loading commit data...
INFRA_OWNERS Loading commit data...
INTL_OWNERS Loading commit data...
LICENSE Loading commit data...
LICENSE.fdlibm Loading commit data...
LICENSE.strongtalk Loading commit data...
LICENSE.v8 Loading commit data...
LICENSE.valgrind Loading commit data...
MIPS_OWNERS Loading commit data...
OWNERS Loading commit data...
PPC_OWNERS Loading commit data...
PRESUBMIT.py Loading commit data...
README.md Loading commit data...
S390_OWNERS Loading commit data...
WATCHLISTS Loading commit data...
codereview.settings Loading commit data...