mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 07:26:15 +01:00
meson: Compile some tests with multiple C standards
We need to ensure that all the expected macros and utilities are working with all the supported C standards, so just repeat the tests with all the ones the compiler supports.
This commit is contained in:
parent
641256ea22
commit
14ba699508
@ -3,6 +3,7 @@ glib_tests = {
|
||||
'asyncqueue' : {},
|
||||
'atomic' : {
|
||||
'c_args' : cc.get_id() == 'gcc' ? ['-Wstrict-aliasing=2'] : [],
|
||||
'c_standards': c_standards.keys(),
|
||||
},
|
||||
'base64' : {},
|
||||
'bitlock' : {},
|
||||
@ -48,7 +49,9 @@ glib_tests = {
|
||||
'keyfile' : {},
|
||||
'list' : {},
|
||||
'logging' : {},
|
||||
'macros' : {},
|
||||
'macros' : {
|
||||
'c_standards': c_standards.keys(),
|
||||
},
|
||||
'mainloop' : {},
|
||||
'mappedfile' : {},
|
||||
'mapping' : {},
|
||||
@ -152,7 +155,9 @@ glib_tests = {
|
||||
'utf8-pointer' : {},
|
||||
'utf8-validate' : {},
|
||||
'utf8-misc' : {},
|
||||
'utils' : {},
|
||||
'utils' : {
|
||||
'c_standards': c_standards.keys(),
|
||||
},
|
||||
'unicode' : {},
|
||||
'unicode-encoding' : {},
|
||||
'unicode-normalize': {},
|
||||
@ -294,6 +299,20 @@ if host_machine.system() == 'windows'
|
||||
}
|
||||
endif
|
||||
|
||||
foreach test_name, extra_args : glib_tests
|
||||
foreach std: extra_args.get('c_standards', [])
|
||||
if c_standards.has_key(std)
|
||||
glib_tests += {
|
||||
'@0@-c-@1@'.format(test_name, std) : extra_args + {
|
||||
'source' : extra_args.get('source', test_name + '.c'),
|
||||
'suite' : ['cc'] + extra_args.get('suite', []),
|
||||
'c_args' : [c_standards.get(std)] + extra_args.get('c_args', []),
|
||||
}
|
||||
}
|
||||
endif
|
||||
endforeach
|
||||
endforeach
|
||||
|
||||
test_env = environment()
|
||||
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
|
||||
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
|
||||
|
@ -10,6 +10,15 @@ project('glib', 'c',
|
||||
)
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
c_standards = {}
|
||||
|
||||
foreach std : ['90', '99', '11', '17']
|
||||
arg = (cc.get_id() == 'msvc' ? '/std:' : '-std=') + 'c' + std
|
||||
if cc.has_argument(arg)
|
||||
c_standards += { std: arg }
|
||||
endif
|
||||
endforeach
|
||||
|
||||
have_cxx = add_languages('cpp', native: false, required: get_option('oss_fuzz').enabled())
|
||||
if have_cxx
|
||||
cxx = meson.get_compiler('cpp')
|
||||
|
Loading…
Reference in New Issue
Block a user