Skip to content

Commit

Permalink
meson: add extensive warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
perigoso authored and rg-silva committed Jul 28, 2023
1 parent 02f2db1 commit adc4c0e
Showing 1 changed file with 45 additions and 4 deletions.
49 changes: 45 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ project('Black Magic Debug', 'c',
'c_std=c11',
'optimization=s',
'debug=true',
# 'warning_level=3',
'warning_level=2',
'werror=true',
],
Expand All @@ -60,11 +61,51 @@ version = vcs_tag(
## Black Magic Debug (BMD) sources
## _______________________________

c = meson.get_compiler('c')

# Project wide flags
add_project_arguments('-Wreturn-type', '-Wno-char-subscripts', language: 'c')
if host_machine.system() in ['macos', 'darwin']
add_project_arguments('-Wmaybe-uninitialized', '-Wstringop-overflow', '-Wunsafe-loop-optimizations', language: 'c')
endif
extended_warnings = [
'-Warith-conversion',
'-Wbad-function-cast',
'-Wcast-align=strict',
'-Wcast-function-type',
# '-Wcast-qual',
# '-Wconversion',
'-Wdangling-else',
'-Wdouble-promotion',
'-Wduplicated-branches',
'-Wfloat-conversion',
'-Wformat-overflow=2',
'-Wformat-signedness',
'-Wformat-truncation',
'-Wformat=2',
'-Wimplicit-fallthrough',
'-Wmaybe-uninitialized',
'-Wmissing-attributes',
'-Wmissing-braces',
'-Wno-char-subscripts',
'-Wnull-dereference',
# '-Wpacked',
'-Wredundant-decls',
'-Wreturn-type',
'-Wsequence-point',
'-Wshadow=local',
# '-Wsign-conversion',
'-Wstack-protector',
'-Wstrict-aliasing',
'-Wstrict-overflow=3',
'-Wstring-compare',
'-Wstringop-overflow',
'-Wunknown-pragmas',
'-Wunsafe-loop-optimizations',
'-Wunsuffixed-float-constant',
'-Wunused-const-variable=2',
'-Wunused-local-typedefs',
'-Wunused',
'-Wvla-parameter',
# '-Wvla',
]
add_project_arguments(c.get_supported_arguments(extended_warnings), language: 'c')

# Null dependency to allow for checking and conditional compilation later
probe_host = dependency('', required: false)
Expand Down

0 comments on commit adc4c0e

Please sign in to comment.