Module Name:    src
Committed By:   he
Date:           Thu Mar 22 13:42:36 UTC 2012

Modified Files:
        src/lib/libc/gen: nlist_coff.c

Log Message:
Make this lint-free (only built for real for the __sh__ ports):
 * Mark some code after goto as /* NOTREACHED */
 * Add a cast for file size (off_t) to size_t to avoid warning about
   possibly losing bits.
 * Avoid a "pointer casts may be troublesome" warning from lint
   by doing a cast via "void *" instead of directly to "struct
   coff_filehdr *".


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/gen/nlist_coff.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/nlist_coff.c
diff -u src/lib/libc/gen/nlist_coff.c:1.9 src/lib/libc/gen/nlist_coff.c:1.10
--- src/lib/libc/gen/nlist_coff.c:1.9	Wed Mar 21 15:32:26 2012
+++ src/lib/libc/gen/nlist_coff.c	Thu Mar 22 13:42:36 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: nlist_coff.c,v 1.9 2012/03/21 15:32:26 christos Exp $ */
+/* $NetBSD: nlist_coff.c,v 1.10 2012/03/22 13:42:36 he Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: nlist_coff.c,v 1.9 2012/03/21 15:32:26 christos Exp $");
+__RCSID("$NetBSD: nlist_coff.c,v 1.10 2012/03/22 13:42:36 he Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -58,8 +58,10 @@ __RCSID("$NetBSD: nlist_coff.c,v 1.9 201
 #endif
 
 #ifdef NLIST_COFF
-#define	BAD		do { rv = -1; goto out; } while (/*CONSTCOND*/0)
-#define	BADUNMAP	do { rv = -1; goto unmap; } while (/*CONSTCOND*/0)
+#define	BAD		do { rv = -1; goto out; } \
+			/* NOTREACHED */ while (/*CONSTCOND*/0)
+#define	BADUNMAP	do { rv = -1; goto unmap; } \
+			/* NOTREACHED */ while (/*CONSTCOND*/0)
 
 #define ES_LEN 18
 struct coff_extsym {
@@ -110,7 +112,7 @@ __fdnlist_coff(int fd, struct nlist *lis
 		errno = EFBIG;
 		BAD;
 	}
-	mappedsize = st.st_size;
+	mappedsize = (size_t)st.st_size;
 	mappedfile = mmap(NULL, mappedsize, PROT_READ, MAP_PRIVATE|MAP_FILE,
 	    fd, 0);
 	if (mappedfile == (char *)-1)
@@ -123,7 +125,7 @@ __fdnlist_coff(int fd, struct nlist *lis
 	 */
 	if (mappedsize < sizeof (struct coff_filehdr))
 		BADUNMAP;
-	filehdrp = (struct coff_filehdr *)&mappedfile[0];
+	filehdrp = (void *)&mappedfile[0];
 
 	if (COFF_BADMAG(filehdrp))
 		BADUNMAP;

Reply via email to