From de6d5523a195af1213fe64d75b07ed3ba0cebcc7 Mon Sep 17 00:00:00 2001 From: Denys Otrishko Date: Sun, 26 Jan 2020 17:59:51 +0200 Subject: [PATCH] src: fix ignore GCC -Wcast-function-type for older compilers Fixes: https://github.com/nodejs/node/issues/31517 PR-URL: https://github.com/nodejs/node/pull/31524 Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig Reviewed-By: Daniel Bevenius Reviewed-By: Rich Trott --- src/base_object-inl.h | 4 ++-- src/node.h | 5 +++-- src/util.h | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/base_object-inl.h b/src/base_object-inl.h index fd194bc0a3e80d..a5a92128cf6967 100644 --- a/src/base_object-inl.h +++ b/src/base_object-inl.h @@ -28,12 +28,12 @@ #include "env-inl.h" #include "util.h" -#if defined(__GNUC__) && !defined(__clang__) +#if (__GNUC__ >= 8) && !defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wcast-function-type" #endif #include "v8.h" -#if defined(__GNUC__) && !defined(__clang__) +#if (__GNUC__ >= 8) && !defined(__clang__) #pragma GCC diagnostic pop #endif diff --git a/src/node.h b/src/node.h index 845fad5a063339..886216e2cb533e 100644 --- a/src/node.h +++ b/src/node.h @@ -60,14 +60,15 @@ # define SIGKILL 9 #endif -#if defined(__GNUC__) && !defined(__clang__) +#if (__GNUC__ >= 8) && !defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wcast-function-type" #endif #include "v8.h" // NOLINT(build/include_order) -#if defined(__GNUC__) && !defined(__clang__) +#if (__GNUC__ >= 8) && !defined(__clang__) #pragma GCC diagnostic pop #endif + #include "v8-platform.h" // NOLINT(build/include_order) #include "node_version.h" // NODE_MODULE_VERSION diff --git a/src/util.h b/src/util.h index 169e6491884542..a48e68588de890 100644 --- a/src/util.h +++ b/src/util.h @@ -24,12 +24,12 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#if defined(__GNUC__) && !defined(__clang__) +#if (__GNUC__ >= 8) && !defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wcast-function-type" #endif #include "v8.h" -#if defined(__GNUC__) && !defined(__clang__) +#if (__GNUC__ >= 8) && !defined(__clang__) #pragma GCC diagnostic pop #endif