From 8e5f6ddb68572c0cc8b6e256e423706f6f7cec94 Mon Sep 17 00:00:00 2001 From: Sam James Date: Thu, 22 Feb 2024 06:27:25 +0000 Subject: [PATCH] 8324243: Compilation failures in java.desktop module with gcc 14 Reviewed-by: jwaters, ihse, kbarrett, prr --- make/modules/java.desktop/lib/Awt2dLibraries.gmk | 4 +++- .../linux/native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiIn.c | 2 +- .../native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiUtils.c | 2 +- src/java.desktop/share/native/libfontmanager/sunFont.c | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/make/modules/java.desktop/lib/Awt2dLibraries.gmk b/make/modules/java.desktop/lib/Awt2dLibraries.gmk index e274005e607..6fc9ed2fb2b 100644 --- a/make/modules/java.desktop/lib/Awt2dLibraries.gmk +++ b/make/modules/java.desktop/lib/Awt2dLibraries.gmk @@ -506,8 +506,10 @@ else # noexcept-type required for GCC 7 builds. Not required for GCC 8+. # expansion-to-defined required for GCC 9 builds. Not required for GCC 10+. # maybe-uninitialized required for GCC 8 builds. Not required for GCC 9+. + # calloc-transposed-args required for GCC 14 builds. (fixed upstream in Harfbuzz 032c931e1c0cfb20f18e5acb8ba005775242bd92) HARFBUZZ_DISABLED_WARNINGS_CXX_gcc := class-memaccess noexcept-type \ - expansion-to-defined dangling-reference maybe-uninitialized + expansion-to-defined dangling-reference maybe-uninitialized \ + calloc-transposed-args HARFBUZZ_DISABLED_WARNINGS_clang := missing-field-initializers range-loop-analysis HARFBUZZ_DISABLED_WARNINGS_microsoft := 4267 4244 diff --git a/src/java.desktop/linux/native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiIn.c b/src/java.desktop/linux/native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiIn.c index 6ff6fc681e2..d7a3f1115b5 100644 --- a/src/java.desktop/linux/native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiIn.c +++ b/src/java.desktop/linux/native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiIn.c @@ -218,7 +218,7 @@ MidiMessage* MIDI_IN_GetMessage(MidiDeviceHandle* handle) { return NULL; } } - jdk_message = (MidiMessage*) calloc(sizeof(MidiMessage), 1); + jdk_message = (MidiMessage*) calloc(1, sizeof(MidiMessage)); if (!jdk_message) { ERROR0("< ERROR: MIDI_IN_GetMessage(): out of memory\n"); return NULL; diff --git a/src/java.desktop/linux/native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiUtils.c b/src/java.desktop/linux/native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiUtils.c index d528e4869ac..96193b5f734 100644 --- a/src/java.desktop/linux/native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiUtils.c +++ b/src/java.desktop/linux/native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiUtils.c @@ -383,7 +383,7 @@ INT32 openMidiDevice(snd_rawmidi_stream_t direction, INT32 deviceIndex, TRACE0("> openMidiDevice()\n"); - (*handle) = (MidiDeviceHandle*) calloc(sizeof(MidiDeviceHandle), 1); + (*handle) = (MidiDeviceHandle*) calloc(1, sizeof(MidiDeviceHandle)); if (!(*handle)) { ERROR0("ERROR: openDevice: out of memory\n"); return MIDI_OUT_OF_MEMORY; diff --git a/src/java.desktop/share/native/libfontmanager/sunFont.c b/src/java.desktop/share/native/libfontmanager/sunFont.c index 0461d61c26c..b50a67e5c40 100644 --- a/src/java.desktop/share/native/libfontmanager/sunFont.c +++ b/src/java.desktop/share/native/libfontmanager/sunFont.c @@ -67,7 +67,7 @@ int isNullScalerContext(void *context) { */ JNIEXPORT jlong JNICALL Java_sun_font_NullFontScaler_getGlyphImage (JNIEnv *env, jobject scaler, jlong pContext, jint glyphCode) { - void *nullscaler = calloc(sizeof(GlyphInfo), 1); + void *nullscaler = calloc(1, sizeof(GlyphInfo)); return ptr_to_jlong(nullscaler); }