From 3161c603a67be4603bac3ad5d187e5a1cfd43323 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Wed, 14 Aug 2013 12:29:26 +0000 Subject: [PATCH] increase -Werror resilience for bin/, commands/, libexec/, sbin/, test/, usr.bin/ and usr.sbin/. Change-Id: I8fa12c3cd86865311cef71b7faa7cf4fa785174f --- bin/mkdir/Makefile | 1 + bin/pax/Makefile | 4 ++++ bin/pax/ar_io.c | 5 +++++ bin/pax/file_subs.c | 1 - commands/Makefile.inc | 5 +++++ libexec/ftpd/Makefile | 1 + sbin/fsck/Makefile | 1 + sbin/fsck/fsutil.c | 5 +++++ sbin/newfs_ext2fs/Makefile | 4 ++++ test/Makefile | 1 + test/test55.c | 2 +- usr.bin/chpass/Makefile | 4 ++++ usr.bin/login/Makefile | 4 ++++ usr.bin/ministat/Makefile | 3 +++ usr.bin/newgrp/Makefile | 5 +++++ usr.bin/nvi/Makefile.inc | 5 +++++ usr.bin/passwd/Makefile | 4 ++++ usr.bin/sort/fields.c | 2 +- usr.bin/top/top.c | 2 +- usr.bin/toproto/toproto.c | 8 ++++---- usr.sbin/Makefile.inc | 4 ++++ 21 files changed, 63 insertions(+), 8 deletions(-) diff --git a/bin/mkdir/Makefile b/bin/mkdir/Makefile index c3aca13a9..e8b7f39eb 100644 --- a/bin/mkdir/Makefile +++ b/bin/mkdir/Makefile @@ -3,6 +3,7 @@ PROG= mkdir .ifdef __MINIX +WARNS=3 SYMLINKS= $(BINDIR)/$(PROG) /usr/bin/$(PROG) .endif diff --git a/bin/pax/Makefile b/bin/pax/Makefile index 0e6e13e13..5758ee9cb 100644 --- a/bin/pax/Makefile +++ b/bin/pax/Makefile @@ -3,6 +3,10 @@ .include +.if defined(__MINIX) +WARNS=3 +.endif + PROG= pax SRCS= ar_io.c ar_subs.c buf_subs.c file_subs.c ftree.c\ gen_subs.c getoldopt.c options.c pat_rep.c pax.c sel_subs.c tables.c\ diff --git a/bin/pax/ar_io.c b/bin/pax/ar_io.c index 164740a26..d3d69a45f 100644 --- a/bin/pax/ar_io.c +++ b/bin/pax/ar_io.c @@ -456,8 +456,13 @@ ar_close(void) /* mimic cpio's block count first */ if (frmt && strcmp(NM_CPIO, argv0) == 0) { +#ifdef __minix + (void)fprintf(listf, "%d blocks\n", + (rdcnt ? rdcnt : wrcnt) / 5120); +#else (void)fprintf(listf, OFFT_F " blocks\n", (rdcnt ? rdcnt : wrcnt) / 5120); +#endif } ar_summary(0); diff --git a/bin/pax/file_subs.c b/bin/pax/file_subs.c index f4e598dfd..4b16abf7d 100644 --- a/bin/pax/file_subs.c +++ b/bin/pax/file_subs.c @@ -170,7 +170,6 @@ file_creat(ARCHD *arcn, int write_to_hardlink) * conservatively - just write Xes into the last component. * There is space because of the malloc(). */ - int cc; char *last_slash; strcpy(arcn->tmp_name, arcn->name); if(!(last_slash = strrchr(arcn->tmp_name, '/'))) diff --git a/commands/Makefile.inc b/commands/Makefile.inc index 26905505e..70e446b60 100644 --- a/commands/Makefile.inc +++ b/commands/Makefile.inc @@ -1,2 +1,7 @@ LDADD+= -lminlib -lcompat_minix -lasyn -lterminfo BINDIR?=/usr/bin + +# BJG too many warnings here +NOGCCERROR?= yes +NOCLANGERROR?= yes + diff --git a/libexec/ftpd/Makefile b/libexec/ftpd/Makefile index 615c9bd7f..1ca6f3455 100644 --- a/libexec/ftpd/Makefile +++ b/libexec/ftpd/Makefile @@ -6,6 +6,7 @@ PROG= ftpd SRCS= cmds.c conf.c ftpd.c ftpcmd.y logutmp.c logwtmp.c popen.c .ifdef __MINIX +WARNS= # BJG too many warnings with clang right now CPPFLAGS+=-I${.CURDIR} .else CPPFLAGS+=-I${.CURDIR} -DSUPPORT_UTMP -DSUPPORT_UTMPX -DLOGIN_CAP diff --git a/sbin/fsck/Makefile b/sbin/fsck/Makefile index 3f65baf34..fb445ce16 100644 --- a/sbin/fsck/Makefile +++ b/sbin/fsck/Makefile @@ -12,5 +12,6 @@ DPADD+=${LIBPROP} # LSC Does not compile without any warnings... NOGCCERROR:=yes +NOCLANGERROR:=yes .include diff --git a/sbin/fsck/fsutil.c b/sbin/fsck/fsutil.c index b249a3ea8..1aa31c6cc 100644 --- a/sbin/fsck/fsutil.c +++ b/sbin/fsck/fsutil.c @@ -265,8 +265,13 @@ print_mtime(time_t t) } +#ifdef __minix +__dead void +catch(int n) +#else void catch(int n) +#endif { if (ckfinish) (*ckfinish)(0); _exit(FSCK_EXIT_SIGNALLED); diff --git a/sbin/newfs_ext2fs/Makefile b/sbin/newfs_ext2fs/Makefile index 374e76f5b..a09444544 100644 --- a/sbin/newfs_ext2fs/Makefile +++ b/sbin/newfs_ext2fs/Makefile @@ -1,6 +1,10 @@ # $NetBSD: Makefile,v 1.4 2012/03/24 08:22:24 joerg Exp $ # @(#)Makefile 8.2 (Berkeley) 3/27/94 +.if defined(__MINIX) +WARNS=3 +.endif + WARNS?= 4 CWARNFLAGS+= -Wno-sign-compare diff --git a/test/Makefile b/test/Makefile index 17c741644..dc927a5db 100644 --- a/test/Makefile +++ b/test/Makefile @@ -19,6 +19,7 @@ COPTS.test51.c= -mhard-float COPTS.test52.c= -mhard-float .endif +WARNS= COPTS.test9.c= -O0 COPTS.test37.c= -O0 COPTS.test53.c= -O0 diff --git a/test/test55.c b/test/test55.c index 700ee1a14..f6974da8d 100644 --- a/test/test55.c +++ b/test/test55.c @@ -15,7 +15,7 @@ int max_error = 3; int subtest; char *filename = "statvfs_test_XXXXXX"; -void create_file(void) +static void create_file(void) { char buf[SIZE]={0}; char *p; diff --git a/usr.bin/chpass/Makefile b/usr.bin/chpass/Makefile index fb7462fed..b23a2d149 100644 --- a/usr.bin/chpass/Makefile +++ b/usr.bin/chpass/Makefile @@ -3,6 +3,10 @@ .include +.if defined(__MINIX) +WARNS=3 +.endif + USE_FORT?= yes # setuid PROG= chpass SRCS= chpass.c edit.c field.c table.c util.c diff --git a/usr.bin/login/Makefile b/usr.bin/login/Makefile index eb36b441a..8e78aef5f 100644 --- a/usr.bin/login/Makefile +++ b/usr.bin/login/Makefile @@ -1,6 +1,10 @@ # $NetBSD: Makefile,v 1.55 2012/04/24 16:52:26 christos Exp $ # @(#)Makefile 8.1 (Berkeley) 7/19/93 +.if defined(__MINIX) +WARNS=2 +.endif + WARNS?= 5 .include diff --git a/usr.bin/ministat/Makefile b/usr.bin/ministat/Makefile index e4c2f0718..ab160ad1e 100644 --- a/usr.bin/ministat/Makefile +++ b/usr.bin/ministat/Makefile @@ -3,6 +3,9 @@ PROG= ministat DPADD= ${LIBM} LDADD= -lm +# BJG +WARNS=3 + .include test: ${PROG} diff --git a/usr.bin/newgrp/Makefile b/usr.bin/newgrp/Makefile index d04ebc1c5..ac100ffd6 100644 --- a/usr.bin/newgrp/Makefile +++ b/usr.bin/newgrp/Makefile @@ -8,6 +8,11 @@ SRCS= newgrp.c grutil.c BINOWN= root BINMODE=4555 +.if defined(__MINIX) +# Too many warnings for our clang otherwise +WARNS=3 +.endif + CPPFLAGS+=-DGRUTIL_ACCEPT_GROUP_NUMBERS CPPFLAGS+=-DGRUTIL_ALLOW_GROUP_ERRORS # for POSIX.1 compliance .if !defined(__MINIX) diff --git a/usr.bin/nvi/Makefile.inc b/usr.bin/nvi/Makefile.inc index 317363178..1ad6aa3b1 100644 --- a/usr.bin/nvi/Makefile.inc +++ b/usr.bin/nvi/Makefile.inc @@ -2,5 +2,10 @@ .include +.if defined(__MINIX) +NOCLANGERROR=yes +NOGCCERROR=yes +.endif + DIST= ${NETBSDSRCDIR}/dist/nvi .PATH: ${DIST} diff --git a/usr.bin/passwd/Makefile b/usr.bin/passwd/Makefile index cffd0975e..eeb93a138 100644 --- a/usr.bin/passwd/Makefile +++ b/usr.bin/passwd/Makefile @@ -3,6 +3,10 @@ .include +.if defined(__MINIX) +WARNS=3 +.endif + USE_FORT?= yes # setuid PROG= passwd SRCS= local_passwd.c passwd.c diff --git a/usr.bin/sort/fields.c b/usr.bin/sort/fields.c index 94cb23ca5..d3071dffa 100644 --- a/usr.bin/sort/fields.c +++ b/usr.bin/sort/fields.c @@ -393,7 +393,7 @@ numhex(u_char *pos, const u_char *bufend, u_char *line, u_char *lineend, int64_t n = 0; int l; SKIP_BLANKS(line); - sscanf((const char *) pos, "%lx", &n); + sscanf((const char *) pos, "%llx", &n); l = snprintf((char *)buf, sizeof(buf), "%lld", n); return number(pos, bufend, buf, buf + l, flag); } diff --git a/usr.bin/top/top.c b/usr.bin/top/top.c index f0db4406d..5ff979268 100644 --- a/usr.bin/top/top.c +++ b/usr.bin/top/top.c @@ -47,7 +47,7 @@ u32_t system_hz; /* name of cpu cycle types, in the order they appear in /psinfo. */ const char *cputimenames[] = { "user", "ipc", "kernelcall" }; -#define CPUTIMENAMES (sizeof(cputimenames)/sizeof(cputimenames[0])) +#define CPUTIMENAMES ((int) (sizeof(cputimenames)/sizeof(cputimenames[0]))) #define CPUTIME(m, i) (m & (1L << (i))) diff --git a/usr.bin/toproto/toproto.c b/usr.bin/toproto/toproto.c index 1747e284a..df7aa305d 100644 --- a/usr.bin/toproto/toproto.c +++ b/usr.bin/toproto/toproto.c @@ -276,7 +276,7 @@ create_entries(int handle) return 0; } -char * parse_mode(int mode){ +static char * parse_mode(int mode){ /* Convert a 4 digit octal number int a proto entry as described in the mkfs.mfs man page e.g. [suid-char][guid-char]0777 mode */ @@ -290,7 +290,7 @@ char * parse_mode(int mode){ } static int -dump_entry(FILE * out, int index, char *base_dir) +dump_entry(FILE * out, int index, const char *base_dir) { int space; @@ -346,7 +346,7 @@ dump_entry(FILE * out, int index, char *base_dir) } static int -dump_proto(FILE * out, char *base_dir) +dump_proto(FILE * out, const char *base_dir) { int i; fprintf(out, "boot\n0 0"); @@ -377,7 +377,7 @@ main(int argc, char **argv) { int ch, fh_in; FILE *out; - char *base_path; + const char *base_path; char *input_file, *output_file; input_file = NULL; diff --git a/usr.sbin/Makefile.inc b/usr.sbin/Makefile.inc index ddb25e755..7314482de 100644 --- a/usr.sbin/Makefile.inc +++ b/usr.sbin/Makefile.inc @@ -3,3 +3,7 @@ BINDIR?= /usr/sbin WARNS?= 4 + +# BJG too many warnings here +NOGCCERROR?= yes +NOCLANGERROR?= yes -- 2.44.0