File: meson.build

package info (click to toggle)
meson 1.0.1-5
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 21,064 kB
  • sloc: python: 73,424; ansic: 6,754; cpp: 2,195; f90: 453; asm: 174; sh: 143; java: 92; xml: 88; cs: 54; objc: 29; lex: 13; fortran: 12; makefile: 10; yacc: 9; javascript: 6
file content (31 lines) | stat: -rw-r--r-- 868 bytes parent folder | download | duplicates (10)
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
project('alignment', 'c', 'cpp')

compilers = [meson.get_compiler('c'), meson.get_compiler('cpp')]

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

  ptr_size = cc.sizeof('void*')
  dbl_alignment = cc.alignment('double')

  # These tests are not thorough. Doing this properly
  # would take a lot of work because it is strongly
  # platform  and compiler dependent. So just check
  # that they produce something fairly sane.

  if ptr_size == 8 or ptr_size == 4
    message('Size of ptr ok.')
  else
    error('Size of ptr misdetected.')
  endif

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