From 55f9506e4fe172cd5376ad9d95a99440a90b3c43 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 28 May 2021 16:25:52 -0400 Subject: Split up warning suppression flags more finely This avoids polluting the main list of suppressions with things that are only triggered in tests or examples, making it clearer which warning are present in pugl itself. --- test/meson.build | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/meson.build b/test/meson.build index bd838f3..a50b6c7 100644 --- a/test/meson.build +++ b/test/meson.build @@ -1,3 +1,38 @@ +# Suppress some additional C warnings in tests +test_c_args = [] +if get_option('strict') + if cc.get_id() == 'clang' + test_c_args += [ + '-Wno-float-equal', + ] + elif cc.get_id() == 'gcc' + test_c_args += [ + '-Wno-float-equal', + ] + endif + + test_c_args = cc.get_supported_arguments(test_c_args) +endif + +# Suppress some additional C++ warnings in tests +test_cpp_args = [] +if get_option('strict') and is_variable('cpp') + if cpp.get_id() == 'clang' + test_cpp_args += [ + '-Wno-documentation', # Cairo + '-Wno-documentation-unknown-command', # Cairo + '-Wno-old-style-cast', + '-Wno-padded', + ] + elif cpp.get_id() == 'gcc' + test_cpp_args += [ + '-Wno-padded', + ] + endif + + test_cpp_args = cpp.get_supported_arguments(test_cpp_args) +endif + basic_tests = [ 'local_copy_paste', 'realize', @@ -35,6 +70,7 @@ includes = [ foreach test : basic_tests test(test, executable('test_' + test, 'test_@0@.c'.format(test), + c_args: test_c_args, include_directories: include_directories(includes), dependencies: [pugl_dep, stub_backend_dep])) endforeach @@ -43,6 +79,7 @@ if opengl_dep.found() foreach test : gl_tests test(test, executable('test_' + test, 'test_@0@.c'.format(test), + c_args: test_c_args, include_directories: include_directories(includes), dependencies: [pugl_dep, gl_backend_dep])) endforeach @@ -52,6 +89,7 @@ if cairo_dep.found() foreach test : cairo_tests test(test, executable('test_' + test, 'test_@0@.c'.format(test), + c_args: test_c_args, include_directories: include_directories(includes), dependencies: [pugl_dep, cairo_backend_dep])) endforeach @@ -61,6 +99,8 @@ if vulkan_dep.found() foreach test : vulkan_tests test(test, executable('test_' + test, 'test_@0@.c'.format(test), + c_args: test_c_args, + cpp_args: test_cpp_args, include_directories: include_directories(includes), dependencies: [pugl_dep, vulkan_backend_dep])) endforeach @@ -88,14 +128,33 @@ if host_machine.system() == 'darwin' objcpp = meson.get_compiler('objcpp') unified_args += objcpp.get_supported_arguments( - c_warnings + cpp_warnings + objc_warnings) + c_warnings + test_cpp_args + objc_warnings) executable('inline_objcpp', 'test_inline_objcpp.mm', include_directories: include_directories(includes), dependencies: unified_deps, objcpp_args: unified_args) + elif is_variable('cpp') - if cpp.get_id() == 'msvc' + unified_args = [] + + if cpp.get_id() == 'clang' + unified_args += [ + '-Wno-old-style-cast', + '-Wno-reserved-id-macro', + '-Wno-switch-default', + '-Wno-switch-enum', + '-Wno-unused-macros', # Mac + ] + elif cpp.get_id() == 'gcc' + unified_args += [ + '-Wno-conditionally-supported', + '-Wno-old-style-cast', + '-Wno-switch-default', + '-Wno-switch-enum', + '-Wno-useless-cast', + ] + elif cpp.get_id() == 'msvc' unified_args += [ '/wd4464' # relative include path contains '..' ] @@ -104,5 +163,5 @@ elif is_variable('cpp') executable('inline_cpp', 'test_inline_cpp.cpp', include_directories: include_directories(includes), dependencies: unified_deps, - cpp_args: unified_args) + cpp_args: test_cpp_args + unified_args) endif -- cgit v1.2.1