RFR: 8255082: HotSpot Style Guide should permit noexcept

David Holmes dholmes at openjdk.org
Mon Jun 2 07:02:52 UTC 2025


On Mon, 2 Jun 2025 05:28:17 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

> Please review this change to permit the use of `noexcept` under certain
> circumstances in HotSpot code.
> 
> http://wg21.link/n3050
> 
> Testing:
> 
> JDK-8316930 (HotSpot should use noexcept instead of throw()) showed what the
> conversion would look like. It will need to be brought up to current mainline,
> possibly with modifications.
> 
> This is a modification of the Style Guide, so rough consensus among the
> HotSpot Group members is required to make this change. Only Group members
> should vote for approval (via the github PR), though reasoned objections or
> comments from anyone will be considered. A decision on this proposal will not
> be made before Friday 16-June-2025 at 12h00 UTC.
> 
> Since we're piggybacking on github PRs here, please use the PR review process
> to approve (click on Review Changes > Approve), rather than sending a "vote:
> yes" email reply that would be normal for a CFV.

I approve of this change.

A couple of minor tweaks to the text suggested.

Thanks

doc/hotspot-style.md line 1114:

> 1112: 
> 1113: * Only the abbreviated form of `noexcept` exception specifications are
> 1114: permitted. `noexcept` exception specifications with arguments are forbidden.

Suggestion:

* Only the argument-less form of `noexcept` exception specifications is permitted.

doc/hotspot-style.md line 1131:

> 1129: 
> 1130: The second is to allow the compiler and library code to choose different
> 1131: algorithms, depending on whether a some function may throw exceptions. This is

Suggestion:

algorithms, depending on whether some function may throw exceptions. This is

doc/hotspot-style.md line 1139:

> 1137: such a function `noexcept` informs the compiler that `nullptr` is a possible
> 1138: result. If an allocation function is not declared `noexcept` then the compiler
> 1139: may elide that checking and handling for a using `new` expression.

Suggestion:

may elide that checking and handling for a `new` expression.

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

Marked as reviewed by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/25574#pullrequestreview-2887010579
PR Review Comment: https://git.openjdk.org/jdk/pull/25574#discussion_r2120226615
PR Review Comment: https://git.openjdk.org/jdk/pull/25574#discussion_r2120229061
PR Review Comment: https://git.openjdk.org/jdk/pull/25574#discussion_r2120234324


More information about the hotspot-dev mailing list