aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers.py
diff options
context:
space:
mode:
authorHaakon Sporsheim <haakon.sporsheim@gmail.com>2017-03-10 11:55:05 +0100
committerHaakon Sporsheim <haakon.sporsheim@gmail.com>2017-03-10 12:33:21 +0100
commitc9fe3a3ad4f58e2a263f8fc30c21bc009c109480 (patch)
tree7b4d127a062dc9baa519e317b238d34bdcff8cd2 /mesonbuild/compilers.py
parent1e2c914b3c508e1749890be85867e1f51336ece1 (diff)
downloadmeson-c9fe3a3ad4f58e2a263f8fc30c21bc009c109480.zip
meson-c9fe3a3ad4f58e2a263f8fc30c21bc009c109480.tar.gz
meson-c9fe3a3ad4f58e2a263f8fc30c21bc009c109480.tar.bz2
compiler: Ensure prefix and dependencies are used for alignment.
This is now similar to how prefix and dependencies are used in all the other similar checks performed by the compiler.
Diffstat (limited to 'mesonbuild/compilers.py')
-rw-r--r--mesonbuild/compilers.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index 403dda1..65a611f 100644
--- a/mesonbuild/compilers.py
+++ b/mesonbuild/compilers.py
@@ -1076,31 +1076,34 @@ class CCompiler(Compiler):
raise EnvironmentException('Could not run sizeof test binary.')
return int(res.stdout)
- def cross_alignment(self, typename, env, extra_args=None, dependencies=None):
+ def cross_alignment(self, typename, prefix, env, extra_args=None, dependencies=None):
if extra_args is None:
extra_args = []
- fargs = {'type': typename}
+ fargs = {'prefix': prefix, 'type': typename}
t = '''#include <stdio.h>
+ {prefix}
int main(int argc, char **argv) {{
{type} something;
}}'''
if not self.compiles(t.format(**fargs), env, extra_args, dependencies):
return -1
t = '''#include <stddef.h>
+ {prefix}
struct tmp {{
char c;
{type} target;
}};'''
return self.cross_compute_int('offsetof(struct tmp, target)', 1, 1024, None, t.format(**fargs), env, extra_args, dependencies)
- def alignment(self, typename, env, extra_args=None, dependencies=None):
+ def alignment(self, typename, prefix, env, extra_args=None, dependencies=None):
if extra_args is None:
extra_args = []
if self.is_cross:
- return self.cross_alignment(typename, env, extra_args, dependencies)
- fargs = {'type': typename}
+ return self.cross_alignment(typename, prefix, env, extra_args, dependencies)
+ fargs = {'prefix': prefix, 'type': typename}
t = '''#include <stdio.h>
#include <stddef.h>
+ {prefix}
struct tmp {{
char c;
{type} target;