git: cc1a53bc1aea - main - makefs: Fix warnings and reset WARNS to the default

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 10 May 2022 21:41:50 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=cc1a53bc1aea0675d64e9547cdca241612906592

commit cc1a53bc1aea0675d64e9547cdca241612906592
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-04-29 13:18:02 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-05-10 21:38:23 +0000

    makefs: Fix warnings and reset WARNS to the default
    
    Leave -Wcast-align disabled, at least for now, since there are numerous
    instances of that warning in places where buffer pointers are cast to
    pointers to various filesystem structures.  Fixing this properly would
    be too much work for too little gain.
    
    MFC after:      2 weeks
    Sponsored by:   The FreeBSD Foundation
---
 usr.sbin/makefs/Makefile               |  2 +-
 usr.sbin/makefs/ffs.c                  |  2 +-
 usr.sbin/makefs/msdos/msdosfs_denode.c | 10 ++++------
 usr.sbin/makefs/msdos/msdosfs_vnops.c  |  3 ++-
 4 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/usr.sbin/makefs/Makefile b/usr.sbin/makefs/Makefile
index cbe4f497d7d1..3fea648f9383 100644
--- a/usr.sbin/makefs/Makefile
+++ b/usr.sbin/makefs/Makefile
@@ -16,7 +16,7 @@ SRCS=	cd9660.c \
 	walk.c
 MAN=	makefs.8
 
-WARNS?=	2
+NO_WCAST_ALIGN=
 CSTD=	c11
 
 .include "${SRCDIR}/cd9660/Makefile.inc"
diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c
index 9cfbcbc30d75..1e68b0931f16 100644
--- a/usr.sbin/makefs/ffs.c
+++ b/usr.sbin/makefs/ffs.c
@@ -578,7 +578,7 @@ ffs_create_image(const char *image, fsinfo_t *fsopts)
 		    (long long)fs->fs_cstotal.cs_ndir);
 	}
 
-	if (fs->fs_cstotal.cs_nifree + UFS_ROOTINO < fsopts->inodes) {
+	if (fs->fs_cstotal.cs_nifree + (off_t)UFS_ROOTINO < fsopts->inodes) {
 		warnx(
 		"Image file `%s' has %lld free inodes; %lld are required.",
 		    image,
diff --git a/usr.sbin/makefs/msdos/msdosfs_denode.c b/usr.sbin/makefs/msdos/msdosfs_denode.c
index 3fbd867275d2..ff706ad99563 100644
--- a/usr.sbin/makefs/msdos/msdosfs_denode.c
+++ b/usr.sbin/makefs/msdos/msdosfs_denode.c
@@ -210,7 +210,6 @@ int
 detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred)
 {
 	int error;
-	int allerror;
 	u_long eofentry;
 	u_long chaintofree;
 	daddr_t bn;
@@ -253,7 +252,7 @@ detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred)
 	if (length == 0) {
 		chaintofree = dep->de_StartCluster;
 		dep->de_StartCluster = 0;
-		eofentry = ~0;
+		eofentry = ~0ul;
 	} else {
 		error = pcbmap(dep, de_clcount(pmp, length) - 1, 0,
 		    &eofentry, 0);
@@ -295,14 +294,13 @@ detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred)
 	dep->de_FileSize = length;
 	if (!isadir)
 		dep->de_flag |= DE_UPDATE|DE_MODIFIED;
-	MSDOSFS_DPRINTF(("detrunc(): allerror %d, eofentry %lu\n",
-	    allerror, eofentry));
+	MSDOSFS_DPRINTF(("detrunc(): eofentry %lu\n", eofentry));
 
 	/*
 	 * If we need to break the cluster chain for the file then do it
 	 * now.
 	 */
-	if (eofentry != ~0) {
+	if (eofentry != ~0ul) {
 		error = fatentry(FAT_GET_AND_SET, pmp, eofentry,
 				 &chaintofree, CLUST_EOFE);
 		if (error) {
@@ -321,7 +319,7 @@ detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred)
 	if (chaintofree != 0 && !MSDOSFSEOF(pmp, chaintofree))
 		freeclusterchain(pmp, chaintofree);
 
-	return (allerror);
+	return (0);
 }
 
 /*
diff --git a/usr.sbin/makefs/msdos/msdosfs_vnops.c b/usr.sbin/makefs/msdos/msdosfs_vnops.c
index ed33856716f1..5bc9b495c586 100644
--- a/usr.sbin/makefs/msdos/msdosfs_vnops.c
+++ b/usr.sbin/makefs/msdos/msdosfs_vnops.c
@@ -537,7 +537,8 @@ static const struct {
 };
 
 struct denode *
-msdosfs_mkdire(const char *path, struct denode *pdep, fsnode *node) {
+msdosfs_mkdire(const char *path __unused, struct denode *pdep, fsnode *node)
+{
 	struct denode ndirent;
 	struct denode *dep;
 	struct componentname cn;