build: tweak C warning options

Enable a few extra warning options, including -Walloca because it's
error-prone. Enable -Wdeclaration-after-statement to enforce the code
style. Disable -Wunused-parameter and -Wmissing-field-initializers
because these are pointless and don't catch bugs.

Inspired from the Weston and wlroots options.

Signed-off-by: Simon Ser <contact@emersion.fr>
This commit is contained in:
Simon Ser 2022-03-24 19:34:28 +01:00
parent 79fbb1ec39
commit a47a411617

View file

@ -9,3 +9,15 @@ project(
'warning_level=3',
],
)
cc = meson.get_compiler('c')
add_project_arguments(cc.get_supported_arguments([
'-Wundef',
'-Wmissing-prototypes',
'-Walloca',
'-Wdeclaration-after-statement',
'-Wno-unused-parameter',
'-Wno-missing-field-initializers',
]), language: 'c')