parent
3872cd024e
commit
ae62e8ca11
6 changed files with 64 additions and 1 deletions
@ -0,0 +1 @@ |
||||
#define INTSIZE @INTSIZE@ |
@ -0,0 +1,11 @@ |
||||
project('sizeof', 'c') |
||||
|
||||
cc = meson.get_compiler('c') |
||||
intsize = cc.sizeof('int') |
||||
|
||||
cd = configuration_data() |
||||
cd.set('INTSIZE', intsize) |
||||
configure_file(input : 'config.h.in', output : 'config.h', configuration : cd) |
||||
|
||||
e = executable('prog', 'prog.c', include_dirs : include_directories('.')) |
||||
add_test('sizeof test', e) |
@ -0,0 +1,10 @@ |
||||
#include"config.h" |
||||
#include<stdio.h> |
||||
|
||||
int main(int argc, char **argv) { |
||||
if(INTSIZE != sizeof(int)) { |
||||
fprintf(stderr, "Mismatch: detected int size %d, actual size %d.\n", INTSIZE, (int)sizeof(int)); |
||||
return 1; |
||||
} |
||||
return 0; |
||||
} |
Loading…
Reference in new issue