increase -Werror resilience

for bin/, commands/, libexec/, sbin/, test/, usr.bin/ and usr.sbin/.

Change-Id: I8fa12c3cd86865311cef71b7faa7cf4fa785174f
This commit is contained in:
Ben Gras 2013-08-14 12:29:26 +00:00 committed by Gerrit Code Review
parent 5c584cedf8
commit 3161c603a6
21 changed files with 63 additions and 8 deletions

View file

@ -3,6 +3,7 @@
PROG= mkdir PROG= mkdir
.ifdef __MINIX .ifdef __MINIX
WARNS=3
SYMLINKS= $(BINDIR)/$(PROG) /usr/bin/$(PROG) SYMLINKS= $(BINDIR)/$(PROG) /usr/bin/$(PROG)
.endif .endif

View file

@ -3,6 +3,10 @@
.include <bsd.own.mk> .include <bsd.own.mk>
.if defined(__MINIX)
WARNS=3
.endif
PROG= pax PROG= pax
SRCS= ar_io.c ar_subs.c buf_subs.c file_subs.c ftree.c\ 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\ gen_subs.c getoldopt.c options.c pat_rep.c pax.c sel_subs.c tables.c\

View file

@ -456,8 +456,13 @@ ar_close(void)
/* mimic cpio's block count first */ /* mimic cpio's block count first */
if (frmt && strcmp(NM_CPIO, argv0) == 0) { 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", (void)fprintf(listf, OFFT_F " blocks\n",
(rdcnt ? rdcnt : wrcnt) / 5120); (rdcnt ? rdcnt : wrcnt) / 5120);
#endif
} }
ar_summary(0); ar_summary(0);

View file

@ -170,7 +170,6 @@ file_creat(ARCHD *arcn, int write_to_hardlink)
* conservatively - just write Xes into the last component. * conservatively - just write Xes into the last component.
* There is space because of the malloc(). * There is space because of the malloc().
*/ */
int cc;
char *last_slash; char *last_slash;
strcpy(arcn->tmp_name, arcn->name); strcpy(arcn->tmp_name, arcn->name);
if(!(last_slash = strrchr(arcn->tmp_name, '/'))) if(!(last_slash = strrchr(arcn->tmp_name, '/')))

View file

@ -1,2 +1,7 @@
LDADD+= -lminlib -lcompat_minix -lasyn -lterminfo LDADD+= -lminlib -lcompat_minix -lasyn -lterminfo
BINDIR?=/usr/bin BINDIR?=/usr/bin
# BJG too many warnings here
NOGCCERROR?= yes
NOCLANGERROR?= yes

View file

@ -6,6 +6,7 @@
PROG= ftpd PROG= ftpd
SRCS= cmds.c conf.c ftpd.c ftpcmd.y logutmp.c logwtmp.c popen.c SRCS= cmds.c conf.c ftpd.c ftpcmd.y logutmp.c logwtmp.c popen.c
.ifdef __MINIX .ifdef __MINIX
WARNS= # BJG too many warnings with clang right now
CPPFLAGS+=-I${.CURDIR} CPPFLAGS+=-I${.CURDIR}
.else .else
CPPFLAGS+=-I${.CURDIR} -DSUPPORT_UTMP -DSUPPORT_UTMPX -DLOGIN_CAP CPPFLAGS+=-I${.CURDIR} -DSUPPORT_UTMP -DSUPPORT_UTMPX -DLOGIN_CAP

View file

@ -12,5 +12,6 @@ DPADD+=${LIBPROP}
# LSC Does not compile without any warnings... # LSC Does not compile without any warnings...
NOGCCERROR:=yes NOGCCERROR:=yes
NOCLANGERROR:=yes
.include <bsd.prog.mk> .include <bsd.prog.mk>

View file

@ -265,8 +265,13 @@ print_mtime(time_t t)
} }
#ifdef __minix
__dead void
catch(int n)
#else
void void
catch(int n) catch(int n)
#endif
{ {
if (ckfinish) (*ckfinish)(0); if (ckfinish) (*ckfinish)(0);
_exit(FSCK_EXIT_SIGNALLED); _exit(FSCK_EXIT_SIGNALLED);

View file

@ -1,6 +1,10 @@
# $NetBSD: Makefile,v 1.4 2012/03/24 08:22:24 joerg Exp $ # $NetBSD: Makefile,v 1.4 2012/03/24 08:22:24 joerg Exp $
# @(#)Makefile 8.2 (Berkeley) 3/27/94 # @(#)Makefile 8.2 (Berkeley) 3/27/94
.if defined(__MINIX)
WARNS=3
.endif
WARNS?= 4 WARNS?= 4
CWARNFLAGS+= -Wno-sign-compare CWARNFLAGS+= -Wno-sign-compare

View file

@ -19,6 +19,7 @@ COPTS.test51.c= -mhard-float
COPTS.test52.c= -mhard-float COPTS.test52.c= -mhard-float
.endif .endif
WARNS=
COPTS.test9.c= -O0 COPTS.test9.c= -O0
COPTS.test37.c= -O0 COPTS.test37.c= -O0
COPTS.test53.c= -O0 COPTS.test53.c= -O0

View file

@ -15,7 +15,7 @@ int max_error = 3;
int subtest; int subtest;
char *filename = "statvfs_test_XXXXXX"; char *filename = "statvfs_test_XXXXXX";
void create_file(void) static void create_file(void)
{ {
char buf[SIZE]={0}; char buf[SIZE]={0};
char *p; char *p;

View file

@ -3,6 +3,10 @@
.include <bsd.own.mk> .include <bsd.own.mk>
.if defined(__MINIX)
WARNS=3
.endif
USE_FORT?= yes # setuid USE_FORT?= yes # setuid
PROG= chpass PROG= chpass
SRCS= chpass.c edit.c field.c table.c util.c SRCS= chpass.c edit.c field.c table.c util.c

View file

@ -1,6 +1,10 @@
# $NetBSD: Makefile,v 1.55 2012/04/24 16:52:26 christos Exp $ # $NetBSD: Makefile,v 1.55 2012/04/24 16:52:26 christos Exp $
# @(#)Makefile 8.1 (Berkeley) 7/19/93 # @(#)Makefile 8.1 (Berkeley) 7/19/93
.if defined(__MINIX)
WARNS=2
.endif
WARNS?= 5 WARNS?= 5
.include <bsd.own.mk> .include <bsd.own.mk>

View file

@ -3,6 +3,9 @@ PROG= ministat
DPADD= ${LIBM} DPADD= ${LIBM}
LDADD= -lm LDADD= -lm
# BJG
WARNS=3
.include <bsd.prog.mk> .include <bsd.prog.mk>
test: ${PROG} test: ${PROG}

View file

@ -8,6 +8,11 @@ SRCS= newgrp.c grutil.c
BINOWN= root BINOWN= root
BINMODE=4555 BINMODE=4555
.if defined(__MINIX)
# Too many warnings for our clang otherwise
WARNS=3
.endif
CPPFLAGS+=-DGRUTIL_ACCEPT_GROUP_NUMBERS CPPFLAGS+=-DGRUTIL_ACCEPT_GROUP_NUMBERS
CPPFLAGS+=-DGRUTIL_ALLOW_GROUP_ERRORS # for POSIX.1 compliance CPPFLAGS+=-DGRUTIL_ALLOW_GROUP_ERRORS # for POSIX.1 compliance
.if !defined(__MINIX) .if !defined(__MINIX)

View file

@ -2,5 +2,10 @@
.include <bsd.own.mk> .include <bsd.own.mk>
.if defined(__MINIX)
NOCLANGERROR=yes
NOGCCERROR=yes
.endif
DIST= ${NETBSDSRCDIR}/dist/nvi DIST= ${NETBSDSRCDIR}/dist/nvi
.PATH: ${DIST} .PATH: ${DIST}

View file

@ -3,6 +3,10 @@
.include <bsd.own.mk> .include <bsd.own.mk>
.if defined(__MINIX)
WARNS=3
.endif
USE_FORT?= yes # setuid USE_FORT?= yes # setuid
PROG= passwd PROG= passwd
SRCS= local_passwd.c passwd.c SRCS= local_passwd.c passwd.c

View file

@ -393,7 +393,7 @@ numhex(u_char *pos, const u_char *bufend, u_char *line, u_char *lineend,
int64_t n = 0; int64_t n = 0;
int l; int l;
SKIP_BLANKS(line); SKIP_BLANKS(line);
sscanf((const char *) pos, "%lx", &n); sscanf((const char *) pos, "%llx", &n);
l = snprintf((char *)buf, sizeof(buf), "%lld", n); l = snprintf((char *)buf, sizeof(buf), "%lld", n);
return number(pos, bufend, buf, buf + l, flag); return number(pos, bufend, buf, buf + l, flag);
} }

View file

@ -47,7 +47,7 @@ u32_t system_hz;
/* name of cpu cycle types, in the order they appear in /psinfo. */ /* name of cpu cycle types, in the order they appear in /psinfo. */
const char *cputimenames[] = { "user", "ipc", "kernelcall" }; 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))) #define CPUTIME(m, i) (m & (1L << (i)))

View file

@ -276,7 +276,7 @@ create_entries(int handle)
return 0; 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 /* 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 */ the mkfs.mfs man page e.g. [suid-char][guid-char]0777 mode */
@ -290,7 +290,7 @@ char * parse_mode(int mode){
} }
static int static int
dump_entry(FILE * out, int index, char *base_dir) dump_entry(FILE * out, int index, const char *base_dir)
{ {
int space; int space;
@ -346,7 +346,7 @@ dump_entry(FILE * out, int index, char *base_dir)
} }
static int static int
dump_proto(FILE * out, char *base_dir) dump_proto(FILE * out, const char *base_dir)
{ {
int i; int i;
fprintf(out, "boot\n0 0"); fprintf(out, "boot\n0 0");
@ -377,7 +377,7 @@ main(int argc, char **argv)
{ {
int ch, fh_in; int ch, fh_in;
FILE *out; FILE *out;
char *base_path; const char *base_path;
char *input_file, *output_file; char *input_file, *output_file;
input_file = NULL; input_file = NULL;

View file

@ -3,3 +3,7 @@
BINDIR?= /usr/sbin BINDIR?= /usr/sbin
WARNS?= 4 WARNS?= 4
# BJG too many warnings here
NOGCCERROR?= yes
NOCLANGERROR?= yes