Skip to content

Commit 767ce40

Browse files
committed
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.
1 parent 0045deb commit 767ce40

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/bsdtestharness.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,6 @@ main(int argc, char *argv[])
7272
assert(res == 0);
7373
#endif
7474

75-
uint64_t to = 0;
76-
char *tos = getenv("BSDTEST_TIMEOUT");
77-
if (tos) {
78-
to = strtoul(tos, NULL, 0);
79-
to *= NSEC_PER_SEC;
80-
}
81-
8275
#ifdef __APPLE__
8376
char *arch = getenv("BSDTEST_ARCH");
8477
if (arch) {
@@ -245,6 +238,13 @@ main(int argc, char *argv[])
245238
});
246239
dispatch_resume(tmp_ds);
247240

241+
uint64_t to = 0;
242+
char *tos = getenv("BSDTEST_TIMEOUT");
243+
if (tos) {
244+
to = strtoul(tos, NULL, 0);
245+
to *= NSEC_PER_SEC;
246+
}
247+
248248
if (!to) {
249249
#if TARGET_OS_EMBEDDED
250250
to = 180LL * NSEC_PER_SEC;

0 commit comments

Comments
 (0)