diff --git a/make/modules/java.desktop/lib/Awt2dLibraries.gmk b/make/modules/java.desktop/lib/Awt2dLibraries.gmk index c3b756423fd..a404fc939d4 100644 --- a/make/modules/java.desktop/lib/Awt2dLibraries.gmk +++ b/make/modules/java.desktop/lib/Awt2dLibraries.gmk @@ -456,7 +456,7 @@ else unused-result array-bounds # noexcept-type required for GCC 7 builds. Not required for GCC 8+. # expansion-to-defined required for GCC 9 builds. Not required for GCC 10+. - HARFBUZZ_DISABLED_WARNINGS_CXX_gcc := class-memaccess noexcept-type expansion-to-defined + HARFBUZZ_DISABLED_WARNINGS_CXX_gcc := class-memaccess noexcept-type expansion-to-defined dangling-reference HARFBUZZ_DISABLED_WARNINGS_clang := missing-field-initializers range-loop-analysis HARFBUZZ_DISABLED_WARNINGS_microsoft := 4267 4244 diff --git a/src/hotspot/share/utilities/compilerWarnings.hpp b/src/hotspot/share/utilities/compilerWarnings.hpp index 6fd085530eb..28954843dc3 100644 --- a/src/hotspot/share/utilities/compilerWarnings.hpp +++ b/src/hotspot/share/utilities/compilerWarnings.hpp @@ -74,6 +74,10 @@ #define PRAGMA_STRINGOP_OVERFLOW_IGNORED #endif +#ifndef PRAGMA_INFINITE_RECURSION_IGNORED +#define PRAGMA_INFINITE_RECURSION_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 8104c8f7684..53373ec628a 100644 --- a/src/hotspot/share/utilities/compilerWarnings_gcc.hpp +++ b/src/hotspot/share/utilities/compilerWarnings_gcc.hpp @@ -39,9 +39,12 @@ #define PRAGMA_DIAG_PUSH _Pragma("GCC diagnostic push") #define PRAGMA_DIAG_POP _Pragma("GCC diagnostic pop") -// Disable -Wdangling-pointer which is introduced in GCC 12. #if !defined(__clang_major__) && (__GNUC__ >= 12) +// Disable -Wdangling-pointer which is introduced in GCC 12. #define PRAGMA_DANGLING_POINTER_IGNORED PRAGMA_DISABLE_GCC_WARNING("-Wdangling-pointer") + +// Disable -Winfinite-recursion which is introduced in GCC 12. +#define PRAGMA_INFINITE_RECURSION_IGNORED PRAGMA_DISABLE_GCC_WARNING("-Winfinite-recursion") #endif #define PRAGMA_FORMAT_NONLITERAL_IGNORED \ diff --git a/src/hotspot/share/utilities/vmError.cpp b/src/hotspot/share/utilities/vmError.cpp index 58b80d4e4d9..c8d0b93744e 100644 --- a/src/hotspot/share/utilities/vmError.cpp +++ b/src/hotspot/share/utilities/vmError.cpp @@ -190,6 +190,8 @@ static bool stack_has_headroom(size_t headroom) { } #ifdef ASSERT +PRAGMA_DIAG_PUSH +PRAGMA_INFINITE_RECURSION_IGNORED void VMError::reattempt_test_hit_stack_limit(outputStream* st) { if (stack_has_headroom(_reattempt_required_stack_headroom)) { // Use all but (_reattempt_required_stack_headroom - K) unguarded stack space. @@ -220,6 +222,7 @@ void VMError::reattempt_test_hit_stack_limit(outputStream* st) { } controlled_crash(14); } +PRAGMA_DIAG_POP #endif // ASSERT bool VMError::can_reattempt_step(const char* &stop_reason) {