RFR: 8367051: Build failure with clang on linux and AIX after switch to C++17

Martin Doerr mdoerr at openjdk.org
Tue Sep 9 13:39:31 UTC 2025


On Tue, 9 Sep 2025 01:00:30 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

> 8367051: Build failure with clang on linux and AIX after switch to C++17
> 
> Please review this change to work around build failures with clang on some
> platforms after the switch to C++17.
> 
> C++17 made the exception specification part of a function's type. Some
> standard libraries declare C library functions as noexcept. If HotSpot has a
> forbidding declaration for such a function (without a noexcept spec) before
> including the standard library header, clang reports this as an error (not
> just a warning that could be suppressed, a hard error). If the standard
> library header containing the noexpect declaration is first, then clang
> does *not* complain about the following forbidding declaration that doesn't
> have an exception spec. gcc permits either order.
> 
> So the workaround consists of ensuring all the standard library headers for
> forbidden functions are included before the forbidding declarations.
> 
> Exploration of other approaches to follow, but for now we need to fix the
> build errors.
> 
> Testing: mach5 tier1
> GHA saniticy checks in progress

Marked as reviewed by mdoerr (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/27154#pullrequestreview-3201654079


More information about the hotspot-dev mailing list