From 47208072bf5d7ce236621f94168ee0966982f2ea Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Thu, 1 Mar 2018 18:44:13 +0100 Subject: [PATCH] meson: enable more warnings --- ext/dts/meson.build | 6 +++++- meson.build | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/ext/dts/meson.build b/ext/dts/meson.build index 882a6aa..6bbf95a 100644 --- a/ext/dts/meson.build +++ b/ext/dts/meson.build @@ -4,10 +4,14 @@ if not dca_dep.found() and cc.has_header_symbol('dca.h', 'dca_init') dca_dep = cc.find_library('dca', required : false) endif +# autotools didn't use the libdca pkg-config cflags, and they +# can point to a non-existing location (/usr/include/dca) +no_warn_c_args = ['-Wno-missing-include-dirs'] + if dca_dep.found() gstdtsdec = library('gstdtsdec', 'gstdtsdec.c', - c_args : gst_plugins_bad_args, + c_args : gst_plugins_bad_args + no_warn_c_args, link_args : noseh_link_args, include_directories : [configinc, libsinc], dependencies : [gstaudio_dep, orc_dep, dca_dep], diff --git a/meson.build b/meson.build index 7a92ef4..88c4fa9 100644 --- a/meson.build +++ b/meson.build @@ -269,6 +269,52 @@ cdata.set_quoted('GST_API_VERSION', api_version) cdata.set_quoted('GST_LICENSE', 'LGPL') cdata.set_quoted('LIBDIR', join_paths(get_option('prefix'), get_option('libdir'))) +warning_flags = [ + '-Wmissing-declarations', + '-Wredundant-decls', + '-Wwrite-strings', + '-Wformat', + '-Wformat-security', + '-Winit-self', + '-Wmissing-include-dirs', + '-Waddress', + '-Wno-multichar', + '-Wvla', + '-Wpointer-arith', +] + +warning_c_flags = [ + '-Wmissing-prototypes', + '-Wdeclaration-after-statement', + '-Wold-style-definition', + '-Wnested-externs', +] + +warning_cxx_flags = [ + '-Wformat-nonliteral', +] + +foreach extra_arg : warning_c_flags + if cc.has_argument (extra_arg) + add_project_arguments([extra_arg], language: 'c') + endif +endforeach + +foreach extra_arg : warning_cxx_flags + if cxx.has_argument (extra_arg) + add_project_arguments([extra_arg], language: 'cpp') + endif +endforeach + +foreach extra_arg : warning_flags + if cc.has_argument (extra_arg) + add_project_arguments([extra_arg], language: 'c') + endif + if cxx.has_argument (extra_arg) + add_project_arguments([extra_arg], language: 'cpp') + endif +endforeach + # GStreamer package name and origin url gst_package_name = get_option('with-package-name') if gst_package_name == '' -- 2.7.4