summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Scholz <epirat07@gmail.com>2018-07-18 03:52:07 +0200
committerNirbheek Chauhan <nirbheek@centricular.com>2018-10-28 00:09:47 +0100
commitfd683dea78180951e2c2e08f59fe365107a3cc3f (patch)
tree081606e544b53cbe88633a413be20e3c3fff1721
parent1c2cfe45292aea0e6f938098add92f3dd90727f1 (diff)
downloadmeson-nirbheek/epirat/experiment-has_function.tar.gz
Simplify has_function and fix SDK targetting on macOSnirbheek/epirat/experiment-has_function
-rw-r--r--mesonbuild/compilers/c.py9
-rw-r--r--mesonbuild/compilers/compilers.py1
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):