diff --git a/src/base_object-inl.h b/src/base_object-inl.h index 3d36eaa923012e..8b2b30021a8520 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 b615ac8c2138d1..189f94d9438ee5 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 562bed5c3d4619..5eaa20b760168b 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