summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/c.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/compilers/c.py')
-rw-r--r--mesonbuild/compilers/c.py9
1 files changed, 2 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