meson.build 749 B

123456789101112131415161718192021222324252627282930
  1. project('alignment', 'c')
  2. cc = meson.get_compiler('c')
  3. # These tests should return the same value on all
  4. # platforms. If (and when) they don't, fix 'em up.
  5. if cc.alignment('char') != 1
  6. error('Alignment of char misdetected.')
  7. endif
  8. ptr_size = cc.sizeof('void*')
  9. dbl_alignment = cc.alignment('double')
  10. # These tests are not thorough. Doing this properly
  11. # would take a lot of work because it is strongly
  12. # platform and compiler dependent. So just check
  13. # that they produce something fairly sane.
  14. if ptr_size == 8 or ptr_size == 4
  15. message('Size of ptr ok.')
  16. else
  17. error('Size of ptr misdetected.')
  18. endif
  19. if dbl_alignment == 8 or dbl_alignment == 4
  20. message('Alignment of double ok.')
  21. else
  22. error('Alignment of double misdetected.')
  23. endif