diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2020-05-12 18:55:15 +0200 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2020-05-13 08:16:54 +0000 |
commit | c4fa0fac3dd4f4451f73a50c3c523c8f83a3a6e1 (patch) | |
tree | c1a3805c252086bd5d2d7cbeea0397f7f6ce5495 | |
parent | 956cba02224d5e38642c5fd298a290927a2cb358 (diff) | |
download | meson-c4fa0fac3dd4f4451f73a50c3c523c8f83a3a6e1.zip meson-c4fa0fac3dd4f4451f73a50c3c523c8f83a3a6e1.tar.gz meson-c4fa0fac3dd4f4451f73a50c3c523c8f83a3a6e1.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.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py index df97598..0333ffa 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 |