diff options
-rw-r--r-- | meson.build | 36 | ||||
-rw-r--r-- | test/headers/.clang-tidy | 11 | ||||
-rw-r--r-- | test/headers/test_headers.c | 24 |
3 files changed, 69 insertions, 2 deletions
diff --git a/meson.build b/meson.build index dae8e38..01b3754 100644 --- a/meson.build +++ b/meson.build @@ -218,8 +218,8 @@ threaded_tests = [ 'test_thread', ] -if not get_option('tests').disabled() and not meson.is_subproject() - if get_option('strict') +if not get_option('tests').disabled() + if not meson.is_subproject() and get_option('strict') # Check release metadata autoship = find_program('autoship', required: get_option('tests')) if autoship.found() @@ -277,6 +277,38 @@ if not get_option('tests').disabled() and not meson.is_subproject() ) endforeach endif + + # Test that headers have no warnings (ignoring the usual suppressions) + if cc.get_id() != 'emscripten' + header_suppressions = [] + if cc.get_id() in ['clang', 'emscripten'] + header_suppressions += [ + '-Wno-declaration-after-statement', + '-Wno-nullability-extension', + '-Wno-padded', + ] + elif cc.get_id() == 'gcc' + header_suppressions += [ + '-Wno-padded', + '-Wno-unused-const-variable', + ] + elif cc.get_id() == 'msvc' + header_suppressions += [ + '/wd4820', # padding added after construct + ] + endif + + test( + 'test_headers', + executable( + 'test_headers', + files('test/headers/test_headers.c'), + c_args: header_suppressions + program_c_args, + dependencies: zix_dep, + include_directories: include_dirs, + ), + ) + endif endif ############## diff --git a/test/headers/.clang-tidy b/test/headers/.clang-tidy new file mode 100644 index 0000000..7c6ab44 --- /dev/null +++ b/test/headers/.clang-tidy @@ -0,0 +1,11 @@ +# Copyright 2022 David Robillard <d@drobilla.net> +# SPDX-License-Identifier: CC0-1.0 OR ISC + +Checks: > + *, + -altera-*, + -llvmlibc-*, + -readability-identifier-length, +WarningsAsErrors: '*' +HeaderFilterRegex: '.*' +FormatStyle: file diff --git a/test/headers/test_headers.c b/test/headers/test_headers.c new file mode 100644 index 0000000..43c5482 --- /dev/null +++ b/test/headers/test_headers.c @@ -0,0 +1,24 @@ +// Copyright 2022 David Robillard <d@drobilla.net> +// SPDX-License-Identifier: ISC + +#include "zix/allocator.h" // IWYU pragma: keep +#include "zix/attributes.h" // IWYU pragma: keep +#include "zix/bitset.h" // IWYU pragma: keep +#include "zix/btree.h" // IWYU pragma: keep +#include "zix/bump_allocator.h" // IWYU pragma: keep +#include "zix/common.h" // IWYU pragma: keep +#include "zix/digest.h" // IWYU pragma: keep +#include "zix/hash.h" // IWYU pragma: keep +#include "zix/ring.h" // IWYU pragma: keep +#include "zix/sem.h" // IWYU pragma: keep +#include "zix/thread.h" // IWYU pragma: keep +#include "zix/tree.h" // IWYU pragma: keep + +#if defined(__GNUC__) +__attribute__((const)) +#endif +int +main(void) +{ + return 0; +} |