meson: switch to cc.get_supported_arguments

This is generally faster, as meson is able to parallelize the checks for
us.

This also removes the workaround for checking gcc/clang -Wno-*
arguments, which meson now handles internally so we don't need to handle
it ourselves.

Signed-off-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
main
Dylan Baker 2022-01-19 10:43:04 -08:00
parent 6b0b493555
commit eaf234c148
1 changed files with 10 additions and 25 deletions

View File

@ -23,7 +23,7 @@ project(
['c'], ['c'],
version : '2.4.109', version : '2.4.109',
license : 'MIT', license : 'MIT',
meson_version : '>= 0.46', meson_version : '>= 0.48',
default_options : ['buildtype=debugoptimized', 'c_std=c99'], default_options : ['buildtype=debugoptimized', 'c_std=c99'],
) )
@ -219,30 +219,15 @@ if (cc.has_header_symbol('sys/mkdev.h', 'major') and
endif endif
config.set10('HAVE_OPEN_MEMSTREAM', cc.has_function('open_memstream')) config.set10('HAVE_OPEN_MEMSTREAM', cc.has_function('open_memstream'))
warn_c_args = [] libdrm_c_args = cc.get_supported_arguments([
foreach a : ['-Wall', '-Wextra', '-Wsign-compare', '-Werror=undef', '-Wsign-compare', '-Werror=undef', '-Werror=implicit-function-declaration',
'-Werror=implicit-function-declaration', '-Wpointer-arith', '-Wpointer-arith', '-Wwrite-strings', '-Wstrict-prototypes',
'-Wwrite-strings', '-Wstrict-prototypes', '-Wmissing-prototypes', '-Wmissing-prototypes', '-Wmissing-declarations', '-Wnested-externs',
'-Wmissing-declarations', '-Wnested-externs', '-Wpacked', '-Wpacked', '-Wswitch-enum', '-Wmissing-format-attribute',
'-Wswitch-enum', '-Wmissing-format-attribute',
'-Wstrict-aliasing=2', '-Winit-self', '-Winline', '-Wshadow', '-Wstrict-aliasing=2', '-Winit-self', '-Winline', '-Wshadow',
'-Wdeclaration-after-statement', '-Wold-style-definition'] '-Wdeclaration-after-statement', '-Wold-style-definition',
if cc.has_argument(a) '-Wno-unused-parameter', '-Wno-attributes', '-Wno-long-long',
warn_c_args += a '-Wno-missing-field-initializers'])
endif
endforeach
# GCC will never error for -Wno-*, so check for -W* then add -Wno-* to the list
# of options
foreach a : ['unused-parameter', 'attributes', 'long-long',
'missing-field-initializers']
if cc.has_argument('-W@0@'.format(a))
warn_c_args += '-Wno-@0@'.format(a)
endif
endforeach
# all c args:
libdrm_c_args = warn_c_args
dep_pciaccess = dependency('pciaccess', version : '>= 0.10', required : with_intel) dep_pciaccess = dependency('pciaccess', version : '>= 0.10', required : with_intel)
dep_cunit = dependency('cunit', version : '>= 2.1', required : false) dep_cunit = dependency('cunit', version : '>= 2.1', required : false)