aboutsummaryrefslogtreecommitdiffstats
path: root/test/headers
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2025-01-21 11:48:14 -0500
committerDavid Robillard <d@drobilla.net>2025-01-21 11:48:14 -0500
commit51aae63069fb93a9994cae72f8c28cee06f92362 (patch)
treef708c503a72d2c4bf06856d81cf49286b02b10b7 /test/headers
parent8c8c268bf2166b9049b51cde89a3330462771249 (diff)
downloadpugl-51aae63069fb93a9994cae72f8c28cee06f92362.tar.gz
pugl-51aae63069fb93a9994cae72f8c28cee06f92362.tar.bz2
pugl-51aae63069fb93a9994cae72f8c28cee06f92362.zip
Add header warning tests
Diffstat (limited to 'test/headers')
-rw-r--r--test/headers/.clang-tidy16
-rw-r--r--test/headers/meson.build33
-rw-r--r--test/headers/test_headers.c22
3 files changed, 71 insertions, 0 deletions
diff --git a/test/headers/.clang-tidy b/test/headers/.clang-tidy
new file mode 100644
index 0000000..7ec81cf
--- /dev/null
+++ b/test/headers/.clang-tidy
@@ -0,0 +1,16 @@
+# Copyright 2020-2025 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+Checks: >
+ *,
+ -*-magic-numbers,
+ -altera-*,
+ -llvmlibc-*,
+CheckOptions:
+ - key: readability-function-cognitive-complexity.Threshold
+ value: '0'
+ - key: readability-identifier-length.IgnoredParameterNames
+ value: '^(id)|(x)|(y)$'
+FormatStyle: file
+HeaderFilterRegex: '.*'
+WarningsAsErrors: '*'
diff --git a/test/headers/meson.build b/test/headers/meson.build
new file mode 100644
index 0000000..72d039a
--- /dev/null
+++ b/test/headers/meson.build
@@ -0,0 +1,33 @@
+# 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
+
+test_headers_c_args = header_c_suppressions
+test_headers_c_args += [
+ '-DPUGL_NO_INCLUDE_GL_H',
+ '-DPUGL_NO_INCLUDE_GLU_H',
+]
+
+if vulkan_dep.found()
+ test_headers_c_args += ['-DPUGL_TEST_VULKAN']
+endif
+
+test(
+ 'headers',
+ executable(
+ 'test_headers_c',
+ files('test_headers.c'),
+ c_args: test_headers_c_args,
+ dependencies: pugl_dep,
+ ),
+ suite: 'unit',
+)
diff --git a/test/headers/test_headers.c b/test/headers/test_headers.c
new file mode 100644
index 0000000..2e109f2
--- /dev/null
+++ b/test/headers/test_headers.c
@@ -0,0 +1,22 @@
+// Copyright 2022-2025 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
+
+#include <pugl/attributes.h> // IWYU pragma: keep
+#include <pugl/cairo.h> // IWYU pragma: keep
+#include <pugl/gl.h> // IWYU pragma: keep
+#include <pugl/glu.h> // IWYU pragma: keep
+#include <pugl/pugl.h> // IWYU pragma: keep
+#include <pugl/stub.h> // IWYU pragma: keep
+
+#ifdef PUGL_TEST_VULKAN
+# include <pugl/vulkan.h> // IWYU pragma: keep
+#endif
+
+#ifdef __GNUC__
+__attribute__((const))
+#endif
+int
+main(void)
+{
+ return 0;
+}