Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/installboot fix various gcc-4.5 warnings
details: https://anonhg.NetBSD.org/src/rev/e6350a1986ed
branches: trunk
changeset: 768334:e6350a1986ed
user: christos <christos%NetBSD.org@localhost>
date: Sun Aug 14 17:50:16 2011 +0000
description:
fix various gcc-4.5 warnings
diffstat:
usr.sbin/installboot/Makefile | 7 +------
usr.sbin/installboot/arch/alpha.c | 7 +++----
usr.sbin/installboot/arch/i386.c | 29 +++++++++++++----------------
3 files changed, 17 insertions(+), 26 deletions(-)
diffs (160 lines):
diff -r 6ba1c2297e70 -r e6350a1986ed usr.sbin/installboot/Makefile
--- a/usr.sbin/installboot/Makefile Sun Aug 14 17:42:23 2011 +0000
+++ b/usr.sbin/installboot/Makefile Sun Aug 14 17:50:16 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.45 2011/06/22 02:49:45 mrg Exp $
+# $NetBSD: Makefile,v 1.46 2011/08/14 17:50:16 christos Exp $
#
.include <bsd.own.mk>
@@ -52,8 +52,3 @@
.endif
.include <bsd.prog.mk>
-
-# XXX
-.if ${HAVE_GCC} == 45
-COPTS.i386.c+= -Wno-error
-.endif
diff -r 6ba1c2297e70 -r e6350a1986ed usr.sbin/installboot/arch/alpha.c
--- a/usr.sbin/installboot/arch/alpha.c Sun Aug 14 17:42:23 2011 +0000
+++ b/usr.sbin/installboot/arch/alpha.c Sun Aug 14 17:50:16 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: alpha.c,v 1.20 2009/10/26 14:26:25 tsutsui Exp $ */
+/* $NetBSD: alpha.c,v 1.21 2011/08/14 17:50:17 christos Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -95,7 +95,7 @@
#include <sys/cdefs.h>
#if !defined(__lint)
-__RCSID("$NetBSD: alpha.c,v 1.20 2009/10/26 14:26:25 tsutsui Exp $");
+__RCSID("$NetBSD: alpha.c,v 1.21 2011/08/14 17:50:17 christos Exp $");
#endif /* !__lint */
#include <sys/param.h>
@@ -440,8 +440,7 @@
check_sparc(const struct alpha_boot_block * const bb, const char *when)
{
uint16_t bb16[256];
- const char * const wmsg =
- "%s sparc %s 0x%04x invalid, expected 0x%04x";
+#define wmsg "%s sparc %s 0x%04x invalid, expected 0x%04x"
memcpy(bb16, bb, sizeof(bb16));
if (compute_sunsum(bb16) != bb16[255])
diff -r 6ba1c2297e70 -r e6350a1986ed usr.sbin/installboot/arch/i386.c
--- a/usr.sbin/installboot/arch/i386.c Sun Aug 14 17:42:23 2011 +0000
+++ b/usr.sbin/installboot/arch/i386.c Sun Aug 14 17:50:16 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i386.c,v 1.36 2010/01/17 14:54:44 drochner Exp $ */
+/* $NetBSD: i386.c,v 1.37 2011/08/14 17:50:17 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#if !defined(__lint)
-__RCSID("$NetBSD: i386.c,v 1.36 2010/01/17 14:54:44 drochner Exp $");
+__RCSID("$NetBSD: i386.c,v 1.37 2011/08/14 17:50:17 christos Exp $");
#endif /* !__lint */
#include <sys/param.h>
@@ -56,8 +56,6 @@
#include "installboot.h"
-#define nelem(x) (sizeof (x)/sizeof *(x))
-
static const struct console_name {
const char *name; /* Name of console selection */
const int dev; /* value matching CONSDEV_* from sys/arch/i386/stand/lib/libi386.h */
@@ -124,10 +122,9 @@
}
static int
-write_boot_area(ib_params *params, void *v_buf, int len)
+write_boot_area(ib_params *params, uint8_t *buf, size_t len)
{
int rv, i;
- uint8_t *buf = v_buf;
/*
* Writing the 'label' sector (likely to be bytes 512-1023) could
@@ -149,7 +146,7 @@
return 1;
len -= 512 * 2;
rv = pwrite_validate(params->fsfd, buf + 512 * 2, len, 512 * 2);
- if (rv != len)
+ if (rv != (ssize_t)len)
goto bad_write;
return 1;
}
@@ -159,7 +156,7 @@
if (errno == EINVAL) {
/* Assume the failure was due to to the sector size > 512 */
rv = pwrite_validate(params->fsfd, buf, len, 0);
- if (rv == len)
+ if (rv == (ssize_t)len)
return 1;
if (rv != -1 || (errno != EROFS))
goto bad_write;
@@ -179,7 +176,7 @@
/* Reset write-protext */
i = 0;
ioctl(params->fsfd, DIOCWLABEL, &i);
- if (rv == len)
+ if (rv == (ssize_t)len)
return 1;
#endif
@@ -202,11 +199,11 @@
printf("flags %x, ", le32toh(bpp->bp_flags));
printf("speed %d, ", le32toh(bpp->bp_conspeed));
printf("ioaddr %x, ", le32toh(bpp->bp_consaddr));
- for (i = 0; i < nelem(consoles); i++) {
+ for (i = 0; i < __arraycount(consoles); i++) {
if (consoles[i].dev == (int)le32toh(bpp->bp_consdev))
break;
}
- if (i == nelem(consoles))
+ if (i == __arraycount(consoles))
printf("console %d\n", le32toh(bpp->bp_consdev));
else
printf("console %s\n", consoles[i].name);
@@ -245,11 +242,11 @@
if (params->flags & IB_CONSADDR)
bp.bp_consaddr = htole32(params->consaddr);
if (params->flags & IB_CONSOLE) {
- for (i = 0; i < nelem(consoles); i++)
+ for (i = 0; i < __arraycount(consoles); i++)
if (strcmp(consoles[i].name, params->console) == 0)
break;
- if (i == nelem(consoles)) {
+ if (i == __arraycount(consoles)) {
warnx("invalid console name, valid names are:");
(void)fprintf(stderr, "\t%s", consoles[0].name);
for (i = 1; consoles[i].name != NULL; i++)
@@ -471,7 +468,7 @@
(8192 - params->s1stat.st_size) & 511);
}
- return write_boot_area(params, &disk_buf, sizeof disk_buf);
+ return write_boot_area(params, disk_buf.b, sizeof disk_buf.b);
}
static int
@@ -543,8 +540,8 @@
warn("Writing `%s'", params->filesystem);
goto done;
} else if (rv != sizeof buf) {
- warnx("Writing `%s': short write, %ld bytes (should be %ld)",
- params->filesystem, (long)rv, (long)sizeof(buf));
+ warnx("Writing `%s': short write, %zd bytes (should be %zu)",
+ params->filesystem, rv, sizeof(buf));
goto done;
}
Home |
Main Index |
Thread Index |
Old Index