Skip to content

Commit

Permalink
8274400: HotSpot Style Guide should permit use of alignof
Browse files Browse the repository at this point in the history
Reviewed-by: kbarrett, kvn, dholmes, dcubed
  • Loading branch information
TheShermanTanker committed Mar 11, 2023
1 parent 98a7a60 commit a06426a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
11 changes: 10 additions & 1 deletion doc/hotspot-style.html
Original file line number Diff line number Diff line change
Expand Up @@ -598,10 +598,17 @@ <h3 id="c-standard-library">C++ Standard Library</h3>
<code>std::nothrow</code>, and <code>std::nothrow_t</code>.</li>
<li><code>#include &lt;limits&gt;</code> to use
<code>std::numeric_limits</code>.</li>
<li><code>#include &lt;type_traits&gt;</code>.</li>
<li><code>#include &lt;type_traits&gt;</code> with some restrictions,
listed below.</li>
<li><code>#include &lt;cstddef&gt;</code> to use
<code>std::nullptr_t</code> and <code>std::max_align_t</code>.</li>
</ul>
<p>Certain restrictions apply to the declarations provided by
<code>&lt;type_traits&gt;</code>.</p>
<ul>
<li>The <code>alignof</code> operator should be used rather than
<code>std::alignment_of&lt;&gt;</code>.</li>
</ul>
<p>TODO: Rather than directly #including (permitted) Standard Library
headers, use a convention of #including wrapper headers (in some
location like hotspot/shared/stdcpp). This provides a single place for
Expand Down Expand Up @@ -1086,6 +1093,8 @@ <h3 id="attributes">Attributes</h3>
<h3 id="additional-permitted-features">Additional Permitted
Features</h3>
<ul>
<li><p><code>alignof</code> (<a
href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf">n2341</a>)</p></li>
<li><p><code>constexpr</code> (<a
href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf">n2235</a>)
(<a
Expand Down
9 changes: 8 additions & 1 deletion doc/hotspot-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,13 @@ There are a few exceptions to this rule.

* `#include <new>` to use placement `new`, `std::nothrow`, and `std::nothrow_t`.
* `#include <limits>` to use `std::numeric_limits`.
* `#include <type_traits>`.
* `#include <type_traits>` with some restrictions, listed below.
* `#include <cstddef>` to use `std::nullptr_t` and `std::max_align_t`.

Certain restrictions apply to the declarations provided by `<type_traits>`.

* The `alignof` operator should be used rather than `std::alignment_of<>`.

TODO: Rather than directly \#including (permitted) Standard Library
headers, use a convention of \#including wrapper headers (in some
location like hotspot/shared/stdcpp). This provides a single place
Expand Down Expand Up @@ -1082,6 +1086,9 @@ The following attributes are expressly forbidden:
### Additional Permitted Features
* `alignof`
([n2341](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf))
* `constexpr`
([n2235](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf))
([n3652](https://isocpp.org/files/papers/N3652.html))
Expand Down

0 comments on commit a06426a

Please sign in to comment.