From 59b0de6bc7064b39cdc51517dee4f4d96af3efaf Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Thu, 9 Jun 2022 14:16:07 +0000 Subject: [PATCH] 8288048: Build failure with GCC 6 after JDK-8286562 Reviewed-by: kbarrett, ysuenaga --- .../checkpoint/types/traceid/jfrTraceIdBits.inline.hpp | 2 +- src/hotspot/share/utilities/compilerWarnings.hpp | 4 ++++ src/hotspot/share/utilities/compilerWarnings_gcc.hpp | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdBits.inline.hpp b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdBits.inline.hpp index 4bbd0c8ae18..0b939d63f78 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdBits.inline.hpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdBits.inline.hpp @@ -138,7 +138,7 @@ inline void JfrTraceIdBits::store(jbyte bits, const T* ptr) { // goes away with minor code perturbations, such as replacing function calls // with equivalent code directly inlined. PRAGMA_DIAG_PUSH - PRAGMA_DISABLE_GCC_WARNING("-Wstringop-overflow") + PRAGMA_STRINGOP_OVERFLOW_IGNORED set(bits, traceid_tag_byte(ptr)); PRAGMA_DIAG_POP } diff --git a/src/hotspot/share/utilities/compilerWarnings.hpp b/src/hotspot/share/utilities/compilerWarnings.hpp index d1fca37c697..c3de6863f8a 100644 --- a/src/hotspot/share/utilities/compilerWarnings.hpp +++ b/src/hotspot/share/utilities/compilerWarnings.hpp @@ -66,6 +66,10 @@ #define PRAGMA_STRINGOP_TRUNCATION_IGNORED #endif +#ifndef PRAGMA_STRINGOP_OVERFLOW_IGNORED +#define PRAGMA_STRINGOP_OVERFLOW_IGNORED +#endif + #ifndef PRAGMA_NONNULL_IGNORED #define PRAGMA_NONNULL_IGNORED #endif diff --git a/src/hotspot/share/utilities/compilerWarnings_gcc.hpp b/src/hotspot/share/utilities/compilerWarnings_gcc.hpp index 7a039076a25..1636ad48fba 100644 --- a/src/hotspot/share/utilities/compilerWarnings_gcc.hpp +++ b/src/hotspot/share/utilities/compilerWarnings_gcc.hpp @@ -50,6 +50,12 @@ #define PRAGMA_STRINGOP_TRUNCATION_IGNORED PRAGMA_DISABLE_GCC_WARNING("-Wstringop-truncation") #endif +// Disable -Wstringop-overflow which is introduced in GCC 7. +// https://gcc.gnu.org/gcc-7/changes.html +#if !defined(__clang_major__) && (__GNUC__ >= 7) +#define PRAGMA_STRINGOP_OVERFLOW_IGNORED PRAGMA_DISABLE_GCC_WARNING("-Wstringop-overflow") +#endif + #define PRAGMA_NONNULL_IGNORED \ PRAGMA_DISABLE_GCC_WARNING("-Wnonnull")