summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-02-04 19:25:22 -0500
committerDavid Robillard <d@drobilla.net>2023-02-04 19:25:22 -0500
commit5a9787b4247c6735cc3213944945e8983002edf9 (patch)
tree635a8711a53b9e50d7dcd24dc4acefefce694c3d /test
parentc4b3814edad510c6c124089822bd5506f9334411 (diff)
downloadzix-5a9787b4247c6735cc3213944945e8983002edf9.tar.gz
zix-5a9787b4247c6735cc3213944945e8983002edf9.tar.bz2
zix-5a9787b4247c6735cc3213944945e8983002edf9.zip
Suppress/fix clang-tidy warnings on Windows
Diffstat (limited to 'test')
-rw-r--r--test/cpp/test_headers_cpp.cpp2
-rw-r--r--test/cpp/test_path_std.cpp16
-rw-r--r--test/test_btree.c2
-rw-r--r--test/test_hash.c2
-rw-r--r--test/test_ring.c10
-rw-r--r--test/test_tree.c2
6 files changed, 24 insertions, 10 deletions
diff --git a/test/cpp/test_headers_cpp.cpp b/test/cpp/test_headers_cpp.cpp
index 3fabe6e..f8038c1 100644
--- a/test/cpp/test_headers_cpp.cpp
+++ b/test/cpp/test_headers_cpp.cpp
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: ISC
#ifdef _WIN32
-# define WIN32_LEAN_AND_MEAN 1
+# define WIN32_LEAN_AND_MEAN
#endif
#include "zix/allocator.h" // IWYU pragma: keep
diff --git a/test/cpp/test_path_std.cpp b/test/cpp/test_path_std.cpp
index 50ccad4..6c0e450 100644
--- a/test/cpp/test_path_std.cpp
+++ b/test/cpp/test_path_std.cpp
@@ -433,8 +433,8 @@ equal(const std::filesystem::path& path, const ZixStringView view)
path.u8string() == std::string{view.data, view.length});
}
-int
-main()
+static void
+run()
{
using Path = std::filesystem::path;
@@ -493,3 +493,15 @@ main()
zix_path_lexically_relative(nullptr, relatives.rhs, relatives.lhs)));
}
}
+
+int
+main()
+{
+ try {
+ run();
+ } catch (...) {
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/test/test_btree.c b/test/test_btree.c
index a6f724a..7fd73bc 100644
--- a/test/test_btree.c
+++ b/test/test_btree.c
@@ -97,7 +97,7 @@ test_fail(ZixBTree* t, const char* fmt, ...)
return EXIT_SUCCESS;
}
- va_list args;
+ va_list args; // NOLINT(cppcoreguidelines-init-variables)
va_start(args, fmt);
fprintf(stderr, "error: ");
vfprintf(stderr, fmt, args);
diff --git a/test/test_hash.c b/test/test_hash.c
index 5101aa8..c3aaaba 100644
--- a/test/test_hash.c
+++ b/test/test_hash.c
@@ -35,7 +35,7 @@ test_fail(ZixHash* const hash,
...)
{
if (!expect_failure) {
- va_list args;
+ va_list args; // NOLINT(cppcoreguidelines-init-variables)
va_start(args, fmt);
fprintf(stderr, "error: ");
vfprintf(stderr, fmt, args);
diff --git a/test/test_ring.c b/test/test_ring.c
index fc3d982..644f333 100644
--- a/test/test_ring.c
+++ b/test/test_ring.c
@@ -102,11 +102,13 @@ test_ring(const unsigned size)
const ZixStatus st = zix_ring_mlock(ring);
assert(!st || st == ZIX_STATUS_NOT_SUPPORTED);
- ZixThread reader_thread; // NOLINT
- assert(!zix_thread_create(&reader_thread, MSG_SIZE * 4UL, reader, NULL));
+ static const size_t stack_size = (size_t)MSG_SIZE * 4U;
- ZixThread writer_thread; // NOLINT
- assert(!zix_thread_create(&writer_thread, MSG_SIZE * 4UL, writer, NULL));
+ ZixThread reader_thread; // NOLINT(cppcoreguidelines-init-variables)
+ assert(!zix_thread_create(&reader_thread, stack_size, reader, NULL));
+
+ ZixThread writer_thread; // NOLINT(cppcoreguidelines-init-variables)
+ assert(!zix_thread_create(&writer_thread, stack_size, writer, NULL));
assert(!zix_thread_join(reader_thread));
assert(!zix_thread_join(writer_thread));
diff --git a/test/test_tree.c b/test/test_tree.c
index 700729b..b51bb29 100644
--- a/test/test_tree.c
+++ b/test/test_tree.c
@@ -49,7 +49,7 @@ ZIX_LOG_FUNC(1, 2)
static int
test_fail(const char* const fmt, ...)
{
- va_list args;
+ va_list args; // NOLINT(cppcoreguidelines-init-variables)
va_start(args, fmt);
fprintf(stderr, "error: ");