RFR: 8275717: Reimplement STATIC_ASSERT to use static_assert

Erik Österlund eosterlund at openjdk.java.net
Fri Oct 22 14:20:06 UTC 2021


On Fri, 22 Oct 2021 08:15:52 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

> We currently have a bespoke implementation of STATIC_ASSERT, which was added before we transitioned over to C++14. I recently saw some compiler warnings (macos-aarch64) about that implementation. I propose that we reimplement STATIC_ASSERT to use static_assert. FWIW, some HotSpot code already uses static_assert instead of STATIC_ASSERT.
> 
> An alternative would be to completely remove STATIC_ASSERT and always use static_assert. That would require us to add a message string to all of the > 400 usages. Maybe we should wait with that until we can use C++17, which removes the requirement to provide a message?

Looks good.

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

Marked as reviewed by eosterlund (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/6077


More information about the hotspot-dev mailing list