From: Ben Gras Date: Tue, 6 Jul 2010 12:08:22 +0000 (+0000) Subject: lib: fixes for warnings that clang has for libraries. X-Git-Tag: v3.1.8~276 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/dnssec-keyfromlabel.html?a=commitdiff_plain;h=68db8ed0b9600e11489ca631e7ea24a6f5adb15f;p=minix.git lib: fixes for warnings that clang has for libraries. --- diff --git a/lib/libc/ansi/misc.c b/lib/libc/ansi/misc.c index 2ea0b88a6..3a7139c75 100644 --- a/lib/libc/ansi/misc.c +++ b/lib/libc/ansi/misc.c @@ -181,7 +181,7 @@ parseRule(register char *buf, register const char *p) if (*p == '/') { q = ++p; if (!(p = parseTime(&time, p, &dstend))) return NULL; - while(*buf++ = *q++); + while((*buf++ = *q++)); } if (*p) return NULL; return p; diff --git a/lib/libc/ansi/signal.c b/lib/libc/ansi/signal.c index ff476e0b9..f00d38dd6 100644 --- a/lib/libc/ansi/signal.c +++ b/lib/libc/ansi/signal.c @@ -15,7 +15,7 @@ sighandler_t disp; /* signal handler, or SIG_DFL, or SIG_IGN */ errno = EINVAL; return(SIG_ERR); } - sigemptyset(&sa.sa_mask); + (void) sigemptyset(&sa.sa_mask); #ifdef WANT_UNRELIABLE_SIGNALS /* Allow the signal being handled to interrupt the signal handler. */ diff --git a/lib/libc/ip/getnetbyaddr.c b/lib/libc/ip/getnetbyaddr.c index 3ddb1009a..f77bdb661 100644 --- a/lib/libc/ip/getnetbyaddr.c +++ b/lib/libc/ip/getnetbyaddr.c @@ -47,7 +47,7 @@ getnetbyaddr(net, type) register struct netent *p; setnetent(_net_stayopen); - while (p = getnetent()) + while ((p = getnetent())) if (p->n_addrtype == type && p->n_net == net) break; if (!_net_stayopen) diff --git a/lib/libc/ip/getnetbyname.c b/lib/libc/ip/getnetbyname.c index c8e92c654..09924a2c7 100644 --- a/lib/libc/ip/getnetbyname.c +++ b/lib/libc/ip/getnetbyname.c @@ -48,7 +48,7 @@ getnetbyname(name) register char **cp; setnetent(_net_stayopen); - while (p = getnetent()) { + while ((p = getnetent())) { if (strcmp(p->n_name, name) == 0) break; for (cp = p->n_aliases; *cp != 0; cp++) diff --git a/lib/libc/ip/getproto.c b/lib/libc/ip/getproto.c index 34bf8ae06..9d84b13dc 100644 --- a/lib/libc/ip/getproto.c +++ b/lib/libc/ip/getproto.c @@ -37,7 +37,7 @@ getprotobynumber(proto) register struct protoent *p; setprotoent(_proto_stayopen); - while (p = getprotoent()) + while ((p = getprotoent())) if (p->p_proto == proto) break; if (!_proto_stayopen) diff --git a/lib/libc/ip/getprotoent.c b/lib/libc/ip/getprotoent.c index 8c5671688..33b466e80 100644 --- a/lib/libc/ip/getprotoent.c +++ b/lib/libc/ip/getprotoent.c @@ -114,7 +114,7 @@ any(cp, match) { register char *mp, c; - while (c = *cp) { + while ((c = *cp)) { for (mp = match; *mp; mp++) if (*mp == c) return (cp); diff --git a/lib/libc/ip/getservent.c b/lib/libc/ip/getservent.c index 9e89c3823..a8c3337a7 100644 --- a/lib/libc/ip/getservent.c +++ b/lib/libc/ip/getservent.c @@ -115,7 +115,7 @@ any(cp, match) { register char *mp, c; - while (c = *cp) { + while ((c = *cp)) { for (mp = match; *mp; mp++) if (*mp == c) return (cp); diff --git a/lib/libc/ip/getsrvbyname.c b/lib/libc/ip/getsrvbyname.c index 1af2e3457..242f1aa33 100644 --- a/lib/libc/ip/getsrvbyname.c +++ b/lib/libc/ip/getsrvbyname.c @@ -35,7 +35,7 @@ getservbyname(name, proto) register char **cp; setservent(_serv_stayopen); - while (p = getservent()) { + while ((p = getservent())) { if (strcmp(name, p->s_name) == 0) goto gotname; for (cp = p->s_aliases; *cp; cp++) diff --git a/lib/libc/ip/getsrvbyport.c b/lib/libc/ip/getsrvbyport.c index 066b3592d..3606873c5 100644 --- a/lib/libc/ip/getsrvbyport.c +++ b/lib/libc/ip/getsrvbyport.c @@ -38,7 +38,7 @@ getservbyport(port, proto) register struct servent *p; setservent(_serv_stayopen); - while (p = getservent()) { + while ((p = getservent())) { if (p->s_port != port) continue; if (proto == 0 || strcmp(p->s_proto, proto) == 0) diff --git a/lib/libc/ip/inet_network.c b/lib/libc/ip/inet_network.c index 92513e342..15da00106 100644 --- a/lib/libc/ip/inet_network.c +++ b/lib/libc/ip/inet_network.c @@ -62,7 +62,7 @@ again: base = 8, cp++; if (*cp == 'x' || *cp == 'X') base = 16, cp++; - while (c = *cp) { + while ((c = *cp)) { if (isdigit(c)) { val = (val * base) + (c - '0'); cp++; diff --git a/lib/libc/ip/res_comp.c b/lib/libc/ip/res_comp.c index 66b772b7d..44c0129f7 100644 --- a/lib/libc/ip/res_comp.c +++ b/lib/libc/ip/res_comp.c @@ -58,6 +58,7 @@ static int dn_find(); * 'exp_dn' is a pointer to a buffer of size 'length' for the result. * Return size of compressed name or -1 if there was an error. */ +int dn_expand(msg, eomorig, comp_dn, exp_dn, length) CONST u_char *msg, *eomorig, *comp_dn; u_char *exp_dn; @@ -75,7 +76,7 @@ dn_expand(msg, eomorig, comp_dn, exp_dn, length) /* * fetch next label in domain name */ - while (n = *cp++) { + while ((n = *cp++)) { /* * Check for indirection */ @@ -220,6 +221,7 @@ dn_comp(exp_dn, comp_dn, length, dnptrs, lastdnptr) /* * Skip over a compressed domain name. Return the size or -1. */ +int dn_skipname(comp_dn, eom) CONST u_char *comp_dn, *eom; { @@ -264,7 +266,7 @@ dn_find(exp_dn, msg, dnptrs, lastdnptr) for (cpp = dnptrs; cpp < lastdnptr; cpp++) { dn = exp_dn; sp = cp = *cpp; - while (n = *cp++) { + while ((n = *cp++)) { /* * check for indirection */ diff --git a/lib/libc/ip/res_mkquery.c b/lib/libc/ip/res_mkquery.c index ef6a0ab0f..132eeb894 100644 --- a/lib/libc/ip/res_mkquery.c +++ b/lib/libc/ip/res_mkquery.c @@ -55,6 +55,7 @@ static char sccsid[] = "@(#)res_mkquery.c 6.12 (Berkeley) 6/1/90"; * Form all types of queries. * Returns the size of the result or -1. */ +int res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen) int op; /* opcode of query */ _CONST char *dname; /* domain name */ diff --git a/lib/libc/ip/res_query.c b/lib/libc/ip/res_query.c index 7f8f57456..9bc4ad3a1 100644 --- a/lib/libc/ip/res_query.c +++ b/lib/libc/ip/res_query.c @@ -154,6 +154,7 @@ res_query(name, class, type, answer, anslen) * Only useful for queries in the same name hierarchy as the local host * (not, for example, for host address-to-name lookups in domain in-addr.arpa). */ +int res_search(name, class, type, answer, anslen) char *name; /* domain name */ int class, type; /* class and type of query */ diff --git a/lib/libc/ip/res_send.c b/lib/libc/ip/res_send.c index 7e5c47c17..980e9de9a 100644 --- a/lib/libc/ip/res_send.c +++ b/lib/libc/ip/res_send.c @@ -105,6 +105,7 @@ static struct sockaddr no_addr; #endif /* FD_SET */ #endif /* _MINIX */ +int res_send(buf, buflen, answer, anslen) const char *buf; int buflen; diff --git a/lib/libc/ip/ruserok.c b/lib/libc/ip/ruserok.c index ec00a792f..f4d946dcf 100644 --- a/lib/libc/ip/ruserok.c +++ b/lib/libc/ip/ruserok.c @@ -61,18 +61,18 @@ static int match(const char *word, const char *pattern) #define lc(c, d) ((((c)= (d)) - 'A') <= ('Z' - 'A') ? (c)+= ('a' - 'A') : 0) for (;;) { - lc(cw, *word); - lc(cp, *pattern); + (void) lc(cw, *word); + (void) lc(cp, *pattern); if (cp == '*') { do pattern++; while (*pattern == '*'); - lc(cp, *pattern); + (void) lc(cp, *pattern); if (cp == 0) return 1; while (cw != 0) { if (cw == cp && match(word+1, pattern+1)) return 1; word++; - lc(cw, *word); + (void) lc(cw, *word); } return 0; } else diff --git a/lib/libc/ip/servxcheck.c b/lib/libc/ip/servxcheck.c index db5d4e9f7..dc10dcd75 100644 --- a/lib/libc/ip/servxcheck.c +++ b/lib/libc/ip/servxcheck.c @@ -96,18 +96,18 @@ static int match(const char *word, const char *pattern) #define lc(c, d) ((((c)= (d)) - 'A') <= ('Z' - 'A') ? (c)+= ('a' - 'A') : 0) for (;;) { - lc(cw, *word); - lc(cp, *pattern); + (void) lc(cw, *word); + (void) lc(cp, *pattern); if (cp == '*') { do pattern++; while (*pattern == '*'); - lc(cp, *pattern); + (void) lc(cp, *pattern); if (cp == 0) return 1; while (cw != 0) { if (cw == cp && match(word+1, pattern+1)) return 1; word++; - lc(cw, *word); + (void) lc(cw, *word); } return 0; } else diff --git a/lib/libc/other/_getsysinfo.c b/lib/libc/other/_getsysinfo.c index bd9213091..e43b3d4d8 100644 --- a/lib/libc/other/_getsysinfo.c +++ b/lib/libc/other/_getsysinfo.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include "../../../kernel/proc.h" diff --git a/lib/libc/other/_mount.c b/lib/libc/other/_mount.c index f846d6ec7..952963a50 100644 --- a/lib/libc/other/_mount.c +++ b/lib/libc/other/_mount.c @@ -65,7 +65,7 @@ int mountflags; sprintf(label, "fs_%.12s", p); } else { if (stat(name, &statbuf) < 0) return -1; - sprintf(label, "fs_%04x%x", statbuf.st_dev, statbuf.st_ino); + sprintf(label, "fs_%04x%lx", statbuf.st_dev, statbuf.st_ino); } /* Tell VFS that we are passing in a 16-byte label. */ diff --git a/lib/libc/other/hypot.c b/lib/libc/other/hypot.c index 8682e885f..2d9e99233 100644 --- a/lib/libc/other/hypot.c +++ b/lib/libc/other/hypot.c @@ -12,7 +12,6 @@ struct complex { }; _PROTOTYPE(double hypot, (double x, double y )); -_PROTOTYPE(double cabs, (struct complex p_compl )); /* $Header$ */ @@ -34,9 +33,14 @@ hypot(double x, double y) return y*sqrt(x*x+1.0); } +#if 0 + +_PROTOTYPE(double cabs, (struct complex p_compl )); + double cabs(p_compl) struct complex p_compl; { return hypot(p_compl.r, p_compl.i); } +#endif diff --git a/lib/libc/other/putenv.c b/lib/libc/other/putenv.c index 455ad5c5b..1b9cefc57 100644 --- a/lib/libc/other/putenv.c +++ b/lib/libc/other/putenv.c @@ -26,7 +26,7 @@ char *name; if (!name) return 0; if (*_penviron == NULL) return 1; - if (r = strchr(name, '=')) { + if ((r = strchr(name, '='))) { register _CONST char *p, *q; *r = '\0'; @@ -65,7 +65,7 @@ char *name; size = i; p = *_penviron; *_penviron = v; - while (*v++ = *p++); /* copy the environment */ + while ((*v++ = *p++)); /* copy the environment */ v = *_penviron; } else if (!(size % ENTRY_INC)) { if (!(v = realloc(*_penviron, rounded(size) * sizeof(char **)))) diff --git a/lib/libc/other/putw.c b/lib/libc/other/putw.c index 807f67f4e..a7686e9ce 100644 --- a/lib/libc/other/putw.c +++ b/lib/libc/other/putw.c @@ -16,7 +16,7 @@ register FILE *stream; register char *p = (char *) &w; while (cnt--) { - putc(*p++, stream); + (void) putc(*p++, stream); } if (ferror(stream)) return EOF; return w; diff --git a/lib/libc/other/setenv.c b/lib/libc/other/setenv.c index 2c0dbfce7..a04076f5f 100644 --- a/lib/libc/other/setenv.c +++ b/lib/libc/other/setenv.c @@ -47,6 +47,7 @@ char *__findenv(const char *, int *); * Set the value of the environmental variable "name" to be * "value". If rewrite is set, replace any current value. */ +int setenv(name, value, rewrite) register const char *name; register const char *value; @@ -64,7 +65,7 @@ setenv(name, value, rewrite) if (!rewrite) return (0); if (strlen(c) >= l_value) { /* old larger; copy over */ - while (*c++ = *value++); + while ((*c++ = *value++)); return (0); } } else { /* create new slot */ @@ -94,7 +95,7 @@ setenv(name, value, rewrite) malloc((size_t)((int)(c - name) + l_value + 2)))) return (-1); for (c = environ[offset]; (*c = *name++) && *c != '='; ++c); - for (*c++ = '='; *c++ = *value++;); + for (*c++ = '='; (*c++ = *value++);); return (0); } diff --git a/lib/libc/regex/engine.c b/lib/libc/regex/engine.c index b3e5f5bad..14f6c0677 100644 --- a/lib/libc/regex/engine.c +++ b/lib/libc/regex/engine.c @@ -686,6 +686,7 @@ sopno lev; /* PLUS nesting level */ /* "can't happen" */ assert(nope); /* NOTREACHED */ + _exit(1); } /* diff --git a/lib/libc/regex/regexec.c b/lib/libc/regex/regexec.c index 7890a88c4..fe7335b14 100644 --- a/lib/libc/regex/regexec.c +++ b/lib/libc/regex/regexec.c @@ -53,6 +53,7 @@ static char sccsid[] = "@(#)regexec.c 8.3 (Berkeley) 3/20/94"; #include #include #include +#include #ifdef __minix_vmd #include #else diff --git a/lib/libc/stdio/doprnt.c b/lib/libc/stdio/doprnt.c index 432b5edce..22e97851f 100644 --- a/lib/libc/stdio/doprnt.c +++ b/lib/libc/stdio/doprnt.c @@ -131,7 +131,7 @@ _doprnt(register const char *fmt, va_list ap, FILE *stream) const char *oldfmt; char *s1, buf[1025]; - while (c = *fmt++) { + while ((c = *fmt++)) { if (c != '%') { #ifdef CPM if (c == '\n') { diff --git a/lib/libc/stdio/mktemp.c b/lib/libc/stdio/mktemp.c index fbd021802..4cd712163 100644 --- a/lib/libc/stdio/mktemp.c +++ b/lib/libc/stdio/mktemp.c @@ -46,6 +46,7 @@ static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93"; static int _gettemp(char*,int*); +int mkstemp(path) char *path; { @@ -61,7 +62,7 @@ mktemp(path) return(_gettemp(path, (int *)NULL) ? path : (char *)NULL); } -static +static int _gettemp(path, doopen) char *path; register int *doopen; diff --git a/lib/libc/stdio/vsprintf.c b/lib/libc/stdio/vsprintf.c index 7452a29e0..7f0cc2f9e 100644 --- a/lib/libc/stdio/vsprintf.c +++ b/lib/libc/stdio/vsprintf.c @@ -22,7 +22,7 @@ vsnprintf(char *s, size_t n, const char *format, va_list arg) retval = _doprnt(format, arg, &tmp_stream); tmp_stream._count = 1; - putc('\0',&tmp_stream); + (void) putc('\0',&tmp_stream); return retval; } diff --git a/lib/libcurses/cursesio.c b/lib/libcurses/cursesio.c index 22e75e40a..faf720879 100644 --- a/lib/libcurses/cursesio.c +++ b/lib/libcurses/cursesio.c @@ -48,7 +48,7 @@ char *s; void outc(c) int c; { - putchar(c); + (void) putchar(c); } /* Move cursor to r,c */ diff --git a/lib/libcurses/update.c b/lib/libcurses/update.c index 446326085..7c027d399 100644 --- a/lib/libcurses/update.c +++ b/lib/libcurses/update.c @@ -58,7 +58,7 @@ int ch; { if ((_cursvar.cursrow < LINES) || (_cursvar.curscol < COLS)) { newattr(ch); - putchar(ch); + (void) putchar(ch); } } diff --git a/lib/libcurses/wgetch.c b/lib/libcurses/wgetch.c index 1582f10b2..88768558a 100644 --- a/lib/libcurses/wgetch.c +++ b/lib/libcurses/wgetch.c @@ -17,7 +17,7 @@ WINDOW *win; } inp = getchar(); if (_cursvar.echoit) { - mvwaddch(curscr, win->_cury + win->_begy, + (void) mvwaddch(curscr, win->_cury + win->_begy, win->_curx + win->_begx, inp); waddch(win, inp); } diff --git a/lib/libedit/editline.c b/lib/libedit/editline.c index 9af0e6982..355063a19 100644 --- a/lib/libedit/editline.c +++ b/lib/libedit/editline.c @@ -5,6 +5,8 @@ #include #include #include +#include +#include /* ** Manifest constants. diff --git a/lib/libsys/panic.c b/lib/libsys/panic.c index 464101d81..5103fd7af 100644 --- a/lib/libsys/panic.c +++ b/lib/libsys/panic.c @@ -18,12 +18,8 @@ PUBLIC void panic(const char *fmt, ...) endpoint_t me = NONE; char name[20]; void (*suicide)(void); - static int panicing= 0; va_list args; - if(panicing) return; - panicing= 1; - if(sys_whoami(&me, name, sizeof(name)) == OK && me != NONE) printf("%s(%d): panic: ", name, me); else diff --git a/lib/libsys/sef.c b/lib/libsys/sef.c index 985722534..212dd9c9e 100644 --- a/lib/libsys/sef.c +++ b/lib/libsys/sef.c @@ -166,6 +166,7 @@ PUBLIC void _exit(int status) { /* Make exit() an alias for sef_exit() for system services. */ sef_exit(status); + panic("sef_exit failed"); } /*===========================================================================* @@ -175,6 +176,7 @@ PUBLIC void __exit(int status) { /* Make exit() an alias for sef_exit() for system services. */ sef_exit(status); + panic("sef_exit failed"); } /*===========================================================================* diff --git a/lib/libz/gzlib.c b/lib/libz/gzlib.c index 603e60ed5..19b1dc2ab 100644 --- a/lib/libz/gzlib.c +++ b/lib/libz/gzlib.c @@ -3,6 +3,8 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ +#include + #include "gzguts.h" #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 diff --git a/lib/libz/gzread.c b/lib/libz/gzread.c index 548201ab0..e33998117 100644 --- a/lib/libz/gzread.c +++ b/lib/libz/gzread.c @@ -3,6 +3,8 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ +#include + #include "gzguts.h" /* Local functions */ @@ -167,12 +169,12 @@ local int gz_head(state) gz_error(state, Z_DATA_ERROR, "unknown header flags set"); return -1; } - NEXT(); /* modification time */ - NEXT(); - NEXT(); - NEXT(); - NEXT(); /* extra flags */ - NEXT(); /* operating system */ + (void) NEXT(); /* modification time */ + (void) NEXT(); + (void) NEXT(); + (void) NEXT(); + (void) NEXT(); /* extra flags */ + (void) NEXT(); /* operating system */ if (flags & 4) { /* extra field */ len = (unsigned)NEXT(); len += (unsigned)NEXT() << 8; @@ -187,8 +189,8 @@ local int gz_head(state) while (NEXT() > 0) ; if (flags & 2) { /* header crc */ - NEXT(); - NEXT(); + (void) NEXT(); + (void) NEXT(); } /* an unexpected end of file is not checked for here -- it will be noticed on the first request for uncompressed data */ diff --git a/lib/libz/gzwrite.c b/lib/libz/gzwrite.c index e8defc688..bcd150f02 100644 --- a/lib/libz/gzwrite.c +++ b/lib/libz/gzwrite.c @@ -5,6 +5,8 @@ #include "gzguts.h" +#include + /* Local functions */ local int gz_init OF((gz_statep)); local int gz_comp OF((gz_statep, int));