There are a few places in Hotspot where we disable the particular warnings with compiler pragmas. Unfortunately, those checks sometimes take the form of:
```
// Disable -Wstringop-truncation which is introduced in GCC 8.
// https://gcc.gnu.org/gcc-8/changes.html
#if !defined(__clang_major__) && (__GNUC__ >= 8)
#define PRAGMA_STRINGOP_TRUNCATION_IGNORED PRAGMA_DISABLE_GCC_WARNING("-Wstringop-truncation")
#endif
```
...because touching the non-existent option with pragmas fails on old compilers, see for exampleJDK-8288048.
In here:
https://github.com/openjdk/jdk/pull/9090#pullrequestreview-1000840657
...Kim suggests to add `-Wunknown-pragmas` to `PRAGMA_DISABLE_GCC_WARNING` macro to make compilers eat up unknown pragmas unconditionally, thus eliminating the need for compiler-version-specific hacks like above.
```
// Disable -Wstringop-truncation which is introduced in GCC 8.
// https://gcc.gnu.org/gcc-8/changes.html
#if !defined(__clang_major__) && (__GNUC__ >= 8)
#define PRAGMA_STRINGOP_TRUNCATION_IGNORED PRAGMA_DISABLE_GCC_WARNING("-Wstringop-truncation")
#endif
```
...because touching the non-existent option with pragmas fails on old compilers, see for example
In here:
https://github.com/openjdk/jdk/pull/9090#pullrequestreview-1000840657
...Kim suggests to add `-Wunknown-pragmas` to `PRAGMA_DISABLE_GCC_WARNING` macro to make compilers eat up unknown pragmas unconditionally, thus eliminating the need for compiler-version-specific hacks like above.
- relates to
-
JDK-8288048 Build failure with GCC 6 after JDK-8286562
- Resolved