Re: git: 3dbe05f61b65 - main - Suppress unused variable warning in mfi.c
- In reply to: Dimitry Andric : "git: 3dbe05f61b65 - main - Suppress unused variable warning in mfi.c"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 20 Jul 2022 22:19:23 UTC
On 7/20/22 9:50 AM, Dimitry Andric wrote: > The branch main has been updated by dim: > > URL: https://cgit.FreeBSD.org/src/commit/?id=3dbe05f61b65a73582aefdc2ee5a50ad2b4390ef > > commit 3dbe05f61b65a73582aefdc2ee5a50ad2b4390ef > Author: Dimitry Andric <dim@FreeBSD.org> > AuthorDate: 2022-07-19 19:38:41 +0000 > Commit: Dimitry Andric <dim@FreeBSD.org> > CommitDate: 2022-07-20 15:13:49 +0000 > > Suppress unused variable warning in mfi.c > > With clang 15, the following -Werror warnings are produced: > > sys/dev/mfi/mfi.c:3698:6: error: variable 'timedout' set but not used [-Werror,-Wunused-but-set-variable] > int timedout; > ^ > sys/dev/mfi/mfi.c:3742:6: error: variable 'timedout' set but not used [-Werror,-Wunused-but-set-variable] > int timedout = 0; > ^ > > Here, 'timedout' are variables that are only used when debugging, > requiring #if 0 statements to be modified. Mark the variables as > potentially unused, to suppress the warnings. > > MFC after: 3 days FWIW, when making similar changes recently if a variable was truly only ever used under an #ifdef or #if 0, I tended to move the variable under the #ifdef or #if 0 fully and tried to avoid using __unused unless the changes were going to be very invasive. -- John Baldwin