meson: enable more warnings

This commit is contained in:
Mathieu Duponchelle 2018-03-01 19:07:42 +01:00
parent 83c38dc446
commit 7ce5d16b5c
2 changed files with 55 additions and 1 deletions

View file

@ -15,6 +15,8 @@ else
gst_version_nano = 0 gst_version_nano = 0
endif endif
have_cxx = add_languages('cpp', required : false)
glib_req = '>= 2.40.0' glib_req = '>= 2.40.0'
gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor) gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
@ -186,6 +188,48 @@ if gst_debug_disabled and cc.has_argument('-Wno-unused')
add_project_arguments('-Wno-unused', language: 'c') add_project_arguments('-Wno-unused', language: 'c')
endif endif
warning_flags = [
'-Wmissing-declarations',
'-Wredundant-decls',
'-Wwrite-strings',
'-Wformat',
'-Wformat-nonliteral',
'-Wformat-security',
'-Winit-self',
'-Wmissing-include-dirs',
'-Waddress',
'-Wno-multichar',
'-Wvla',
'-Wpointer-arith',
'-Waggregate-return',
]
warning_c_flags = [
'-Wmissing-prototypes',
'-Wold-style-definition',
'-Wdeclaration-after-statement',
'-Wnested-externs'
]
if have_cxx
cxx = meson.get_compiler('cpp')
endif
foreach extra_arg : warning_flags
if cc.has_argument (extra_arg)
add_project_arguments([extra_arg], language: 'c')
endif
if have_cxx and cxx.has_argument (extra_arg)
add_project_arguments([extra_arg], language: 'cpp')
endif
endforeach
foreach extra_arg : warning_c_flags
if cc.has_argument (extra_arg)
add_project_arguments([extra_arg], language: 'c')
endif
endforeach
presetdir = join_paths(get_option('datadir'), 'gstreamer-' + api_version, 'presets') presetdir = join_paths(get_option('datadir'), 'gstreamer-' + api_version, 'presets')
subdir('gst') subdir('gst')
subdir('ext') subdir('ext')

View file

@ -28,6 +28,16 @@ libm = cc.find_library('m', required : false)
# FIXME: valgrind_args: add suppressions $(top_srcdir)/common/gst.supp $(srcdir)/gst-plugins-ugly.supp # FIXME: valgrind_args: add suppressions $(top_srcdir)/common/gst.supp $(srcdir)/gst-plugins-ugly.supp
no_warn_args = []
foreach arg : [
'-Wno-missing-prototypes',
'-Wno-missing-declarations',
'-Wno-old-style-definition']
if cc.has_argument(arg)
no_warn_args += [arg]
endif
endforeach
foreach t : ugly_tests foreach t : ugly_tests
fname = '@0@.c'.format(t.get(0)) fname = '@0@.c'.format(t.get(0))
test_name = t.get(0).underscorify() test_name = t.get(0).underscorify()
@ -43,7 +53,7 @@ foreach t : ugly_tests
if not skip_test if not skip_test
exe = executable(test_name, fname, exe = executable(test_name, fname,
include_directories : [configinc], include_directories : [configinc],
c_args : ['-DHAVE_CONFIG_H=1' ] + test_defines, c_args : ['-DHAVE_CONFIG_H=1' ] + test_defines + no_warn_args,
dependencies : [libm] + test_deps + extra_deps, dependencies : [libm] + test_deps + extra_deps,
) )