Skip to content

Commit

Permalink
Increase severity level of -Wunguarded-availability-new on XCode 9
Browse files Browse the repository at this point in the history
  • Loading branch information
kleisauke committed Nov 8, 2022
1 parent f96948e commit d07a712
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions mesonbuild/compilers/mixins/clang.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,24 @@ def has_function(self, funcname: str, prefix: str, env: 'Environment', *,
dependencies: T.Optional[T.List['Dependency']] = None) -> T.Tuple[bool, bool]:
if extra_args is None:
extra_args = []
# Starting with XCode 8, we need to pass this to force linker
# visibility to obey OS X/iOS/tvOS minimum version targets with
# -mmacosx-version-min, -miphoneos-version-min, -mtvos-version-min etc.
# https://github.com/Homebrew/homebrew-core/issues/3727
# TODO: this really should be communicated by the linker
if isinstance(self.linker, AppleDynamicLinker) and mesonlib.version_compare(self.version, '>=8.0'):
extra_args.append('-Wl,-no_weak_imports')
if isinstance(self.linker, AppleDynamicLinker):
# Starting with XCode 8, we need to pass this to force linker
# visibility to obey OS X/iOS/tvOS minimum version targets with
# -mmacosx-version-min, -miphoneos-version-min, -mtvos-version-min etc.
# https://github.com/Homebrew/homebrew-core/issues/3727
if mesonlib.version_compare(self.version, '>=8.0'):
extra_args.append('-Wl,-no_weak_imports')
# XCode 9 introduced two new warnings:
# -Wunguarded-availability and Wunguarded-availability-new
# The former is off by default, the latter on by default,
# -Wunguarded-availability-new only warns about APIs introduced
# in or after macOS 10.13, iOS 11, tvOS 11 or watchOS 4.
# Since macOS 10.13 was EOLed on 1 Dec 2020, there's no need to
# increase the severity level of the former warning.
# https://github.com/lovell/sharp/issues/3438
if mesonlib.version_compare(self.version, '>=9.0'):
extra_args.append('-Werror=unguarded-availability-new')
return super().has_function(funcname, prefix, env, extra_args=extra_args,
dependencies=dependencies)

Expand Down

0 comments on commit d07a712

Please sign in to comment.