RFR: 8302124: HotSpot Style Guide should permit noreturn attribute
Kim Barrett
kbarrett at openjdk.org
Mon Feb 27 10:49:34 UTC 2023
On Thu, 16 Feb 2023 17:26:57 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> Ah, I see, thanks for the clarification behind the location of the attribute changing where it applies to, that was something I'd forgotten. I'd argue that eventually biting the bullet and changing the attribute positions that we already have under macros (can be done in one fell swoop honestly) is a net gain since they now have well defined behaviour according to C++ and we know what they apply to exactly, but I don't know how much you'd agree on that point
>>
>> Speaking of moving to C++17 though, what about C++20? It's the C++ version that Visual C++ gives access to the noinline and forceinline attributes which are guaranteed to not inline or always inline, as opposed to what we have now, which globalDefinitions_visCPP notes that we are uncertain whether they actually work, and while it's probably farfetched to jump an entire version of C++ just for that, I found it pretty interesting and wondered what you'd have to say about that
>
> Moving to a newer C++ language version requires compiler support, for all
> supported OpenJDK ports (*). Only recently has the xlclang compiler used by
> the aix-ppc port had a version that supported C++17. (I think it was released
> last summer/fall.) I don't know when they might release a version supporting
> C++20. Use of that new version is being investigated by the port maintainers.
> I've done a little bit of peeking ahead to C++17 as well, and haven't yet run
> into any problems with the Oracle-supported ports (which is what I expected).
>
> (*) Non-open licensee ports also need to be considered, though I'm not sure
> what the requirements are there. I know of one such that didn't yet have
> complete C++14 support when we adopted it for OpenJDK.
> I've no idea how standard attributes and gcc `__attribute__` or msvc `__declspec` interact syntactically. My hope would be that they can interleave, but I have no idea whether that's true or not. I guess some research is needed, though I think it doesn't matter for the current set. (I doubt anyone is going to declare a function both noreturn and always-inline, for example.)
I did some experimenting, and it looks like they interleave without any problems. And I even found a potential
use-case for noreturn + always-inline. :)
-------------
PR: https://git.openjdk.org/jdk/pull/12507
More information about the hotspot-dev
mailing list