From 0045debb35b812b027b4c36a9095cd6c44de5e54 Mon Sep 17 00:00:00 2001 From: Evan Wilde Date: Tue, 21 Sep 2021 16:54:36 -0700 Subject: [PATCH 1/2] Fix unused 'j' build failure Variable 'j' is unused in this test and clang emits a warning. `-Werror` is enabled, so this warning is actually emitted as an error. --- tests/dispatch_apply.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/dispatch_apply.c b/tests/dispatch_apply.c index fa7fab53f..1f2dfb470 100644 --- a/tests/dispatch_apply.c +++ b/tests/dispatch_apply.c @@ -65,6 +65,7 @@ static void busythread(void *ignored) j += i; i += 1; } + (void)j; OSAtomicIncrement32(&busy_threads_finished); } From 767ce402c9ce59c1be9451230c32520f268cb6b7 Mon Sep 17 00:00:00 2001 From: Evan Wilde Date: Tue, 21 Sep 2021 16:55:45 -0700 Subject: [PATCH 2/2] Fix unused variable 'to' build failure In only one of the ifdef cases is the `to` variable used. Clang on the rebranch branch recognizes this to be unused on the other branches and emits a warning. This project has `-Werror` enabled, so this results in a build failure. I moved the entire code block down closer to where it is used because it isn't entirely clear based on where it used to sit given the number of macro ifdef's between declaration and usage. --- tests/bsdtestharness.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/bsdtestharness.c b/tests/bsdtestharness.c index ca52d6e97..93ed8324b 100644 --- a/tests/bsdtestharness.c +++ b/tests/bsdtestharness.c @@ -72,13 +72,6 @@ main(int argc, char *argv[]) assert(res == 0); #endif - uint64_t to = 0; - char *tos = getenv("BSDTEST_TIMEOUT"); - if (tos) { - to = strtoul(tos, NULL, 0); - to *= NSEC_PER_SEC; - } - #ifdef __APPLE__ char *arch = getenv("BSDTEST_ARCH"); if (arch) { @@ -245,6 +238,13 @@ main(int argc, char *argv[]) }); dispatch_resume(tmp_ds); + uint64_t to = 0; + char *tos = getenv("BSDTEST_TIMEOUT"); + if (tos) { + to = strtoul(tos, NULL, 0); + to *= NSEC_PER_SEC; + } + if (!to) { #if TARGET_OS_EMBEDDED to = 180LL * NSEC_PER_SEC;