Date: Wed, 20 Jul 2022 15:19:23 -0700 From: John Baldwin <jhb@FreeBSD.org> To: Dimitry Andric <dim@FreeBSD.org>, src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 3dbe05f61b65 - main - Suppress unused variable warning in mfi.c Message-ID: <b7b3246b-4be1-8d26-6d0d-cc8222fe651d@FreeBSD.org> In-Reply-To: <202207201650.26KGool5002853@gitrepo.freebsd.org> References: <202207201650.26KGool5002853@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?b7b3246b-4be1-8d26-6d0d-cc8222fe651d>