On Tue, 23 Jan 2024 19:13:40 GMT, Phil Race <p...@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. Sure, I wasn't exactly hiding that it was cherry-picked. I did not consider (2) to be an issue given OpenJDK wholesale imports releases, but w/e. (The fix is also trivial and essentially the only possible fix...) Anyway, happy to do that. Can you suggest what the idiomatic way of doing that in the OpenJDK codebase is for imported libs? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/17506#discussion_r1463871450