From fd11071115664d7cd72556c91e28cccf22c57bf5 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 20 Jan 2025 13:08:08 -0500 Subject: Use "system" include type for all dependencies and add header test Things get confused when these flags differ across projects, so universally use "system" for external dependencies and test for header warnings only in the project that owns them. --- NEWS | 6 ++++++ meson.build | 19 ++++++++++++++++--- test/headers/.clang-tidy | 13 +++++++++++++ test/headers/meson.build | 27 +++++++++++++++++++++++++++ test/headers/test_headers.c | 13 +++++++++++++ 5 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 test/headers/.clang-tidy create mode 100644 test/headers/meson.build create mode 100644 test/headers/test_headers.c diff --git a/NEWS b/NEWS index 6890053..594b4ba 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +suil (0.10.23) unstable; urgency=medium + + * Add header warnings test + + -- David Robillard Mon, 20 Jan 2025 18:06:58 +0000 + suil (0.10.22) stable; urgency=medium * Add support for X11 in Qt6 diff --git a/meson.build b/meson.build index 3ededac..e785109 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -# Copyright 2021-2022 David Robillard +# Copyright 2021-2025 David Robillard # SPDX-License-Identifier: 0BSD OR ISC project( @@ -12,7 +12,7 @@ project( ], license: 'ISC', meson_version: '>= 0.56.0', - version: '0.10.22', + version: '0.10.23', ) suil_src_root = meson.current_source_dir() @@ -203,7 +203,12 @@ endif dl_dep = cc.find_library('dl', required: false) -lv2_dep = dependency('lv2', fallback: 'lv2', version: '>= 1.18.4') +lv2_dep = dependency( + 'lv2', + fallback: 'lv2', + include_type: 'system', + version: '>= 1.18.4', +) x11_dep = dependency( 'x11', @@ -466,6 +471,14 @@ if qt6_dep.found() ) endif +######### +# Tests # +######### + +if not get_option('tests').disabled() + subdir('test/headers') +endif + ######## # Lint # ######## diff --git a/test/headers/.clang-tidy b/test/headers/.clang-tidy new file mode 100644 index 0000000..c0f1613 --- /dev/null +++ b/test/headers/.clang-tidy @@ -0,0 +1,13 @@ +# Copyright 2020-2025 David Robillard +# SPDX-License-Identifier: 0BSD OR ISC + +Checks: > + *, + -altera-*, + -llvmlibc-*, +CheckOptions: + - key: readability-function-cognitive-complexity.Threshold + value: '0' +WarningsAsErrors: '*' +HeaderFilterRegex: '.*' +FormatStyle: file diff --git a/test/headers/meson.build b/test/headers/meson.build new file mode 100644 index 0000000..191159c --- /dev/null +++ b/test/headers/meson.build @@ -0,0 +1,27 @@ +# Copyright 2020-2025 David Robillard +# SPDX-License-Identifier: 0BSD OR ISC + +header_c_suppressions = [] + +if get_option('warning_level') == 'everything' + if cc.get_id() == 'clang' + if not meson.is_cross_build() + header_c_suppressions += ['-Wno-poison-system-directories'] + endif + endif +endif + +if cc.get_id() == 'clang' + header_c_suppressions += ['-Wno-nullability-extension'] +endif + +test( + 'headers', + executable( + 'test_headers', + files('test_headers.c'), + c_args: header_c_suppressions, + dependencies: suil_dep, + ), + suite: 'unit', +) diff --git a/test/headers/test_headers.c b/test/headers/test_headers.c new file mode 100644 index 0000000..f79c9c6 --- /dev/null +++ b/test/headers/test_headers.c @@ -0,0 +1,13 @@ +// Copyright 2022-2025 David Robillard +// SPDX-License-Identifier: ISC + +#include // IWYU pragma: keep + +#if defined(__GNUC__) +__attribute__((const)) +#endif +int +main(void) +{ + return 0; +} -- cgit v1.2.1