summaryrefslogtreecommitdiffstats
path: root/test/headers
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2025-01-20 13:16:57 -0500
committerDavid Robillard <d@drobilla.net>2025-01-20 19:16:07 -0500
commit4020bc9376eb77d8b6493d98bf9dc6c5b03e41dc (patch)
tree60c698bdcf05492260f6bbdae4afc52c4240f3eb /test/headers
parentde841cda8e85fac25f53c7e10ff76e0ef11175a8 (diff)
downloadlilv-4020bc9376eb77d8b6493d98bf9dc6c5b03e41dc.tar.gz
lilv-4020bc9376eb77d8b6493d98bf9dc6c5b03e41dc.tar.bz2
lilv-4020bc9376eb77d8b6493d98bf9dc6c5b03e41dc.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.
Diffstat (limited to 'test/headers')
-rw-r--r--test/headers/.clang-tidy15
-rw-r--r--test/headers/meson.build27
-rw-r--r--test/headers/test_headers.c13
3 files changed, 55 insertions, 0 deletions
diff --git a/test/headers/.clang-tidy b/test/headers/.clang-tidy
new file mode 100644
index 0000000..a42a718
--- /dev/null
+++ b/test/headers/.clang-tidy
@@ -0,0 +1,15 @@
+# Copyright 2020-2024 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+Checks: >
+ *,
+ -altera-*,
+ -llvmlibc-*,
+CheckOptions:
+ - key: readability-function-cognitive-complexity.Threshold
+ value: '1'
+ - key: readability-identifier-length.IgnoredParameterNames
+ value: '^(a)|(b)|(ui)|(i)$'
+WarningsAsErrors: '*'
+HeaderFilterRegex: '.*'
+FormatStyle: file
diff --git a/test/headers/meson.build b/test/headers/meson.build
new file mode 100644
index 0000000..4415de1
--- /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: lilv_dep,
+ ),
+ suite: 'unit',
+)
diff --git a/test/headers/test_headers.c b/test/headers/test_headers.c
new file mode 100644
index 0000000..b0d4aa5
--- /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 <lilv/lilv.h> // IWYU pragma: keep
+
+#ifdef __GNUC__
+__attribute__((const))
+#endif
+int
+main(void)
+{
+ return 0;
+}