Skip to content

Commit

Permalink
Fix unused variable 'to' build failure
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
etcwilde committed Sep 21, 2021
1 parent 0045deb commit 767ce40
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/bsdtestharness.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 767ce40

Please sign in to comment.