Xcode 16.3 - JUCE 8.0.7 - warning cast-function-type-mismatch

Hello,
I updated to Xcode 16.3 and JUCE generates 95 warnings due to “-Wcast-function-type-mismatch”.
For example:

JUCE/modules/juce_core/native/juce_ObjCHelpers_mac.h:349:73: warning: cast from 'NSApplicationTerminateReply (*)(id, SEL, NSApplication *)' to 'IMP' (aka 'id  _Nullable (*)(id _Nonnull, SEL _Nonnull, ...)') converts to incompatible function type [-Wcast-function-type-mismatch]
  349 |         [[maybe_unused]] const auto b = class_addMethod (cls, selector, (IMP) callbackFn, s.data());

We’ve added some fixes for Xcode 16.3 warnings to the develop branch. Could you please see if they’re already addressed?

Yes, it’s still present on the branch develop (3924429)

Is this appearing in any of the projects included with JUCE, like the DemoRunner? If so, what steps are you taking to build?

I’m sorry, this seems to be linked to compiling for x86_64 (at least on my Silicon machine) and using the -Wextra flag. Here is how to reproduce it:
cmake -Bbuild -G Xcode -DJUCE_BUILD_EXTRAS=ON -DJUCE_BUILD_EXAMPLES=ON -DCMAKE_XCODE_GENERATE_SCHEME=ON -DCMAKE_OSX_ARCHITECTURES="\$(ARCHS_STANDARD)" -DCMAKE_CXX_FLAGS="-Wall -Wextra"
Then compile the AudioPluginHost for instance.

P.S. I created a PR in case you want to fix this issues, otherwise feel free to close it.

Thanks, that’s fixed here:

1 Like