meson: use xx.get_supported_arguments()

This construct allows meson to check the argument in parallel, but more
importantly it also knows about the "-Wno-" workaround and applies it as
needed.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
pull/941/head
Emil Velikov 1 year ago committed by jackun
parent e77fb741c6
commit cf314e6c9f

@ -114,52 +114,35 @@ inc_common = [
dep_vulkan = dependency('vulkan', required: get_option('use_system_vulkan'))
dep_pthread = dependency('threads')
# Check for generic C arguments
c_args = []
foreach a : ['-Werror=implicit-function-declaration',
'-Werror=missing-prototypes', '-Werror=return-type',
'-Werror=incompatible-pointer-types',
'-Wno-unused-parameter', '-Qunused-arguments',
'-fno-math-errno', '-fno-trapping-math']
if cc.has_argument(a)
c_args += a
endif
endforeach
foreach a : ['missing-field-initializers']
if cc.has_argument('-W' + a)
c_args += '-Wno-' + a
endif
endforeach
# Check for generic C++ arguments
cpp_args = []
foreach a : ['-Werror=return-type',
'-Wno-unused-parameter', '-Qunused-arguments',
'-fno-math-errno', '-fno-trapping-math']
if cpp.has_argument(a)
cpp_args += a
endif
endforeach
# For some reason, the test for -Wno-foo always succeeds with gcc, even if the
# option is not supported. Hence, check for -Wfoo instead.
add_project_arguments(
cc.get_supported_arguments([
'-Werror=implicit-function-declaration',
'-Werror=missing-prototypes',
'-Werror=return-type',
'-Werror=incompatible-pointer-types',
'-Wno-unused-parameter',
'-Qunused-arguments',
'-fno-math-errno',
'-fno-trapping-math',
'-Wno-missing-field-initializers',
]), language : ['c'],
)
foreach a : ['non-virtual-dtor', 'missing-field-initializers',]
if cpp.has_argument('-W' + a)
cpp_args += '-Wno-' + a
endif
endforeach
add_project_arguments(
cpp.get_supported_arguments([
'-Werror=return-type',
'-Wno-unused-parameter',
'-Qunused-arguments',
'-fno-math-errno',
'-fno-trapping-math',
'-Wno-non-virtual-dtor',
'-Wno-missing-field-initializers',
]), language : ['cpp'],
)
foreach a : pre_args
add_project_arguments(a, language : ['c', 'cpp'])
endforeach
foreach a : c_args
add_project_arguments(a, language : ['c'])
endforeach
foreach a : cpp_args
add_project_arguments(a, language : ['cpp'])
endforeach
# check for dl support
if is_unixy

Loading…
Cancel
Save