diff options
-rw-r--r-- | mesonbuild/compilers/c.py | 9 | ||||
-rw-r--r-- | mesonbuild/compilers/compilers.py | 1 |
2 files changed, 3 insertions, 7 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index c8e473a5a..a2be56e86 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -714,14 +714,9 @@ class CCompiler(Compiler): # This may include, for instance _GNU_SOURCE which must be defined # before limits.h, which includes features.h head = '{prefix}\n#include <limits.h>\n' - # We don't know what the function takes or returns, so return it as an int. - # Just taking the address or comparing it to void is not enough because - # compilers are smart enough to optimize it away. The resulting binary - # is not run so we don't care what the return value is. + # We don't know what the function takes or returns main = '''\nint main() {{ - void *a = (void*) &{func}; - long b = (long) a; - return (int) b; + {func}; }}''' return head, main diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 458a41687..e95e5295a 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -1577,6 +1577,7 @@ class ClangCompiler(GnuLikeCompiler): # https://github.com/Homebrew/homebrew-core/issues/3727 if self.compiler_type.is_osx_compiler and version_compare(self.version, '>=8.0'): extra_args.append('-Wl,-no_weak_imports') + extra_args.append('-Werror-partial-availability') return super().has_function(funcname, prefix, env, extra_args, dependencies) def openmp_flags(self): |