aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meson.build168
-rw-r--r--meson/suppressions/meson.build170
-rw-r--r--test/meson.build2
3 files changed, 162 insertions, 178 deletions
diff --git a/meson.build b/meson.build
index 70fbbc3..6ccee83 100644
--- a/meson.build
+++ b/meson.build
@@ -20,9 +20,9 @@ jalv_build_root = meson.current_build_dir()
major_version = meson.project_version().split('.')[0]
version_suffix = '@0@-@1@'.format(meson.project_name(), major_version)
-#######################
-# Compilers and Flags #
-#######################
+#############
+# Compilers #
+#############
# Required tools
cc = meson.get_compiler('c')
@@ -32,11 +32,165 @@ if add_languages(['cpp'], native: false, required: get_option('cxx'))
cpp = meson.get_compiler('cpp')
endif
-# Set global warning suppressions
-subdir('meson/suppressions')
-add_project_arguments(c_suppressions, language: ['c'])
+########################
+# Warning Suppressions #
+########################
+
+warning_level = get_option('warning_level')
+
+# C
+c_suppressions = []
+if cc.get_id() == 'clang'
+ if warning_level == 'everything'
+ c_suppressions += [
+ '-Wno-bad-function-cast',
+ '-Wno-cast-align',
+ '-Wno-cast-function-type-strict',
+ '-Wno-cast-qual',
+ '-Wno-declaration-after-statement',
+ '-Wno-disabled-macro-expansion',
+ '-Wno-double-promotion',
+ '-Wno-float-conversion',
+ '-Wno-float-equal',
+ '-Wno-implicit-float-conversion',
+ '-Wno-missing-noreturn',
+ '-Wno-padded',
+ '-Wno-shorten-64-to-32',
+ '-Wno-sign-conversion',
+ '-Wno-switch-default',
+ '-Wno-unsafe-buffer-usage',
+ ]
+
+ if not meson.is_cross_build()
+ c_suppressions += [
+ '-Wno-poison-system-directories',
+ ]
+ endif
+
+ if host_machine.system() == 'darwin'
+ c_suppressions += [
+ '-Wno-documentation-unknown-command',
+ '-Wno-reserved-id-macro',
+ ]
+ endif
+ endif
+
+ if warning_level in ['everything', '3']
+ c_suppressions += [
+ '-Wno-nullability-extension',
+ ]
+ endif
+
+ if host_machine.system() == 'darwin'
+ c_suppressions += [
+ '-Wno-documentation', # JACK
+ '-Wno-documentation-deprecated-sync', # JACK
+ ]
+ elif host_machine.system() == 'freebsd'
+ c_suppressions += [
+ '-Wno-c11-extensions', # isnan and friends
+ ]
+ endif
+
+elif cc.get_id() == 'gcc'
+ if warning_level == 'everything'
+ c_suppressions += [
+ '-Wno-bad-function-cast',
+ '-Wno-c++-compat',
+ '-Wno-cast-align',
+ '-Wno-cast-qual',
+ '-Wno-conversion',
+ '-Wno-double-promotion',
+ '-Wno-float-equal',
+ '-Wno-inline',
+ '-Wno-padded',
+ '-Wno-strict-overflow',
+ '-Wno-suggest-attribute=const',
+ '-Wno-suggest-attribute=pure',
+ '-Wno-switch-default',
+ '-Wno-unsuffixed-float-constants',
+ '-Wno-unused-const-variable',
+ ]
+ endif
+
+elif cc.get_id() == 'msvc'
+ if warning_level == 'everything'
+ c_suppressions += [
+ '/wd4191', # unsafe function conversion
+ '/wd4200', # zero-sized array in struct/union
+ '/wd4242', # possible loss of data from float conversion
+ '/wd4244', # possible loss of data from integer conversion
+ '/wd4267', # possible loss of data from size conversion
+ '/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
+ '/wd4800', # implicit conversion from int to bool
+ '/wd4820', # padding added after construct
+ '/wd4996', # POSIX name for this item is deprecated
+ '/wd5045', # compiler will insert Spectre mitigation
+ ]
+ endif
+endif
+
+c_suppressions = cc.get_supported_arguments(c_suppressions)
+
+# C++
if is_variable('cpp')
- add_project_arguments(cpp_suppressions, language: ['cpp'])
+ cpp_suppressions = []
+
+ if cpp.get_id() == 'clang'
+ if warning_level == 'everything'
+ cpp_suppressions += [
+ '-Wno-c++98-compat-pedantic',
+ '-Wno-cast-align', # MacOS
+ '-Wno-cast-qual', # MacOS
+ '-Wno-documentation-unknown-command', # MacOS
+ '-Wno-double-promotion',
+ '-Wno-float-conversion',
+ '-Wno-implicit-float-conversion',
+ '-Wno-old-style-cast', # MacOS
+ '-Wno-padded',
+ '-Wno-redundant-parens',
+ '-Wno-reserved-id-macro', # MacOS
+ '-Wno-shorten-64-to-32',
+ '-Wno-sign-conversion',
+ '-Wno-unsafe-buffer-usage',
+ '-Wno-weak-vtables',
+ '-Wno-zero-as-null-pointer-constant', # MacOS
+ ]
+
+ if not meson.is_cross_build()
+ cpp_suppressions += [
+ '-Wno-poison-system-directories',
+ ]
+ endif
+ endif
+
+ if warning_level in ['everything', '3']
+ cpp_suppressions += [
+ '-Wno-nullability-extension',
+ ]
+ endif
+
+ elif cpp.get_id() == 'gcc'
+ if warning_level == 'everything'
+ cpp_suppressions += [
+ '-Wno-cast-align', # LV2
+ '-Wno-cast-qual', # LV2
+ '-Wno-conversion',
+ '-Wno-effc++',
+ '-Wno-padded',
+ '-Wno-strict-overflow',
+ '-Wno-suggest-attribute=const',
+ '-Wno-suggest-attribute=pure',
+ '-Wno-unused-const-variable',
+ ]
+ endif
+ endif
+
+ cpp_suppressions = cpp.get_supported_arguments(cpp_suppressions)
endif
#######################
diff --git a/meson/suppressions/meson.build b/meson/suppressions/meson.build
deleted file mode 100644
index d82ce61..0000000
--- a/meson/suppressions/meson.build
+++ /dev/null
@@ -1,170 +0,0 @@
-# Copyright 2020-2023 David Robillard <d@drobilla.net>
-# SPDX-License-Identifier: 0BSD OR ISC
-
-# Project-specific warning suppressions
-
-warning_level = get_option('warning_level')
-
-#####
-# C #
-#####
-
-if is_variable('cc')
- c_suppressions = []
-
- if cc.get_id() == 'clang'
- if warning_level == 'everything'
- c_suppressions += [
- '-Wno-bad-function-cast',
- '-Wno-cast-align',
- '-Wno-cast-function-type-strict',
- '-Wno-cast-qual',
- '-Wno-declaration-after-statement',
- '-Wno-disabled-macro-expansion',
- '-Wno-double-promotion',
- '-Wno-float-conversion',
- '-Wno-float-equal',
- '-Wno-implicit-float-conversion',
- '-Wno-missing-noreturn',
- '-Wno-padded',
- '-Wno-shorten-64-to-32',
- '-Wno-sign-conversion',
- '-Wno-switch-default',
- '-Wno-unsafe-buffer-usage',
- ]
-
- if not meson.is_cross_build()
- c_suppressions += [
- '-Wno-poison-system-directories',
- ]
- endif
-
- if host_machine.system() == 'darwin'
- c_suppressions += [
- '-Wno-documentation-unknown-command',
- '-Wno-reserved-id-macro',
- ]
- endif
- endif
-
- if warning_level in ['everything', '3']
- c_suppressions += [
- '-Wno-nullability-extension',
- ]
- endif
-
- if host_machine.system() == 'darwin'
- c_suppressions += [
- '-Wno-documentation', # JACK
- '-Wno-documentation-deprecated-sync', # JACK
- ]
- elif host_machine.system() == 'freebsd'
- c_suppressions += [
- '-Wno-c11-extensions', # isnan and friends
- ]
- endif
-
- elif cc.get_id() == 'gcc'
- if warning_level == 'everything'
- c_suppressions += [
- '-Wno-bad-function-cast',
- '-Wno-c++-compat',
- '-Wno-cast-align',
- '-Wno-cast-qual',
- '-Wno-conversion',
- '-Wno-double-promotion',
- '-Wno-float-equal',
- '-Wno-inline',
- '-Wno-padded',
- '-Wno-strict-overflow',
- '-Wno-suggest-attribute=const',
- '-Wno-suggest-attribute=pure',
- '-Wno-switch-default',
- '-Wno-unsuffixed-float-constants',
- '-Wno-unused-const-variable',
- ]
- endif
-
- elif cc.get_id() == 'msvc'
- if warning_level == 'everything'
- c_suppressions += [
- '/wd4191', # unsafe function conversion
- '/wd4200', # zero-sized array in struct/union
- '/wd4242', # possible loss of data from float conversion
- '/wd4244', # possible loss of data from integer conversion
- '/wd4267', # possible loss of data from size conversion
- '/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
- '/wd4800', # implicit conversion from int to bool
- '/wd4820', # padding added after construct
- '/wd4996', # POSIX name for this item is deprecated
- '/wd5045', # compiler will insert Spectre mitigation
- ]
- endif
- endif
-
- c_suppressions = cc.get_supported_arguments(c_suppressions)
-endif
-
-#######
-# C++ #
-#######
-
-if is_variable('cpp')
- cpp_suppressions = []
-
- if cpp.get_id() == 'clang'
- if warning_level == 'everything'
- cpp_suppressions += [
- '-Wno-c++98-compat-pedantic',
- '-Wno-cast-align', # MacOS
- '-Wno-cast-qual', # MacOS
- '-Wno-documentation-unknown-command', # MacOS
- '-Wno-double-promotion',
- '-Wno-float-conversion',
- '-Wno-implicit-float-conversion',
- '-Wno-old-style-cast', # MacOS
- '-Wno-padded',
- '-Wno-redundant-parens',
- '-Wno-reserved-id-macro', # MacOS
- '-Wno-shorten-64-to-32',
- '-Wno-sign-conversion',
- '-Wno-unsafe-buffer-usage',
- '-Wno-weak-vtables',
- '-Wno-zero-as-null-pointer-constant', # MacOS
- ]
-
- if not meson.is_cross_build()
- cpp_suppressions += [
- '-Wno-poison-system-directories',
- ]
- endif
- endif
-
- if warning_level in ['everything', '3']
- cpp_suppressions += [
- '-Wno-nullability-extension',
- ]
- endif
-
- elif cpp.get_id() == 'gcc'
- if warning_level == 'everything'
- cpp_suppressions += [
- '-Wno-cast-align', # LV2
- '-Wno-cast-qual', # LV2
- '-Wno-conversion',
- '-Wno-effc++',
- '-Wno-padded',
- '-Wno-strict-overflow',
- '-Wno-suggest-attribute=const',
- '-Wno-suggest-attribute=pure',
- '-Wno-unused-const-variable',
- ]
- endif
- endif
-
- cpp_suppressions = cpp.get_supported_arguments(cpp_suppressions)
-endif
diff --git a/test/meson.build b/test/meson.build
index 951d4a1..4a7a09b 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -98,7 +98,7 @@ test(
executable(
'test_symap',
files('../src/symap.c'),
- c_args: ['-DSYMAP_STANDALONE'],
+ c_args: c_suppressions + ['-DSYMAP_STANDALONE'],
dependencies: [zix_dep],
),
)