Some symbols have unguarded availability with older deployment targets

Issue #278 resolved
Maxime Belanger created an issue

We configure our build using -Werror=unguarded-availability and MACOSX_DEPLOYMENT_TARGET=10.10 to support deployment to down-level versions of macOS and to have confidence that unavailable symbols are not accidentally required. When recently trying out the new PyObjC 6.0 for 10.15 compatibility, we noticed the following error when building pyobjc-framework-Cocoa :

Modules/_AppKit_inlines.m:9:32: warning: 'NSDirectionalEdgeInsetsMake' is only available on macOS 10.15 or newer [-Wunguarded-availability-new]
     (PyObjC_Function_Pointer)&NSDirectionalEdgeInsetsMake},
                               ^
/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCollectionViewCompositionalLayout.h:74:35: note: 
      'NSDirectionalEdgeInsetsMake' has been marked as being introduced in macOS 10.15 here, but the deployment target is macOS 10.10.0
NS_INLINE NSDirectionalEdgeInsets NSDirectionalEdgeInsetsMake(CGFloat top, CGFloat leading, CGFloat bottom, CGFloat trailing) API_AVAILABLE(macos(10.15)) NS...
                                  ^
Modules/_AppKit_inlines.m:6:28: note: annotate 'function_map' with an availability attribute to silence this warning
static PyObjC_function_map function_map[] = {
                           ^

It appears that this symbol is not protected/guarded, at least according to clang.

Comments (4)

  1. Ronald Oussoren repo owner

    This shouldn’t be a problem for these functions because these are inline functions with a trivial implementation.

    Changeset 64f65a19be9f suppresses this warning in all _inlines extensions.

  2. Ronald Oussoren repo owner

    Closing this as resolved because this is not a problem when deploying to older macOS releases and I have applied a patch that surprises the error.

  3. Log in to comment