summaryrefslogtreecommitdiffstats
path: root/test cases/d/15 compiler run checks/meson.build
blob: a80e5289cad02972b5ef49f8b565f252b606c805 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
project('test-d-run-checks', 'd')

dc = meson.get_compiler('d')

run_sizeof = dc.run('int main() { return (void*).sizeof; }')
if run_sizeof.returncode() == 8
    run_versions = ['Is64bits']
elif run_sizeof.returncode() == 4
    run_versions = ['Is32bits']
endif
run_sizeof_exe = executable('run_sizeof', 'test_sizeof.d',
    d_module_versions: run_versions,
)
test('test D compiler run', run_sizeof_exe)

sizeof_sizeof = dc.sizeof('void*')
if sizeof_sizeof == 8
    run_versions = ['Is64bits']
elif sizeof_sizeof == 4
    run_versions = ['Is32bits']
endif
sizeof_sizeof_exe = executable('sizeof_sizeof', 'test_sizeof.d',
    d_module_versions: run_versions,
)
test('test D compiler sizeof', sizeof_sizeof_exe)

if not dc.has_header('std.stdio')
    error('Could not find std.stdio import')
endif

if dc.has_header('not_a_d_module')
    error('has_header inconsistent result')
endif

# same checks as C/C++ alignments (D has same alignment requirements as C)

# These tests should return the same value on all
# platforms. If (and when) they don't, fix 'em up.
if dc.alignment('char') != 1
error('Alignment of char misdetected.')
endif

dbl_alignment = dc.alignment('double')

if dbl_alignment == 8 or dbl_alignment == 4
message('Alignment of double ok.')
else
error('Alignment of double misdetected.')
endif