Skip to content

Commit

Permalink
8302124: HotSpot Style Guide should permit noreturn attribute
Browse files Browse the repository at this point in the history
Reviewed-by: dcubed, iveresov, dholmes, tschatzl, jwaters, kvn
  • Loading branch information
Kim Barrett committed Feb 28, 2023
1 parent bca60f4 commit 14a014d
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 12 deletions.
31 changes: 26 additions & 5 deletions doc/hotspot-style.html
Expand Up @@ -82,6 +82,7 @@ <h1 class="title">HotSpot Coding Style</h1>
id="toc-local-function-objects">Local Function Objects</a></li>
<li><a href="#inheriting-constructors"
id="toc-inheriting-constructors">Inheriting constructors</a></li>
<li><a href="#attributes" id="toc-attributes">Attributes</a></li>
<li><a href="#additional-permitted-features"
id="toc-additional-permitted-features">Additional Permitted
Features</a></li>
Expand Down Expand Up @@ -1057,6 +1058,31 @@ <h3 id="inheriting-constructors">Inheriting constructors</h3>
C++11/14, as the change is considered a Defect Report that applies to
those versions. Earlier versions of gcc don't have that option, and
other supported compilers may not have anything similar.</p>
<h3 id="attributes">Attributes</h3>
<p>The use of some attributes (<a
href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2761.pdf">n2761</a>)
(listed below) is permitted. (Note that some of the attributes defined
in that paper didn't make it into the final specification.)</p>
<p>Attributes are syntactically permitted in a broad set of locations,
but specific attributes are only permitted in a subset of those
locations. In some cases an attribute that appertains to a given element
may be placed in any of several locations with the same meaning. In
those cases HotSpot has a preferred location.</p>
<ul>
<li>An attribute that appertains to a function is placed at the
beginning of the function's declaration, rather than between the
function name and the parameter list.</li>
</ul>
<p>Only the following attributes are permitted:</p>
<ul>
<li><code>[[noreturn]]</code></li>
</ul>
<p>The following attributes are expressly forbidden:</p>
<ul>
<li><code>[[carries_dependency]]</code> - Related to
<code>memory_order_consume</code>.</li>
<li><code>[[deprecated]]</code> - Not relevant in HotSpot code.</li>
</ul>
<h3 id="additional-permitted-features">Additional Permitted
Features</h3>
<ul>
Expand Down Expand Up @@ -1149,9 +1175,6 @@ <h3 id="excluded-features">Excluded Features</h3>
difficult to deal with and lead to surprises, as can destruction
ordering. HotSpot doesn't generally try to cleanup on exit, and running
destructors at exit can also lead to problems.</p></li>
<li><p><code>[[deprecated]]</code> attribute (<a
href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3760.html">n3760</a>)
— Not relevant in HotSpot code.</p></li>
<li><p>Avoid most operator overloading, preferring named functions. When
operator overloading is used, ensure the semantics conform to the normal
expected behavior of the operation.</p></li>
Expand All @@ -1171,8 +1194,6 @@ <h3 id="undecided-features">Undecided Features</h3>
href="https://isocpp.org/files/papers/N3651.pdf">n3651</a>)</p></li>
<li><p>Member initializers and aggregates (<a
href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3653.html">n3653</a>)</p></li>
<li><p><code>[[noreturn]]</code> attribute (<a
href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2761.pdf">n2761</a>)</p></li>
<li><p>Rvalue references and move semantics</p></li>
</ul>
</body>
Expand Down
33 changes: 26 additions & 7 deletions doc/hotspot-style.md
Expand Up @@ -1054,6 +1054,32 @@ and other supported compilers may not have anything similar.
[p0136r1]: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0136r1.html
"p0136r1"

### Attributes

The use of some attributes
([n2761](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2761.pdf))
(listed below) is permitted. (Note that some of the attributes defined in
that paper didn't make it into the final specification.)

Attributes are syntactically permitted in a broad set of locations, but
specific attributes are only permitted in a subset of those locations. In
some cases an attribute that appertains to a given element may be placed in
any of several locations with the same meaning. In those cases HotSpot has a
preferred location.

* An attribute that appertains to a function is placed at the beginning of the
function's declaration, rather than between the function name and the parameter
list.

Only the following attributes are permitted:

* `[[noreturn]]`

The following attributes are expressly forbidden:

* `[[carries_dependency]]` - Related to `memory_order_consume`.
* `[[deprecated]]` - Not relevant in HotSpot code.

### Additional Permitted Features

* `constexpr`
Expand Down Expand Up @@ -1153,10 +1179,6 @@ difficult to deal with and lead to surprises, as can destruction
ordering. HotSpot doesn't generally try to cleanup on exit, and
running destructors at exit can also lead to problems.

* `[[deprecated]]` attribute
([n3760](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3760.html)) &mdash;
Not relevant in HotSpot code.

* Avoid most operator overloading, preferring named functions. When
operator overloading is used, ensure the semantics conform to the
normal expected behavior of the operation.
Expand All @@ -1181,9 +1203,6 @@ features that have not yet been discussed.
* Member initializers and aggregates
([n3653](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3653.html))

* `[[noreturn]]` attribute
([n2761](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2761.pdf))

* Rvalue references and move semantics

[ADL]: https://en.cppreference.com/w/cpp/language/adl
Expand Down

1 comment on commit 14a014d

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.