summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2025-01-20 13:08:08 -0500
committerDavid Robillard <d@drobilla.net>2025-01-20 13:08:08 -0500
commitfd11071115664d7cd72556c91e28cccf22c57bf5 (patch)
treec84013b4899032b0530cba903f45d8fb3f2591c6
parentf4240a9b27e98c40138c6ec866132b237f311dff (diff)
downloadsuil-fd11071115664d7cd72556c91e28cccf22c57bf5.tar.gz
suil-fd11071115664d7cd72556c91e28cccf22c57bf5.tar.bz2
suil-fd11071115664d7cd72556c91e28cccf22c57bf5.zip
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.
-rw-r--r--NEWS6
-rw-r--r--meson.build19
-rw-r--r--test/headers/.clang-tidy13
-rw-r--r--test/headers/meson.build27
-rw-r--r--test/headers/test_headers.c13
5 files changed, 75 insertions, 3 deletions
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 <d@drobilla.net> 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 <d@drobilla.net>
+# Copyright 2021-2025 David Robillard <d@drobilla.net>
# 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 <d@drobilla.net>
+# 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 <d@drobilla.net>
+# 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 <d@drobilla.net>
+// SPDX-License-Identifier: ISC
+
+#include <suil/suil.h> // IWYU pragma: keep
+
+#if defined(__GNUC__)
+__attribute__((const))
+#endif
+int
+main(void)
+{
+ return 0;
+}