From 14a014d4303efda69bd0acbdf71139534601b49a Mon Sep 17 00:00:00 2001 From: Kim Barrett Date: Tue, 28 Feb 2023 01:59:03 +0000 Subject: [PATCH] 8302124: HotSpot Style Guide should permit noreturn attribute Reviewed-by: dcubed, iveresov, dholmes, tschatzl, jwaters, kvn --- doc/hotspot-style.html | 31 ++++++++++++++++++++++++++----- doc/hotspot-style.md | 33 ++++++++++++++++++++++++++------- 2 files changed, 52 insertions(+), 12 deletions(-) diff --git a/doc/hotspot-style.html b/doc/hotspot-style.html index 777d69b0a2e..d1906f49374 100644 --- a/doc/hotspot-style.html +++ b/doc/hotspot-style.html @@ -82,6 +82,7 @@ id="toc-uniform-initialization">Uniform Initialization id="toc-local-function-objects">Local Function Objects
  • Inheriting constructors
  • +
  • Attributes
  • Additional Permitted Features
  • @@ -1057,6 +1058,31 @@ using C++17 or later. It is also enabled by default for 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.

    +

    Attributes

    +

    The use of some attributes (n2761) +(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.

    + +

    Only the following attributes are permitted:

    + +

    The following attributes are expressly forbidden:

    +

    Additional Permitted Features

    diff --git a/doc/hotspot-style.md b/doc/hotspot-style.md index 555453498d3..b6a25023875 100644 --- a/doc/hotspot-style.md +++ b/doc/hotspot-style.md @@ -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` @@ -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)) — -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. @@ -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