diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2018-12-15 12:18:04 +0100 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2018-12-18 21:39:33 +0000 |
commit | 60f78f7e9e984802290a483535db208152008472 (patch) | |
tree | 181e3d60c8c9fda5066b11119488f09b81838eee /meson.build | |
parent | 5d00d872012a20ce3e7bd6421d81780fd9a09e52 (diff) | |
download | gobject-introspection-60f78f7e9e984802290a483535db208152008472.tar.gz |
meson: add default compiler warning flags and enable -Werror on CI
This enables various compiler warnings project wide and disables the triggered
ones for each library/executable. This should give us roughly the same behaviour
as with autotools.
Tested with gcc8 and clang7.
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/meson.build b/meson.build index ea6e3ed7..79c76302 100644 --- a/meson.build +++ b/meson.build @@ -22,6 +22,52 @@ if not python_version.version_compare(python_version_req) endif cc = meson.get_compiler('c') + +project_c_args = [] +if cc.get_id() != 'msvc' + project_c_args += [ + '-Wall', + '-Warray-bounds', + '-Wcast-align', + '-Wdeclaration-after-statement', + '-Wduplicated-branches', + '-Wextra', + '-Wformat=2', + '-Wformat-nonliteral', + '-Wformat-security', + '-Wimplicit-function-declaration', + '-Winit-self', + '-Wjump-misses-init', + '-Wlogical-op', + '-Wmissing-declarations', + '-Wmissing-format-attribute', + '-Wmissing-include-dirs', + '-Wmissing-noreturn', + '-Wmissing-prototypes', + '-Wnested-externs', + '-Wnull-dereference', + '-Wold-style-definition', + '-Wpacked', + '-Wpointer-arith', + '-Wrestrict', + '-Wreturn-type', + '-Wshadow', + '-Wsign-compare', + '-Wstrict-aliasing', + '-Wstrict-prototypes', + '-Wundef', + '-Wunused-but-set-variable', + '-Wwrite-strings', + ] + + project_c_args += [ + '-fno-strict-aliasing', + ] +endif + +project_c_args = cc.get_supported_arguments(project_c_args) +add_project_arguments(project_c_args, language: 'c') + config = configuration_data() config.set('GI_MAJOR_VERSION', gi_versions[0]) |