aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2020-05-12 18:55:15 +0200
committerNirbheek Chauhan <nirbheek@centricular.com>2020-05-14 17:28:30 +0530
commit7f4202112c3782b6e5809a04c4d6b482ae4ea5bb (patch)
tree654b80a0363046cf94450770c56d0093df44bb41
parent7601fc6e0ebdaf0b05af17f3a929f90a81c8c6da (diff)
downloadmeson-7f4202112c3782b6e5809a04c4d6b482ae4ea5bb.zip
meson-7f4202112c3782b6e5809a04c4d6b482ae4ea5bb.tar.gz
meson-7f4202112c3782b6e5809a04c4d6b482ae4ea5bb.tar.bz2
Fix has_function() for clang on 64bit Windows
has_function() tries to link an example program using the function to see if it is available, but with clang on 64bit Windows this example always already failed at the compile step: error: cast from pointer to smaller type 'long' loses information long b = (long) a; This is due to long!=pointer with LLP64 Change from "long" to "long long" which is min 64bit and should always fit a pointer. While "long long" is strictly a C99 feature every non super ancient compiler should still support it.
-rw-r--r--mesonbuild/compilers/mixins/clike.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py
index 53f30fd..ef83c19 100644
--- a/mesonbuild/compilers/mixins/clike.py
+++ b/mesonbuild/compilers/mixins/clike.py
@@ -658,7 +658,7 @@ class CLikeCompiler:
# is not run so we don't care what the return value is.
main = '''\nint main(void) {{
void *a = (void*) &{func};
- long b = (long) a;
+ long long b = (long long) a;
return (int) b;
}}'''
return head, main