From 567988736d3e11dc645a1edf3a21370378975115 Mon Sep 17 00:00:00 2001 From: Richard Barnes Date: Wed, 11 Jan 2023 16:31:31 -0800 Subject: [PATCH] Remove unused variables in hermetic_infra/reverie/tests/c_tests/forkMany-blockSigchld.c Summary: LLVM-15 has a warning `-Wunused-but-set-variable` which we treat as an error because it's so often diagnostic of a code issue. Unused variables can compromise readability or, worse, performance. This diff either (a) removes an unused variable and, possibly, it's associated code, or (b) qualifies the variable with `[[maybe_unused]]`, mostly in cases where the variable _is_ used, but, eg, in an `assert` statement that isn't present in production code. - If you approve of this diff, please use the "Accept & Ship" button :-) Reviewed By: luciang Differential Revision: D42465117 fbshipit-source-id: 64e7dec0eecaa4e3c50d4fea5ffd1c57cd8b58d7 --- tests/c_tests/forkMany-blockSigchld.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/c_tests/forkMany-blockSigchld.c b/tests/c_tests/forkMany-blockSigchld.c index 97db214..5eff3e5 100644 --- a/tests/c_tests/forkMany-blockSigchld.c +++ b/tests/c_tests/forkMany-blockSigchld.c @@ -27,7 +27,6 @@ static _Atomic unsigned long* counter; int main(int argc, char* argv[]) { sigset_t oldset, set; pid_t pid; - unsigned long c; int status; counter = mmap( @@ -49,10 +48,10 @@ int main(int argc, char* argv[]) { pid = fork(); // Child if (pid == 0) { - c = atomic_fetch_add(counter, 1); + atomic_fetch_add(counter, 1); exit(0); } else if (pid > 0) { - c = atomic_fetch_add(counter, 1); + atomic_fetch_add(counter, 1); } else { perror("fork: "); exit(1);