RFR: 8324243: Fix GCC 14 build

Phil Race prr at openjdk.org
Tue Jan 23 19:16:29 UTC 2024


On Sat, 20 Jan 2024 10:15:02 GMT, Sam James <duke at openjdk.org> wrote:

> This fixes building with GCC 14:
> * Cherry-pick a fix from Harfbuzz upstream
> * Apply other `-Wcalloc-transposed-args` fixes to the JDK sources
> 
> -Wcalloc-transposed-args errors out with GCC 14 as the OpenJDK build uses
> -Werror.
> 
> The calloc prototype is:
> 
> void *calloc(size_t nmemb, size_t size);
> 
> 
> So, just swap the number of members and size arguments to match the prototype, as
> we're initialising 1 struct of size `sizeof(struct ...)`. GCC then sees we're not
> doing anything wrong.

src/java.desktop/share/native/libharfbuzz/hb-object.hh line 328:

> 326:   if (unlikely (!user_data))
> 327:   {
> 328:     user_data = (hb_user_data_array_t *) hb_calloc (sizeof (hb_user_data_array_t), 1);

Note 
(1) We don't cherry pick unless it is critical.
(2) I doubt you have ownership of harfbuzz code such that you can contribute any part of it to JDK in accordance with the OCA you signed.

Accordingly, the right thing to do here is disable the warning for this library and tool chain.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17506#discussion_r1463867176


More information about the client-libs-dev mailing list