Debian Codegraph @

test cases/common/37 has member/meson.build

raw
1 project('has member', 'c', 'cpp')
2
3 compilers = [meson.get_compiler('c'), meson.get_compiler('cpp')]
4
5 foreach cc : compilers
6 if not cc.has_member('struct tm', 'tm_sec', prefix : '#include<time.h>')
7 error('Did not detect member of "struct tm" that exists: "tm_sec"')
8 endif
9
10 if cc.has_member('struct tm', 'tm_nonexistent', prefix : '#include<time.h>')
11 error('Not existing member "tm_nonexistent" found.')
12 endif
13
14 if not cc.has_members('struct tm', 'tm_sec', 'tm_min', prefix : '#include<time.h>')
15 error('Did not detect members of "struct tm" that exist: "tm_sec" "tm_min"')
16 endif
17
18 if cc.has_members('struct tm', 'tm_sec', 'tm_nonexistent2', prefix : '#include<time.h>')
19 error('Not existing member "tm_nonexistent2" found.')
20 endif
21 endforeach