RFR: 8330520: linux ppc64le clang build fails in os_linux.cpp with static_assert with no message is a C++17 extension

Stefan Karlsson stefank at openjdk.org
Wed Apr 17 15:04:43 UTC 2024


On Wed, 17 Apr 2024 14:35:56 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

> We run into the following build error when compiling on Linux ppc64le with the clang toolchain
> 
> 
> jdk/src/hotspot/os/linux/os_linux.cpp:2975:65: error: 'static_assert' with no message is a C++17 extension [-Werror,-Wc++17-extensions]
> static_assert(MADV_POPULATE_WRITE == MADV_POPULATE_WRITE_value);
> 
> 
> Currently it is not clear when "8314488: Compile the JDK as C++17" will be in the codebase so better fix the static_assert .

I have an alternative fix that gets rid of the redundant string.

src/hotspot/os/linux/os_linux.cpp line 2975:

> 2973: #else
> 2974:   // Sanity-check our assumed default value if we build with a new enough libc.
> 2975:   static_assert(MADV_POPULATE_WRITE == MADV_POPULATE_WRITE_value, "MADV_POPULATE_WRITE != MADV_POPULATE_WRITE_value");

Maybe use this instead?
Suggestion:

  STATIC_ASSERT(MADV_POPULATE_WRITE == MADV_POPULATE_WRITE_value);

-------------

Changes requested by stefank (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/18816#pullrequestreview-2006306150
PR Review Comment: https://git.openjdk.org/jdk/pull/18816#discussion_r1569000710


More information about the hotspot-runtime-dev mailing list