From 2c1e022ebbb2619b6e497a360480294bb950e20e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 23 Oct 2022 21:48:38 -0400 Subject: Test header for warnings more strictly --- NEWS | 3 ++- include/.clang-tidy | 12 ------------ test/headers/.clang-tidy | 12 ++++++++++++ test/headers/meson.build | 29 +++++++++++++++++++++++++++++ test/headers/test_headers.c | 11 +++++++++++ test/meson.build | 6 ++++++ 6 files changed, 60 insertions(+), 13 deletions(-) delete mode 100644 include/.clang-tidy create mode 100644 test/headers/.clang-tidy create mode 100644 test/headers/meson.build create mode 100644 test/headers/test_headers.c diff --git a/NEWS b/NEWS index cbcb4286..4b72e0a6 100644 --- a/NEWS +++ b/NEWS @@ -1,8 +1,9 @@ serd (0.30.17) unstable; urgency=medium * Override pkg-config dependency within meson + * Test header for warnings more strictly - -- David Robillard Fri, 07 Oct 2022 17:20:42 +0000 + -- David Robillard Sat, 01 Oct 2022 16:24:20 +0000 serd (0.30.16) stable; urgency=medium diff --git a/include/.clang-tidy b/include/.clang-tidy deleted file mode 100644 index a2f9d2b0..00000000 --- a/include/.clang-tidy +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright 2020-2022 David Robillard -# SPDX-License-Identifier: 0BSD OR ISC -Checks: > - *, - -*-uppercase-literal-suffix, - -altera-struct-pack-align, - -clang-diagnostic-unused-macros, - -llvmlibc-*, - -readability-identifier-length, -WarningsAsErrors: '*' -HeaderFilterRegex: '.*' -FormatStyle: file diff --git a/test/headers/.clang-tidy b/test/headers/.clang-tidy new file mode 100644 index 00000000..e7f1ca66 --- /dev/null +++ b/test/headers/.clang-tidy @@ -0,0 +1,12 @@ +# Copyright 2020-2022 David Robillard +# SPDX-License-Identifier: 0BSD OR ISC + +Checks: > + *, + -*-uppercase-literal-suffix, + -altera-*, + -llvmlibc-*, + -readability-identifier-length, +WarningsAsErrors: '*' +HeaderFilterRegex: '.*' +FormatStyle: file diff --git a/test/headers/meson.build b/test/headers/meson.build new file mode 100644 index 00000000..ac9dc2d2 --- /dev/null +++ b/test/headers/meson.build @@ -0,0 +1,29 @@ +# Copyright 2020-2022 David Robillard +# SPDX-License-Identifier: 0BSD OR ISC + +header_c_suppressions = [] + +if get_option('strict') + if cc.get_id() == 'clang' + header_c_suppressions += [ + '-Wno-nullability-extension', + '-Wno-padded', + ] + elif cc.get_id() == 'gcc' + header_c_suppressions += [ + '-Wno-padded', + '-Wno-unused-const-variable', + ] + endif +endif + +test( + 'headers', + executable( + 'test_headers', + files('test_headers.c'), + c_args: header_c_suppressions, + dependencies: serd_dep, + ), + suite: 'unit', +) diff --git a/test/headers/test_headers.c b/test/headers/test_headers.c new file mode 100644 index 00000000..c855c103 --- /dev/null +++ b/test/headers/test_headers.c @@ -0,0 +1,11 @@ +// Copyright 2022 David Robillard +// SPDX-License-Identifier: ISC + +#include "serd/serd.h" // IWYU pragma: keep + +SERD_CONST_FUNC +int +main(void) +{ + return 0; +} diff --git a/test/meson.build b/test/meson.build index eaf8fff3..3980538d 100644 --- a/test/meson.build +++ b/test/meson.build @@ -27,6 +27,12 @@ if get_option('strict') endif endif +################### +# Header Warnings # +################### + +subdir('headers') + ############## # Unit Tests # ############## -- cgit v1.2.1