summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Duponchelle <mathieu@centricular.com>2018-03-01 19:07:42 +0100
committerMathieu Duponchelle <mathieu@centricular.com>2018-03-01 19:24:30 +0100
commit7ce5d16b5cf1fb96c85f08edd2c577557a8affa9 (patch)
tree0a5081ad993c5237e4917c353570b27b97605243
parent83c38dc44622611c1f67dd26e4cb383c5aef90f6 (diff)
meson: enable more warnings
-rw-r--r--meson.build44
-rw-r--r--tests/check/meson.build12
2 files changed, 55 insertions, 1 deletions
diff --git a/meson.build b/meson.build
index f2b2afa7..d97b0d99 100644
--- a/meson.build
+++ b/meson.build
@@ -15,6 +15,8 @@ else
gst_version_nano = 0
endif
+have_cxx = add_languages('cpp', required : false)
+
glib_req = '>= 2.40.0'
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')
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')
subdir('gst')
subdir('ext')
diff --git a/tests/check/meson.build b/tests/check/meson.build
index 6fdb490a..8887f62b 100644
--- a/tests/check/meson.build
+++ b/tests/check/meson.build
@@ -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
+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
fname = '@0@.c'.format(t.get(0))
test_name = t.get(0).underscorify()
@@ -43,7 +53,7 @@ foreach t : ugly_tests
if not skip_test
exe = executable(test_name, fname,
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,
)