git: c9dde6f0c713 - main - Fix unused variable warning in ffs_snapshot.c
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 26 Jul 2022 20:09:58 UTC
The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=c9dde6f0c713a027266c52cf94a33a086348c566 commit c9dde6f0c713a027266c52cf94a33a086348c566 Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2022-07-26 19:30:41 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2022-07-26 19:32:51 +0000 Fix unused variable warning in ffs_snapshot.c With clang 15, the following -Werror warning is produced: sys/ufs/ffs/ffs_snapshot.c:204:7: error: variable 'redo' set but not used [-Werror,-Wunused-but-set-variable] long redo = 0, snaplistsize = 0; ^ The 'redo' variable is only used when DIAGNOSTIC is defined. Ensure it is only declared and set in that case. MFC after: 3 days --- sys/ufs/ffs/ffs_snapshot.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index a23c4ab02bf6..84983a111fe4 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -201,7 +201,10 @@ ffs_snapshot(struct mount *mp, char *snapfile) ufs2_daddr_t blockno; uint64_t flag; char saved_nice = 0; - long redo = 0, snaplistsize = 0; +#ifdef DIAGNOSTIC + long redo = 0; +#endif + long snaplistsize = 0; int32_t *lp; void *space; struct fs *copy_fs = NULL, *fs; @@ -457,7 +460,9 @@ restart: for (cg = 0; cg < fs->fs_ncg; cg++) { if ((ACTIVECGNUM(fs, cg) & ACTIVECGOFF(cg)) != 0) continue; +#ifdef DIAGNOSTIC redo++; +#endif error = UFS_BALLOC(vp, lfragtosize(fs, cgtod(fs, cg)), fs->fs_bsize, KERNCRED, 0, &nbp); if (error)