summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Duponchelle <mathieu@centricular.com>2018-03-01 17:20:06 +0100
committerMathieu Duponchelle <mathieu@centricular.com>2018-03-01 17:20:48 +0100
commitd67623c7a9cd50e42f1b2e48d29b79e366aa00ef (patch)
tree4e66beb14f277fe32fc83a90303f0601650e2dd6
parent8c10f1e2b40b40c769c3cea520fd9b1ce3ce751e (diff)
meson: enable more warnings
Modeled on the autotools build, -W flags are only added if the compiler supports them. https://bugzilla.gnome.org/show_bug.cgi?id=793958
-rw-r--r--gst/printf/meson.build4
-rw-r--r--libs/gst/check/libcheck/meson.build15
-rw-r--r--meson.build27
3 files changed, 44 insertions, 2 deletions
diff --git a/gst/printf/meson.build b/gst/printf/meson.build
index 1b42d2a35..57ecb61cc 100644
--- a/gst/printf/meson.build
+++ b/gst/printf/meson.build
@@ -18,6 +18,10 @@ printf_args += ['-UHAVE_LONG_LONG_FORMAT']
# Don't need any of this widechar stuff, so just disable it for now
printf_args += ['-UHAVE_WCHAR_T', '-UHAVE_WCSLEN', '-UHAVE_WINT_T']
+if cc.has_argument('-Wno-format-nonliteral')
+ printf_args += ['-Wno-format-nonliteral']
+endif
+
# Check if 'long long' works and what format can be used to print it
# jm_AC_TYPE_LONG_LONG
if cc.compiles('''long long ll = 1LL;
diff --git a/libs/gst/check/libcheck/meson.build b/libs/gst/check/libcheck/meson.build
index 851106469..17d3f0181 100644
--- a/libs/gst/check/libcheck/meson.build
+++ b/libs/gst/check/libcheck/meson.build
@@ -65,11 +65,24 @@ else
endif
endif
+no_warn_args = []
+foreach arg : [
+ '-Wno-undef',
+ '-Wno-redundant-decls',
+ '-Wno-missing-prototypes',
+ '-Wno-missing-declarations',
+ '-Wno-old-style-definition',
+ '-Wno-declaration-after-statement']
+ if cc.has_argument(arg)
+ no_warn_args += [arg]
+ endif
+endforeach
+
libcheck = static_library('check',
libcheck_files,
include_directories : [configinc, internal_check_h_inc],
dependencies : [rt_lib, mathlib],
- c_args: gst_c_args + libcheck_visibility_args +
+ c_args: gst_c_args + libcheck_visibility_args + no_warn_args +
# Don't want libcompat to think we don't have these and substitute
# replacements since we don't check for or define these. See libcompat.h
['-DHAVE_VSNPRINTF', '-DHAVE_SNPRINTF', '-DHAVE_MALLOC', '-DHAVE_REALLOC'],
diff --git a/meson.build b/meson.build
index 60a0a5dfb..7aa45de28 100644
--- a/meson.build
+++ b/meson.build
@@ -45,7 +45,6 @@ if cc.get_id() == 'msvc'
elif cc.has_argument('-Wl,-Bsymbolic-functions')
# FIXME: Add an option for this if people ask for it
add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c')
- # FIXME: Add FATAL_WARNINGS from configure.ac
endif
# Symbol visibility
@@ -339,6 +338,32 @@ if disable_gst_debug
add_project_arguments(['-Wno-unused'], language: 'c')
endif
+warning_flags = [
+ '-Wmissing-declarations',
+ '-Wmissing-prototypes',
+ '-Wredundant-decls',
+ '-Wundef',
+ '-Wwrite-strings',
+ '-Wformat-nonliteral',
+ '-Wformat-security',
+ '-Wold-style-definition',
+ '-Winit-self',
+ '-Wmissing-include-dirs',
+ '-Waddress',
+ '-Waggregate-return',
+ '-Wno-multichar',
+ '-Wnested-externs',
+ '-Wdeclaration-after-statement',
+ '-Wvla',
+ '-Wpointer-arith',
+]
+
+foreach extra_arg : warning_flags
+ if cc.has_argument (extra_arg)
+ add_project_arguments([extra_arg], language: 'c')
+ endif
+endforeach
+
# Used by the gstutils test
gmp_dep = cc.find_library('gmp', required : false)
cdata.set('HAVE_GMP', gmp_dep.found())