diff options
Diffstat (limited to 'test/headers')
-rw-r--r-- | test/headers/.clang-tidy | 22 | ||||
-rw-r--r-- | test/headers/meson.build | 69 | ||||
-rw-r--r-- | test/headers/test_headers.c | 42 |
3 files changed, 133 insertions, 0 deletions
diff --git a/test/headers/.clang-tidy b/test/headers/.clang-tidy new file mode 100644 index 0000000..bf971cc --- /dev/null +++ b/test/headers/.clang-tidy @@ -0,0 +1,22 @@ +# Copyright 2020-2024 David Robillard <d@drobilla.net> +# SPDX-License-Identifier: 0BSD OR ISC + +Checks: > + *, + -*-macro-to-enum, + -*-magic-numbers, + -altera-*, + -bugprone-assignment-in-if-condition, + -bugprone-easily-swappable-parameters, + -bugprone-macro-parentheses, + -llvmlibc-restrict-system-libc-headers, + -performance-no-int-to-ptr, + -readability-identifier-length, +CheckOptions: + - key: hicpp-uppercase-literal-suffix.NewSuffixes + value: L;U;f + - key: readability-uppercase-literal-suffix.NewSuffixes + value: L;U;f +FormatStyle: file +HeaderFilterRegex: 'lv2/.*\.h' +WarningsAsErrors: '*' diff --git a/test/headers/meson.build b/test/headers/meson.build new file mode 100644 index 0000000..89ee4b8 --- /dev/null +++ b/test/headers/meson.build @@ -0,0 +1,69 @@ +# Copyright 2020-2022 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' + header_c_suppressions += [ + '-Wno-cast-align', + '-Wno-cast-qual', + '-Wno-declaration-after-statement', + '-Wno-padded', + '-Wno-unsafe-buffer-usage', + ] + + if not meson.is_cross_build() + header_c_suppressions += [ + '-Wno-poison-system-directories', + ] + endif + + if host_machine.system() == 'windows' + header_c_suppressions += [ + '-Wno-format-nonliteral', + ] + endif + + elif cc.get_id() == 'gcc' + header_c_suppressions += [ + '-Wno-cast-align', + '-Wno-cast-qual', + '-Wno-padded', + '-Wno-sign-conversion', + '-Wno-suggest-attribute=format', + '-Wno-unused-const-variable', + ] + + if host_machine.system() == 'windows' + header_c_suppressions += [ + '-Wno-sign-conversion', + ] + endif + + elif cc.get_id() == 'msvc' + header_c_suppressions += [ + '/wd4820', # padding added after construct + ] + endif +endif + +if cc.get_id() == 'clang' + header_c_suppressions += [ + '-Wno-nullability-extension', + ] +endif + +header_c_suppressions = cc.get_supported_arguments(header_c_suppressions) + +test( + 'headers', + executable( + 'test_headers', + files('test_headers.c'), + c_args: header_c_suppressions, + dependencies: [lv2_dep], + implicit_include_directories: false, + ), + suite: 'unit', +) diff --git a/test/headers/test_headers.c b/test/headers/test_headers.c new file mode 100644 index 0000000..d62b000 --- /dev/null +++ b/test/headers/test_headers.c @@ -0,0 +1,42 @@ +// Copyright 2022 David Robillard <d@drobilla.net> +// SPDX-License-Identifier: ISC + +#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 + +#ifdef __GNUC__ +__attribute__((const)) +#endif +int +main(void) +{ + return 0; +} |