RFR: 8355561: [macos] Build failure with Xcode 16.3

Julian Waters jwaters at openjdk.org
Wed Apr 30 10:31:50 UTC 2025


On Mon, 28 Apr 2025 19:47:03 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

> Multiple similar issues detected in PLATFORM_API_MacOSX_Ports.cpp more info about https://github.com/llvm/llvm-project/issues/62836
> 
> jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:127:39: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension]
>   127 | AudioDeviceID devices[count];
>       | ^~~~~
> jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:127:39: note: read of non-const variable 'count' is not allowed in a constant expression
> jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:126:21: note: declared here
>   126 | int count = size/sizeof(AudioDeviceID);
> 
> The usage of VLA has been replaced with malloc/calloc and free, which are already used in this file.
> 
> Note that while this patch adds some validation, I am pretty sure it is still possible to crash these code paths if they are executed concurrently. Access to the native pointers being passed around is not properly synchronized.

Why not new and delete?

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

PR Comment: https://git.openjdk.org/jdk/pull/24937#issuecomment-2841530732


More information about the client-libs-dev mailing list