RFR: 8316930: HotSpot should use noexcept instead of throw() [v2]

Julian Waters jwaters at openjdk.org
Thu Jan 11 13:12:55 UTC 2024


On Fri, 29 Sep 2023 00:32:11 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

> > > The change from `throw()` to `noexcept` seems reasonable though I assume we have to first approve this via the Hostpot style guide?
> > > There are places you are adding `noexcept` when there is no `throw()` and that seems inappropriate for this PR - unless they are required because of some transitive rule application?
> > > Thanks.
> > 
> > 
> > Oops, those places where noexcept slipped through are from an experimental branch where I enabled exceptions for HotSpot, they got in by mistake, my apologies. I've moved this to draft for now, since Apple Clang seems to be having a hard time with the noexcept specifiers. Not sure about the Style Guide, maybe I should ask @kimbarrett?
> 
> I've added https://bugs.openjdk.org/browse/JDK-8255082 as a blocker for this bug. As noted there, addressing that is not as simple as just saying "yes, we can use noexcept".
> 
> And no, we're not going to enable exceptions in HotSpot.
> 
> I'd be interested in hearing what problems you've run into with Apple clang wrto noexcept.

No worries, the branch with the Exceptions enabled HotSpot is for my own personal use. Apple Clang seems to have issues parsing noexcept in operator new, as seen in the tests for this PR:


make[1]: *** [/Users/runner/work/jdk/jdk/make/Init.gmk:323: main] Error 2
=== Output from failing command(s) repeated here ===
make: *** [/Users/runner/work/jdk/jdk/make/Init.gmk:[189](https://github.com/TheShermanTanker/jdk/actions/runs/6307800420/job/17125236356#step:8:191): product-bundles] Error 2
* For target hotspot_variant-server_tools_adlc_objs_adlArena.o:
In file included from /Users/runner/work/jdk/jdk/src/hotspot/share/adlc/adlArena.cpp:25:
In file included from /Users/runner/work/jdk/jdk/src/hotspot/share/adlc/adlc.hpp:88:
/Users/runner/work/jdk/jdk/src/hotspot/share/adlc/adlArena.hpp:43:34: error: expected ';' at end of declaration list
  void* operator new(size_t size) noexcept;
                                 ^
                                 ;
/Users/runner/work/jdk/jdk/src/hotspot/share/adlc/adlArena.hpp:52:34: error: expected ';' at end of declaration list
  void* operator new(size_t size) noexcept;
                                 ^
                                 ;
/Users/runner/work/jdk/jdk/src/hotspot/share/adlc/adlArena.hpp:66:49: error: expected ';' at end of declaration list
  void* operator new(size_t size, size_t length) noexcept;
                                                ^
                                                ;
/Users/runner/work/jdk/jdk/src/hotspot/share/adlc/adlArena.cpp:47:68: error: expected function body after function declarator
   ... (rest of output omitted)
* For target hotspot_variant-server_tools_adlc_objs_adlparse.o:
In file included from /Users/runner/work/jdk/jdk/src/hotspot/share/adlc/adlparse.cpp:27:
In file included from /Users/runner/work/jdk/jdk/src/hotspot/share/adlc/adlc.hpp:88:
/Users/runner/work/jdk/jdk/src/hotspot/share/adlc/adlArena.hpp:43:34: error: expected ';' at end of declaration list
  void* operator new(size_t size) noexcept;
                                 ^
                                 ;
/Users/runner/work/jdk/jdk/src/hotspot/share/adlc/adlArena.hpp:52:34: error: expected ';' at end of declaration list
  void* operator new(size_t size) noexcept;
                                 ^
                                 ;
/Users/runner/work/jdk/jdk/src/hotspot/share/adlc/adlArena.hpp:66:49: error: expected ';' at end of declaration list
  void* operator new(size_t size, size_t length) noexcept;
                                                ^
                                                ;
3 errors generated.

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

PR Comment: https://git.openjdk.org/jdk/pull/15910#issuecomment-1740210539


More information about the hotspot-dev mailing list