diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-04-15 17:48:54 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-04-15 18:51:41 +0530 |
commit | 2c687b02c2cd88c4c147932faefe071c34176cdb (patch) | |
tree | dbff8b83fb48de1322b9e6a72d1c6bb01be86c6f /mesonbuild/compilers.py | |
parent | 9a9654c4bdfeeab78b602a27615ab1845b7ba383 (diff) | |
download | meson-2c687b02c2cd88c4c147932faefe071c34176cdb.zip meson-2c687b02c2cd88c4c147932faefe071c34176cdb.tar.gz meson-2c687b02c2cd88c4c147932faefe071c34176cdb.tar.bz2 |
Fix symbol-exists check for cross_sizeof and add the same check to cross_alignment
The previous check was failing while checking pointer sizes such as
void* due to a syntax error.
Diffstat (limited to 'mesonbuild/compilers.py')
-rw-r--r-- | mesonbuild/compilers.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index e9a798d..1915644 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -579,7 +579,7 @@ int main () {{ {1}; }}''' element_exists_templ = '''#include <stdio.h> {0} int main(int argc, char **argv) {{ - {1}; + {1} something; }} ''' templ = '''#include <stdio.h> @@ -622,6 +622,11 @@ int main(int argc, char **argv) { return int(res.stdout) def cross_alignment(self, typename, env, extra_args=[]): + type_exists_templ = '''#include <stdio.h> +int main(int argc, char **argv) {{ + {0} something; +}} +''' templ = '''#include<stddef.h> struct tmp { char c; @@ -634,6 +639,9 @@ int testarray[%d-offsetof(struct tmp, target)]; extra_args += env.cross_info.config['properties'][self.language + '_args'] except KeyError: pass + extra_args += self.get_no_optimization_args() + if not self.compiles(type_exists_templ.format(typename)): + return -1 for i in range(1, 1024): code = templ % (typename, i) if self.compiles(code, extra_args): |