meson.build: add a few compiler flags

And handle them through the compiler.get_supported_arguments() function
in meson.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2022-03-01 14:04:57 +10:00
parent 5ab50db599
commit ca34a091ac

View file

@ -7,10 +7,30 @@ project('libei', 'c',
pkgconfig = import('pkgconfig')
cc = meson.get_compiler('c')
cppflags = ['-Wno-unused-parameter']
cflags = cppflags + ['-Wmissing-prototypes', '-Wstrict-prototypes']
add_project_arguments(cflags, language: 'c')
add_project_arguments(cppflags, language: 'cpp')
cflags =[
'-Wno-unused-parameter',
'-Wmissing-prototypes',
'-Wno-missing-field-initializers',
'-Wstrict-prototypes',
'-Wstrict-prototypes',
'-Wlogical-op',
'-Wpointer-arith',
'-Wuninitialized',
'-Winit-self',
'-Wstrict-prototypes',
'-Wimplicit-fallthrough',
'-Wredundant-decls',
'-Wincompatible-pointer-types',
'-Wformat=2',
'-Wformat-overflow=2',
'-Wformat-signedness',
'-Wformat-truncation=2',
'-Wmissing-declarations',
'-Wshift-overflow=2',
'-Wstrict-overflow=2',
'-Wswitch',
]
add_project_arguments(cc.get_supported_arguments(cflags), language: 'c')
config_h = configuration_data()
config_h.set('_GNU_SOURCE', '1')