8308283: Build failure with GCC12 & GCC13

Reviewed-by: erikj, jiefu
This commit is contained in:
bobpengxie 2023-05-18 12:26:45 +00:00 committed by Jie Fu
parent 57b8ed1398
commit bfc3ccd90d
4 changed files with 12 additions and 2 deletions

View File

@ -456,7 +456,7 @@ else
unused-result array-bounds unused-result array-bounds
# noexcept-type required for GCC 7 builds. Not required for GCC 8+. # 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+. # 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_clang := missing-field-initializers range-loop-analysis
HARFBUZZ_DISABLED_WARNINGS_microsoft := 4267 4244 HARFBUZZ_DISABLED_WARNINGS_microsoft := 4267 4244

View File

@ -74,6 +74,10 @@
#define PRAGMA_STRINGOP_OVERFLOW_IGNORED #define PRAGMA_STRINGOP_OVERFLOW_IGNORED
#endif #endif
#ifndef PRAGMA_INFINITE_RECURSION_IGNORED
#define PRAGMA_INFINITE_RECURSION_IGNORED
#endif
#ifndef PRAGMA_NONNULL_IGNORED #ifndef PRAGMA_NONNULL_IGNORED
#define PRAGMA_NONNULL_IGNORED #define PRAGMA_NONNULL_IGNORED
#endif #endif

View File

@ -39,9 +39,12 @@
#define PRAGMA_DIAG_PUSH _Pragma("GCC diagnostic push") #define PRAGMA_DIAG_PUSH _Pragma("GCC diagnostic push")
#define PRAGMA_DIAG_POP _Pragma("GCC diagnostic pop") #define PRAGMA_DIAG_POP _Pragma("GCC diagnostic pop")
// Disable -Wdangling-pointer which is introduced in GCC 12.
#if !defined(__clang_major__) && (__GNUC__ >= 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") #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 #endif
#define PRAGMA_FORMAT_NONLITERAL_IGNORED \ #define PRAGMA_FORMAT_NONLITERAL_IGNORED \

View File

@ -190,6 +190,8 @@ static bool stack_has_headroom(size_t headroom) {
} }
#ifdef ASSERT #ifdef ASSERT
PRAGMA_DIAG_PUSH
PRAGMA_INFINITE_RECURSION_IGNORED
void VMError::reattempt_test_hit_stack_limit(outputStream* st) { void VMError::reattempt_test_hit_stack_limit(outputStream* st) {
if (stack_has_headroom(_reattempt_required_stack_headroom)) { if (stack_has_headroom(_reattempt_required_stack_headroom)) {
// Use all but (_reattempt_required_stack_headroom - K) unguarded stack space. // 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); controlled_crash(14);
} }
PRAGMA_DIAG_POP
#endif // ASSERT #endif // ASSERT
bool VMError::can_reattempt_step(const char* &stop_reason) { bool VMError::can_reattempt_step(const char* &stop_reason) {