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.
pull/517/head
Nirbheek Chauhan 9 years ago
parent 9a9654c4bd
commit 2c687b02c2
  1. 10
      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):

Loading…
Cancel
Save