From 24e1e28b38717d4f0505212a4dcdbb5025f3dcba Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 6 Apr 2020 06:25:38 +0200 Subject: [PATCH] src: ignore GCC -Wcast-function-type for v8.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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::SetWeak( P*,typename v8::WeakCallbackInfo

::Callback, v8::WeakCallbackType) [with P = node::BaseObject; T = v8::Object; typename v8::WeakCallbackInfo

::Callback = void (*)(const v8::WeakCallbackInfo&)]’: ../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::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo&)’} [-Wcast-function-type] 10732 | reinterpret_cast(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: https://github.com/nodejs/node/pull/32679 Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell --- src/string_bytes.h | 7 +++++++ test/cctest/test_aliased_buffer.cc | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/string_bytes.h b/src/string_bytes.h index 69bb828e018cb0..e11b73b69e10b7 100644 --- a/src/string_bytes.h +++ b/src/string_bytes.h @@ -26,7 +26,14 @@ // Decodes a v8::Local or Buffer to a raw char* +#if (__GNUC__ >= 8) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcast-function-type" +#endif #include "v8.h" +#if (__GNUC__ >= 8) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif #include "env-inl.h" #include diff --git a/test/cctest/test_aliased_buffer.cc b/test/cctest/test_aliased_buffer.cc index ba947700c1bf27..4dab70d0b576cb 100644 --- a/test/cctest/test_aliased_buffer.cc +++ b/test/cctest/test_aliased_buffer.cc @@ -1,4 +1,11 @@ +#if (__GNUC__ >= 8) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcast-function-type" +#endif #include "v8.h" +#if (__GNUC__ >= 8) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif #include "aliased_buffer.h" #include "node_test_fixture.h"