mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-17 04:45:47 +00:00
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
This commit is contained in:
parent
8c10f1e2b4
commit
d67623c7a9
3 changed files with 44 additions and 2 deletions
|
@ -18,6 +18,10 @@ printf_args += ['-UHAVE_LONG_LONG_FORMAT']
|
||||||
# Don't need any of this widechar stuff, so just disable it for now
|
# Don't need any of this widechar stuff, so just disable it for now
|
||||||
printf_args += ['-UHAVE_WCHAR_T', '-UHAVE_WCSLEN', '-UHAVE_WINT_T']
|
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
|
# Check if 'long long' works and what format can be used to print it
|
||||||
# jm_AC_TYPE_LONG_LONG
|
# jm_AC_TYPE_LONG_LONG
|
||||||
if cc.compiles('''long long ll = 1LL;
|
if cc.compiles('''long long ll = 1LL;
|
||||||
|
|
|
@ -65,11 +65,24 @@ else
|
||||||
endif
|
endif
|
||||||
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 = static_library('check',
|
||||||
libcheck_files,
|
libcheck_files,
|
||||||
include_directories : [configinc, internal_check_h_inc],
|
include_directories : [configinc, internal_check_h_inc],
|
||||||
dependencies : [rt_lib, mathlib],
|
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
|
# 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
|
# replacements since we don't check for or define these. See libcompat.h
|
||||||
['-DHAVE_VSNPRINTF', '-DHAVE_SNPRINTF', '-DHAVE_MALLOC', '-DHAVE_REALLOC'],
|
['-DHAVE_VSNPRINTF', '-DHAVE_SNPRINTF', '-DHAVE_MALLOC', '-DHAVE_REALLOC'],
|
||||||
|
|
27
meson.build
27
meson.build
|
@ -45,7 +45,6 @@ if cc.get_id() == 'msvc'
|
||||||
elif cc.has_argument('-Wl,-Bsymbolic-functions')
|
elif cc.has_argument('-Wl,-Bsymbolic-functions')
|
||||||
# FIXME: Add an option for this if people ask for it
|
# FIXME: Add an option for this if people ask for it
|
||||||
add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c')
|
add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c')
|
||||||
# FIXME: Add FATAL_WARNINGS from configure.ac
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Symbol visibility
|
# Symbol visibility
|
||||||
|
@ -339,6 +338,32 @@ if disable_gst_debug
|
||||||
add_project_arguments(['-Wno-unused'], language: 'c')
|
add_project_arguments(['-Wno-unused'], language: 'c')
|
||||||
endif
|
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
|
# Used by the gstutils test
|
||||||
gmp_dep = cc.find_library('gmp', required : false)
|
gmp_dep = cc.find_library('gmp', required : false)
|
||||||
cdata.set('HAVE_GMP', gmp_dep.found())
|
cdata.set('HAVE_GMP', gmp_dep.found())
|
||||||
|
|
Loading…
Reference in a new issue