From aa6d24924b0449424bd58f667657f4087a573f9c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 3 May 2023 14:04:03 -0400 Subject: Replace strict option with new meson warning level --- meson.build | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index 09712c3..52b9012 100644 --- a/meson.build +++ b/meson.build @@ -25,24 +25,36 @@ versioned_name = 'chilbert-@0@'.format(major_version) pkg = import('pkgconfig') cpp = meson.get_compiler('cpp') -# Set global warning flags -if get_option('strict') - if not meson.is_subproject() - subdir('meson/warnings') - add_project_arguments(all_cpp_warnings, language: ['cpp']) - endif - - cpp_suppressions = [] - if cpp.get_id() == 'clang' +# Set global warning suppressions +cpp_suppressions = [] +warning_level = get_option('warning_level') +if cpp.get_id() in ['clang', 'emscripten'] + if warning_level == 'everything' cpp_suppressions += [ + '-Wno-c++98-compat', + '-Wno-c++98-compat-pedantic', '-Wno-padded', ] - elif cpp.get_id() == 'gcc' + + if not meson.is_cross_build() + cpp_suppressions += [ + '-Wno-poison-system-directories', + ] + endif + endif + +elif cpp.get_id() == 'gcc' + if warning_level == 'everything' cpp_suppressions += [ '-Wno-effc++', + '-Wno-inline', + '-Wno-suggest-attribute=pure', '-Wno-volatile', ] - elif cpp.get_id() == 'msvc' + endif + +elif cpp.get_id() == 'msvc' + if warning_level == 'everything' cpp_suppressions += [ '/wd4028', # formal parameter different from declaration '/wd4204', # non-constant aggregate initializer @@ -55,13 +67,10 @@ if get_option('strict') '/wd5045', # will insert Spectre mitigation ] endif - - add_project_arguments( - cpp.get_supported_arguments(cpp_suppressions), - language: ['cpp'], - ) endif +cpp_suppressions = cpp.get_supported_arguments(cpp_suppressions) + ########### # Library # ########### @@ -123,6 +132,7 @@ if not get_option('tests').disabled() executable( full_name, 'test/@0@.cpp'.format(full_name), + cpp_args: cpp_suppressions, include_directories: include_directories('include'), ), timeout: 1200, @@ -137,6 +147,7 @@ if not get_option('tests').disabled() executable( 'test_hilbert', 'test/test_hilbert.cpp', + cpp_args: cpp_suppressions, dependencies: [gmp_dep, gmpxx_dep], include_directories: include_directories('include'), ), @@ -150,6 +161,7 @@ if not get_option('benchmarks').disabled() executable( 'bench_@0@'.format(name), files('benchmark/bench_@0@.cpp'.format(name)), + cpp_args: cpp_suppressions, include_directories: include_directories('include', 'test'), ) endforeach -- cgit v1.2.1