RFR: 8367282: FORBID_C_FUNCTION needs exception spec consistent with library declaration
Matthias Baesken
mbaesken at openjdk.org
Wed Sep 10 08:21:45 UTC 2025
On Wed, 10 Sep 2025 02:58:31 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
> Please review this change to FORBID_C_FUNCTION to make the exception specs of
> the forbidding declarations match up with the exception specs of the
> associated library declarations. This needs to account for different platform
> libraries either having or not having exception specs. It's needed because,
> after switching to C++17, some compilers complain about some differences in
> the exception specs.
>
> Also removed the workaround for JDK-8367051, which should no longer be needed
> after this change.
>
> Hoping someone will test the aix-ppc port. @MBaesken or @TheRealMDoerr ?
>
> Testing: mach5 tier1, GHA sanity checks (nearly finished)
> Locally (linux-aarch64) built with clang, which failed without the JDK-8367051
> workaround.
Bad news from AIX, with this patch included we get build errors like this
=== Output from failing command(s) repeated here ===
* For target hotspot_variant-server_libjvm_objs_sharedRuntimeTrans.o:
In file included from /jdk/src/hotspot/share/runtime/sharedRuntimeTrans.cpp:26:
In file included from /jdk/src/hotspot/share/runtime/interfaceSupport.inline.hpp:31:
In file included from /jdk/src/hotspot/share/gc/shared/gc_globals.hpp:28:
In file included from /jdk/src/hotspot/share/runtime/globals_shared.hpp:28:
In file included from /jdk/src/hotspot/share/utilities/align.hpp:31:
In file included from /jdk/src/hotspot/share/utilities/globalDefinitions.hpp:31:
/jdk/src/hotspot/share/utilities/forbiddenFunctions.hpp:61:23: error: exception specification in declaration does not match previous declaration
61 | FORBID_C_FUNCTION(int sprintf(char*, const char*, ...), noexcept, "use os::snprintf");
| ^
/usr/include/stdio.h:325:12: note: previous declaration is here
325 | extern int sprintf(char *__restrict__, const char *__restrict__, ...);
| ^
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27180#issuecomment-3273852855
More information about the hotspot-dev
mailing list