diff options
author | David Robillard <d@drobilla.net> | 2024-11-13 13:27:36 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2024-11-13 13:27:36 -0500 |
commit | 18c968e208a38320cb22acd88df2b9093e1590d5 (patch) | |
tree | f18d752fec9260ca2e684b2bf9d82a4502f8bd5a /meson.build | |
parent | ce5688253e1ef06cd9551f563f70aab2cd487197 (diff) | |
download | sratom-18c968e208a38320cb22acd88df2b9093e1590d5.tar.gz sratom-18c968e208a38320cb22acd88df2b9093e1590d5.tar.bz2 sratom-18c968e208a38320cb22acd88df2b9093e1590d5.zip |
Move warning suppression flags to main meson file
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 86 |
1 files changed, 84 insertions, 2 deletions
diff --git a/meson.build b/meson.build index 48f4675..51e8f5f 100644 --- a/meson.build +++ b/meson.build @@ -28,8 +28,90 @@ versioned_name = 'sratom' + version_suffix pkg = import('pkgconfig') cc = meson.get_compiler('c') -# Set global warning flags -subdir('meson/suppressions') +# Set global warning suppressions +warning_level = get_option('warning_level') +c_suppressions = [] +if cc.get_id() == 'clang' + if warning_level == 'everything' + c_suppressions += [ + '-Wno-cast-align', + '-Wno-cast-function-type-strict', + '-Wno-cast-qual', + '-Wno-declaration-after-statement', + '-Wno-documentation-unknown-command', + '-Wno-double-promotion', + '-Wno-float-conversion', + '-Wno-implicit-float-conversion', + '-Wno-implicit-int-conversion', + '-Wno-padded', + '-Wno-shorten-64-to-32', + '-Wno-sign-conversion', + '-Wno-unsafe-buffer-usage', + ] + + if host_machine.system() == 'windows' + c_suppressions += [ + '-Wno-deprecated-declarations', + '-Wno-format-nonliteral', + ] + endif + + if not meson.is_cross_build() + c_suppressions += ['-Wno-poison-system-directories'] + endif + endif + + if warning_level in ['everything', '3'] + c_suppressions += ['-Wno-nullability-extension'] + endif + +elif cc.get_id() == 'gcc' + if warning_level == 'everything' + c_suppressions += [ + '-Wno-cast-align', + '-Wno-cast-qual', + '-Wno-conversion', + '-Wno-inline', + '-Wno-padded', + '-Wno-suggest-attribute=pure', + '-Wno-unsuffixed-float-constants', + '-Wno-unused-const-variable', + ] + + if host_machine.system() == 'windows' + c_suppressions += ['-Wno-suggest-attribute=format'] + endif + endif + +elif cc.get_id() == 'msvc' + if warning_level == 'everything' + c_suppressions += [ + '/wd4242', # conversion, possible loss of data + '/wd4365', # signed/unsigned mismatch + '/wd4514', # unreferenced inline function has been removed + '/wd4706', # assignment within conditional expression + '/wd4710', # function not inlined + '/wd4711', # function selected for automatic inline expansion + '/wd4820', # padding added after construct + '/wd5045', # will insert Spectre mitigation for memory load + ] + endif + + if warning_level in ['everything', '3', '2'] + c_suppressions += [ + '/wd4267', # conversion from size_t, possible loss of data + '/wd4996', # function or variable may be unsafe + ] + endif + + if warning_level in ['everything', '3', '2', '1'] + c_suppressions += [ + '/wd4244', # conversion from floating point, possible loss of data + ] + endif +endif + +c_suppressions = cc.get_supported_arguments(c_suppressions) ################ # Dependencies # |