aboutsummaryrefslogtreecommitdiffstats
path: root/test/cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-12-10 14:51:34 -0500
committerDavid Robillard <d@drobilla.net>2022-12-11 13:15:02 -0500
commit86e5e821531ff563b7e4642aa792d9e0f3067557 (patch)
tree8c637653d8222471309f762eb36bc774f62a8fc2 /test/cpp
parentd102b7df35d900d568e49e640a5331f283717737 (diff)
downloadlv2-86e5e821531ff563b7e4642aa792d9e0f3067557.tar.xz
Test headers for warnings more strictly
Diffstat (limited to 'test/cpp')
-rw-r--r--test/cpp/.clang-tidy26
-rw-r--r--test/cpp/test_build.cpp54
2 files changed, 80 insertions, 0 deletions
diff --git a/test/cpp/.clang-tidy b/test/cpp/.clang-tidy
new file mode 100644
index 0000000..02d730c
--- /dev/null
+++ b/test/cpp/.clang-tidy
@@ -0,0 +1,26 @@
+# Copyright 2020-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+Checks: >
+ -*-avoid-c-arrays,
+ -*-deprecated-headers,
+ -*-no-malloc,
+ -*-use-auto,
+ -bugprone-reserved-identifier,
+ -cert-dcl37-c,
+ -cert-dcl50-cpp,
+ -cert-dcl51-cpp,
+ -cppcoreguidelines-macro-usage,
+ -cppcoreguidelines-owning-memory,
+ -cppcoreguidelines-pro-bounds-array-to-pointer-decay,
+ -cppcoreguidelines-pro-bounds-pointer-arithmetic,
+ -cppcoreguidelines-pro-type-cstyle-cast,
+ -cppcoreguidelines-pro-type-vararg,
+ -hicpp-no-array-decay,
+ -hicpp-vararg,
+ -llvmlibc-callee-namespace,
+ -modernize-use-nullptr,
+ -modernize-use-using,
+ -readability-implicit-bool-conversion,
+InheritParentConfig: true
+
diff --git a/test/cpp/test_build.cpp b/test/cpp/test_build.cpp
new file mode 100644
index 0000000..c8b2ca0
--- /dev/null
+++ b/test/cpp/test_build.cpp
@@ -0,0 +1,54 @@
+// Copyright 2022 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
+
+#if defined(__clang__)
+_Pragma("clang diagnostic push")
+_Pragma("clang diagnostic ignored \"-Wold-style-cast\"")
+_Pragma("clang diagnostic ignored \"-Wzero-as-null-pointer-constant\"")
+#elif defined(__GNUC__)
+_Pragma("GCC diagnostic push")
+_Pragma("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
+#endif
+
+#include "lv2/atom/atom.h" // IWYU pragma: keep
+#include "lv2/atom/forge.h" // IWYU pragma: keep
+#include "lv2/atom/util.h" // IWYU pragma: keep
+#include "lv2/buf-size/buf-size.h" // IWYU pragma: keep
+#include "lv2/core/attributes.h" // IWYU pragma: keep
+#include "lv2/core/lv2.h" // IWYU pragma: keep
+#include "lv2/core/lv2_util.h" // IWYU pragma: keep
+#include "lv2/data-access/data-access.h" // IWYU pragma: keep
+#include "lv2/dynmanifest/dynmanifest.h" // IWYU pragma: keep
+#include "lv2/event/event-helpers.h" // IWYU pragma: keep
+#include "lv2/event/event.h" // IWYU pragma: keep
+#include "lv2/instance-access/instance-access.h" // IWYU pragma: keep
+#include "lv2/log/log.h" // IWYU pragma: keep
+#include "lv2/log/logger.h" // IWYU pragma: keep
+#include "lv2/midi/midi.h" // IWYU pragma: keep
+#include "lv2/morph/morph.h" // IWYU pragma: keep
+#include "lv2/options/options.h" // IWYU pragma: keep
+#include "lv2/parameters/parameters.h" // IWYU pragma: keep
+#include "lv2/patch/patch.h" // IWYU pragma: keep
+#include "lv2/port-groups/port-groups.h" // IWYU pragma: keep
+#include "lv2/port-props/port-props.h" // IWYU pragma: keep
+#include "lv2/presets/presets.h" // IWYU pragma: keep
+#include "lv2/resize-port/resize-port.h" // IWYU pragma: keep
+#include "lv2/state/state.h" // IWYU pragma: keep
+#include "lv2/time/time.h" // IWYU pragma: keep
+#include "lv2/ui/ui.h" // IWYU pragma: keep
+#include "lv2/units/units.h" // IWYU pragma: keep
+#include "lv2/uri-map/uri-map.h" // IWYU pragma: keep
+#include "lv2/urid/urid.h" // IWYU pragma: keep
+#include "lv2/worker/worker.h" // IWYU pragma: keep
+
+int
+main()
+{
+ return 0;
+}
+
+#if defined(__clang__)
+_Pragma("clang diagnostic pop")
+#elif defined(__GNUC__)
+_Pragma("GCC diagnostic pop")
+#endif