diff options
author | David Robillard <d@drobilla.net> | 2023-05-01 13:24:23 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-05-01 13:45:23 -0400 |
commit | 91e55a8443895c63d3b5a427b2b8abf86064a7fe (patch) | |
tree | 8e91a4a3ae77d853e3ee49fb8afeb6bf62b99ed1 /meson.build | |
parent | 9e966d0f5a11bb43d17a56aab1ed9a43b8c2a112 (diff) | |
download | zix-91e55a8443895c63d3b5a427b2b8abf86064a7fe.tar.gz zix-91e55a8443895c63d3b5a427b2b8abf86064a7fe.tar.bz2 zix-91e55a8443895c63d3b5a427b2b8abf86064a7fe.zip |
Clean up warning suppressions
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 102 |
1 files changed, 99 insertions, 3 deletions
diff --git a/meson.build b/meson.build index 5c51945..3f4bf91 100644 --- a/meson.build +++ b/meson.build @@ -25,9 +25,6 @@ versioned_name = 'zix' + version_suffix pkg = import('pkgconfig') cc = meson.get_compiler('c') -# Set global warning flags -subdir('meson/suppressions') - # Restrict Windows API usage to Vista and earlier if host_machine.system() == 'windows' if cc.get_id() == 'msvc' @@ -37,6 +34,105 @@ if host_machine.system() == 'windows' endif endif +# Set global warning suppressions +warning_level = get_option('warning_level') +c_suppressions = [] +if cc.get_id() in ['clang', 'emscripten'] + if warning_level == 'everything' + c_suppressions += [ + '-Wno-bad-function-cast', + '-Wno-c11-extensions', # Glib + '-Wno-declaration-after-statement', + '-Wno-implicit-fallthrough', # Really for clang < 12 + '-Wno-padded', + ] + + if host_machine.system() == 'windows' + c_suppressions += [ + '-Wno-deprecated-declarations', + '-Wno-nonportable-system-include-path', + ] + endif + endif + + if warning_level in ['everything', '3'] + c_suppressions += [ + '-Wno-nullability-extension', + ] + endif + + if cc.get_id() == 'emscripten' + c_suppressions += [ + '-Wno-format', + ] + endif + +elif cc.get_id() == 'gcc' + if warning_level == 'everything' + c_suppressions += [ + '-Wno-bad-function-cast', + '-Wno-cast-function-type', + '-Wno-inline', + '-Wno-padded', + '-Wno-strict-overflow', + '-Wno-switch-default', + '-Wno-unsuffixed-float-constants', + ] + + if host_machine.system() == 'windows' + c_suppressions += [ + '-Wno-format', + '-Wno-suggest-attribute=const', + '-Wno-suggest-attribute=format', + '-Wno-suggest-attribute=pure', + ] + endif + endif + +elif cc.get_id() == 'msvc' + c_suppressions += [ + '/experimental:external', + '/external:W0', + '/external:anglebrackets', + ] + + if warning_level == 'everything' + c_suppressions += [ + '/wd4191', # unsafe function conversion + '/wd4200', # zero-sized array in struct/union + '/wd4365', # signed/unsigned mismatch + '/wd4464', # relative include path contains ".." + '/wd4514', # unreferenced inline function has been removed + '/wd4710', # function not inlined + '/wd4711', # function selected for automatic inline expansion + '/wd4777', # format string and argument mismatch + '/wd4800', # implicit conversion to bool + '/wd4820', # padding added after construct + '/wd5045', # will insert Spectre mitigation for memory load + ] + endif + + if warning_level in ['everything', '3'] + c_suppressions += [ + '/wd4706', # assignment within conditional expression + ] + endif + + if warning_level in ['everything', '3', '2'] + c_suppressions += [ + '/wd4996', # POSIX name for this item is deprecated + ] + endif + + if warning_level in ['everything', '3', '2', '1'] + c_suppressions += [ + '/wd4114', # same type qualifier used more than once + ] + endif +endif + +c_suppressions = cc.get_supported_arguments(c_suppressions) + ########################## # Platform Configuration # ########################## |