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